
@font-face {
  font-family: "Iansui";
  src: url("../fonts/Iansui-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --bg-main: #090d11;
  --bg-sidebar: #080b0e;
  --surface-1: rgba(17, 22, 26, 0.96);
  --surface-2: rgba(24, 30, 35, 0.88);
  --surface-hover: rgba(34, 40, 45, 0.92);
  --border-subtle: rgba(184, 154, 98, 0.16);
  --border-strong: rgba(184, 154, 98, 0.48);
  --gold: #b89a62;
  --gold-light: #e1c27d;
  --gold-muted: #9b7542;
  --amber: #e89a37;
  --wine: #7a2832;
  --wine-bright: #963846;
  --text-primary: #f1eee8;
  --text-secondary: #aaa69f;
  --text-muted: #686a6c;
  --danger: #a94a43;
  --medium: #ad8240;
  --low: #747b82;
  --radius-panel: 14px;
  --radius-button: 9px;
  --shadow-panel: 0 16px 40px rgba(0, 0, 0, 0.28);
  --glow-gold: 0 0 10px rgba(184, 154, 98, 0.18);
  font-family: "Iansui", "芫荽", "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text-primary);
  background:
    radial-gradient(circle at 3% 88%, rgba(215, 167, 89, 0.08), transparent 20%),
    linear-gradient(90deg, rgba(7, 11, 14, 0.98), rgba(9, 13, 17, 0.96)),
    var(--bg-main);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  background:
    radial-gradient(circle at 72% 8%, rgba(215, 167, 89, 0.12), transparent 26%),
    radial-gradient(circle at 12% 92%, rgba(255, 255, 255, 0.04), transparent 24%);
  mix-blend-mode: screen;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:active { transform: translateY(1px); }

input, textarea, select {
  width: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-button);
  color: var(--text-primary);
  background: rgba(5, 8, 10, 0.78);
  padding: 11px 12px;
  outline: none;
}

textarea { min-height: 88px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(215, 167, 89, 0.1);
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr);
  grid-template-rows: 96px minmax(0, 1fr);
  grid-template-areas:
    "sidebar topbar"
    "sidebar dashboard";
}

.sidebar {
  grid-area: sidebar;
  position: sticky;
  top: 0;
  height: 100dvh;
  border-right: 1px solid var(--border-subtle);
  background:
    linear-gradient(180deg, rgba(8, 11, 14, 0.98), rgba(6, 8, 10, 0.94)),
    var(--bg-sidebar);
  box-shadow: inset -1px 0 0 rgba(240, 200, 121, 0.08);
  overflow: hidden;
}

.sidebar::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 230px;
  opacity: 0.42;
  background:
    linear-gradient(180deg, transparent, rgba(215, 167, 89, 0.06)),
    url("../images/office-corner.png") center bottom / cover no-repeat;
  filter: saturate(0.7) brightness(0.56);
  pointer-events: none;
}

.brand-block {
  height: 100px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 40px;
  line-height: 1;
  color: #ffd68c;
  text-shadow: 0 0 18px rgba(232, 154, 55, 0.36), 0 2px 0 #19100a;
}

.sidebar-nav {
  display: grid;
  padding: 2px 0;
}

.nav-item {
  position: relative;
  min-height: 72px;
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  border: 0;
  border-left: 2px solid transparent;
  color: var(--text-secondary);
  background: transparent;
  text-align: left;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-primary);
}

.nav-item.active {
  color: var(--gold-light);
  border-left-color: var(--amber);
  background:
    linear-gradient(90deg, rgba(213, 151, 63, 0.18), rgba(213, 151, 63, 0.02));
  box-shadow: inset 0 0 0 1px rgba(215, 167, 89, 0.16);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 15%;
  bottom: 15%;
  width: 2px;
  background: var(--gold-light);
  box-shadow: 0 0 12px var(--amber);
}

.nav-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(215, 167, 89, 0.2);
  color: var(--gold);
  background: rgba(255, 255, 255, 0.025);
  font-size: 20px;
}

.nav-copy strong {
  display: block;
  font-size: 16px;
  letter-spacing: 0;
}

.nav-copy small {
  display: block;
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.topbar {
  grid-area: topbar;
  min-width: 0;
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 190px;
  align-items: center;
  gap: 28px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid rgba(215, 167, 89, 0.1);
  background: linear-gradient(90deg, rgba(10, 13, 16, 0.9), rgba(8, 11, 14, 0.72));
}

.level strong {
  display: block;
  font-size: 18px;
  color: var(--gold-light);
}

.level small { color: var(--text-primary); }

.metric-list {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(82px, 1fr));
  gap: clamp(20px, 2vw, 34px);
  align-items: center;
}

.metric span {
  display: block;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 3px;
}

.metric strong {
  display: block;
  font-size: 16px;
  font-weight: 500;
}

.metric-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ability-meter-card {
  min-width: 0;
  padding: 2px 0 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.ability-meter-head {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 7px;
}

.ability-meter-head em {
  min-width: 0;
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  font-style: normal;
  font-weight: 400;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ability-meter-head small {
  color: rgba(225, 194, 125, 0.62);
  font-size: 10px;
  font-weight: 400;
  white-space: nowrap;
}

.ability-meter-value {
  margin-top: 5px;
  color: var(--text-primary);
  font-size: 18px;
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.top-progress-meter {
  height: 3px;
  margin-top: 9px;
  background: rgba(255, 255, 255, 0.1);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold-light);
  box-shadow: 0 0 11px var(--amber);
}

.progress-meter {
  display: block;
  width: 100%;
  height: 4px;
  margin-top: 8px;
  border: 0;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
  appearance: none;
}

.progress-meter::-webkit-progress-bar {
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
}

.progress-meter::-webkit-progress-value {
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold-muted), var(--gold-light));
}

.progress-meter::-moz-progress-bar {
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold-muted), var(--gold-light));
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  color: var(--gold-light);
}

.icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  position: relative;
  border: 1px solid rgba(215, 167, 89, 0.18);
  border-radius: 4px;
  background: transparent;
  color: var(--gold-light);
  font-size: 18px;
  transition: border-color 180ms ease, background 180ms ease, transform 160ms ease;
}

.icon-button:hover {
  border-color: rgba(215, 167, 89, 0.46);
  background: rgba(215, 167, 89, 0.06);
}

.top-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  position: relative;
  color: currentColor;
}

.top-icon svg {
  width: 20px;
  height: 20px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.profile-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  position: relative;
  border: 1px solid rgba(215, 167, 89, 0.18);
  border-radius: 4px;
  background:
    linear-gradient(145deg, rgba(215, 167, 89, 0.035), transparent 55%),
    rgba(5, 8, 10, 0.2);
  color: var(--gold-light);
  transition: border-color 180ms ease, background 180ms ease, transform 160ms ease;
}

.profile-button:hover {
  border-color: rgba(215, 167, 89, 0.46);
  background: rgba(215, 167, 89, 0.06);
}

.dashboard {
  grid-area: dashboard;
  min-width: 0;
  padding: 8px 410px 22px 22px;
}

.page { display: none; }
.page.active { display: block; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.widget-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}


.widget-grid > .panel { min-height: 230px; }
.widget-grid > .panel .panel-content { padding: 16px 16px 18px; }
.widget-grid > .panel .panel-header { min-height: 56px; padding: 0 16px; }
.widget-grid > .panel:nth-child(2) { min-width: 0; }

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 14px;
  margin-top: 8px;
}

.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-panel);
  background:
    linear-gradient(145deg, rgba(30, 36, 41, 0.95), rgba(12, 16, 20, 0.96)),
    var(--surface-1);
  box-shadow: var(--shadow-panel);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(255, 222, 164, 0.08);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.02), transparent 22%, rgba(255,255,255,0.012));
  opacity: 0.52;
}

.panel > * { position: relative; z-index: 1; }

body[data-page="home"] .mission-panel,
body[data-page="home"] .home-learning-wide,
body[data-page="home"] .home-light-wide,
body[data-page="home"] .panel-judgement {
  border-color: rgba(244, 210, 137, 0.36);
  background:
    radial-gradient(circle at 82% 12%, rgba(244, 210, 137, 0.055), transparent 32%),
    linear-gradient(145deg, rgba(24, 21, 16, 0.9), rgba(10, 13, 15, 0.92));
}

body[data-page="home"] .mission-panel::before,
body[data-page="home"] .home-learning-wide::before,
body[data-page="home"] .home-light-wide::before,
body[data-page="home"] .panel-judgement::before {
  border-color: rgba(255, 222, 164, 0.1);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.018), transparent 24%, rgba(255, 255, 255, 0.01));
  opacity: 0.58;
}

.panel-header {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 22px;
  border-bottom: 1px solid rgba(215, 167, 89, 0.16);
}

.panel-header h1, .panel-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: 0;
}

.panel-header h2 { font-size: 19px; }

.panel-count {
  color: var(--gold-light);
  font-size: 13px;
  white-space: nowrap;
}

.collapse-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(215, 167, 89, 0.14);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.025);
  color: var(--gold-light);
  font-size: 0;
  transition: transform 220ms ease, background 180ms ease, border-color 180ms ease;
}

.collapse-button::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform 220ms ease;
}

.collapse-button:hover {
  background: rgba(215, 167, 89, 0.08);
  border-color: rgba(215, 167, 89, 0.32);
}

.panel-content {
  max-height: 980px;
  overflow: hidden;
  padding: 20px 24px 22px;
  opacity: 1;
  transition: max-height 260ms ease, opacity 180ms ease, padding 220ms ease;
}

.is-collapsed .panel-content {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  pointer-events: none;
}

.is-collapsed .collapse-button::before {
  transform: rotate(-135deg) translate(-1px, -1px);
}

.is-collapsed {
  min-height: 0 !important;
}

.mission-panel { min-height: 420px; }

.mission-row {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 22px;
  padding: 17px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mission-row:last-child { border-bottom: 0; }

.row-label {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--gold-light);
  font-weight: 700;
}

.row-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(215, 167, 89, 0.32);
  color: var(--gold-light);
}

.row-value strong {
  display: block;
  font-size: 20px;
  font-weight: 500;
}

.inline-progress {
  display: grid;
  grid-template-columns: 96px minmax(150px, 260px);
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}

.phase {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  align-items: center;
}

.phase strong {
  color: var(--gold-light);
  letter-spacing: 0.03em;
}

.criteria {
  margin: 0;
  padding-left: 18px;
  color: var(--text-primary);
  line-height: 1.7;
}

.mission-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.command-button {
  min-height: 54px;
  border: 1px solid rgba(215, 167, 89, 0.18);
  border-radius: var(--radius-button);
  background: linear-gradient(180deg, rgba(35, 42, 47, 0.82), rgba(15, 19, 22, 0.9));
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  transition: transform 160ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.command-button:hover:not(.locked) {
  transform: translateY(-1px);
  border-color: rgba(215, 167, 89, 0.42);
  background: linear-gradient(180deg, rgba(42, 49, 54, 0.9), rgba(18, 22, 25, 0.94));
}

.command-button.primary {
  border-color: rgba(226, 185, 110, 0.68);
  color: #17130d;
  background:
    linear-gradient(180deg, #f0cd7f, #c39442 58%, #9f6e2d);
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 245, 196, 0.34);
}

.command-button.primary:hover {
  border-color: rgba(255, 218, 142, 0.82);
  background:
    linear-gradient(180deg, #ffd98b, #cda04d 58%, #a87835);
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.34),
    0 0 14px rgba(226, 185, 110, 0.14);
}

.command-button.locked {
  color: var(--text-muted);
  opacity: 0.66;
  cursor: not-allowed;
}

.mission-actions .command-button.primary {
  border-color: rgba(226, 185, 110, 0.68);
  background:
    linear-gradient(180deg, #f0cd7f, #c39442 58%, #9f6e2d);
}

.command-button.danger {
  border-color: rgba(164, 68, 75, 0.66);
  color: #f7eee6;
  background:
    linear-gradient(180deg, rgba(118, 39, 48, 0.94), rgba(82, 27, 34, 0.96));
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.command-button.danger:hover:not(.locked) {
  border-color: rgba(190, 82, 91, 0.82);
  background:
    linear-gradient(180deg, rgba(139, 47, 58, 0.98), rgba(92, 31, 39, 0.98));
}

.character-panel {
  min-height: 493px;
  position: relative;
  display: block;
  padding: 0;
}

.character-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 76% 34%, rgba(219, 154, 71, 0.15), transparent 32%),
    linear-gradient(145deg, #11161a, #080b0d);
}

.character-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../images/reborn-command-portrait.png") right -18px top -18px / auto 112% no-repeat;
  filter: saturate(0.95) brightness(0.93) contrast(1.05);
}

.character-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7, 10, 12, 0.36), transparent 36%, rgba(7, 10, 12, 0.12));
}

.character-command {
  position: absolute;
  z-index: 6;
  left: 10px;
  right: 10px;
  bottom: 10px;
  width: auto;
  padding: 0;
  border: 0;
  text-align: left;
  background: transparent;
}

.widget-list {
  display: grid;
  gap: 10px;
}

.widget-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.022);
}

.widget-row strong {
  display: block;
  margin-bottom: 3px;
  font-weight: 500;
}

.widget-row small {
  color: var(--text-secondary);
  line-height: 1.45;
}

.skill-slot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 14px;
  border: 1px solid rgba(215, 167, 89, 0.14);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(13, 17, 20, 0.72), rgba(25, 31, 35, 0.5));
  overflow: hidden;
}

.skill-slot {
  min-width: 0;
  border: 0;
  border-right: 1px solid rgba(215, 167, 89, 0.16);
  border-radius: 0;
  padding: 14px 16px;
  background: transparent;
}

.skill-slot:last-child {
  border-right: 0;
}

.skill-slot span {
  display: block;
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.skill-slot strong {
  display: block;
  margin-top: 7px;
  color: var(--text-primary);
  font-size: clamp(19px, 2vw, 28px);
  line-height: 1.22;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.skill-slot small {
  display: block;
  margin-top: 7px;
  color: var(--text-secondary);
  line-height: 1.45;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.learning-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.active-learning-panel .panel-content {
  display: grid;
  gap: 16px;
}

.active-learning-panel,
.unlock-order-panel {
  grid-column: span 2;
}

.active-learning-panel .skill-slot-grid {
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.active-learning-panel .skill-slot {
  display: grid;
  grid-template-columns: 116px minmax(170px, 0.72fr) minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: start;
  gap: 8px 18px;
  min-height: 0;
  padding: 15px 18px 16px;
  border: 1px solid rgba(215, 167, 89, 0.18);
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(17, 22, 26, 0.86), rgba(10, 13, 15, 0.78));
}

.active-learning-panel .skill-slot:last-child {
  border-right: 1px solid rgba(215, 167, 89, 0.18);
}

.active-learning-panel .skill-slot span {
  grid-column: 1;
  grid-row: 1 / span 2;
  padding-top: 3px;
  font-size: 12px;
  line-height: 1.3;
  white-space: normal;
}

.active-learning-panel .skill-slot strong {
  grid-column: 2;
  grid-row: 1;
  margin-top: 0;
  font-size: clamp(19px, 1.6vw, 25px);
  line-height: 1.2;
  font-weight: 500;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: keep-all;
}

.active-learning-panel .skill-slot small {
  margin-top: 0;
  color: var(--text-secondary);
  font-size: clamp(13px, 1vw, 15px);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.active-learning-panel .skill-slot small:first-of-type {
  grid-column: 3;
  grid-row: 1;
  padding-top: 4px;
}

.active-learning-panel .skill-slot small:last-of-type {
  grid-column: 2 / 4;
  grid-row: 2;
  max-width: 58ch;
  color: rgba(170, 166, 159, 0.86);
}

.active-learning-panel .status-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 0;
}

.active-learning-panel .status-chip {
  min-height: 68px;
  padding: 10px 13px;
}

.active-learning-panel .status-chip strong {
  font-size: clamp(15px, 1.18vw, 18px);
  line-height: 1.35;
}

.unlock-order-panel .widget-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.unlock-order-panel .widget-row {
  min-height: 86px;
  align-items: start;
}

.unlock-order-panel .widget-row small {
  display: block;
  margin-top: 5px;
}

.learning-light-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid rgba(215, 167, 89, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.024);
}

.learning-light-action span {
  display: block;
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 700;
}

.learning-light-action strong {
  display: block;
  margin-top: 4px;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 500;
}

.learning-light-action small {
  display: block;
  margin-top: 3px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.learning-light-action .command-button {
  min-height: 42px;
  padding: 0 16px;
  white-space: nowrap;
}

.risk {
  min-width: 38px;
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  text-align: center;
  color: var(--gold-light);
  background: rgba(125, 74, 25, 0.25);
}

.risk.high {
  color: #ffb4a9;
  border-color: rgba(169, 74, 67, 0.7);
  background: rgba(169, 74, 67, 0.22);
}

.risk.low {
  color: #c7ced5;
  border-color: rgba(116, 123, 130, 0.7);
  background: rgba(116, 123, 130, 0.14);
}

.coin-value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gold-light);
  font-weight: 700;
  white-space: nowrap;
}

.coin-value::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(233, 196, 113, 0.88);
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 238, 170, 0.92) 0 9%, transparent 10%),
    linear-gradient(145deg, #f0c96f, #a7772f 72%);
  box-shadow:
    inset 0 0 0 3px rgba(43, 29, 10, 0.24),
    inset 0 -2px 3px rgba(49, 30, 8, 0.36),
    0 0 8px rgba(215, 167, 89, 0.18);
}

.risk.pass {
  color: #d7f3d0;
  border-color: rgba(100, 150, 90, 0.58);
  background: rgba(70, 112, 67, 0.2);
}

.risk.warn {
  color: #ffe0aa;
  border-color: rgba(184, 154, 98, 0.68);
  background: rgba(184, 154, 98, 0.18);
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.meta-chip {
  border: 1px solid rgba(184, 154, 98, 0.16);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.026);
  font-size: 12px;
  line-height: 1.45;
}

.radar-wrap {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(142px, 1.1fr);
  gap: 14px;
  align-items: center;
  min-height: 150px;
}

[data-panel-key="growth"] .radar-wrap {
  grid-template-columns: 1fr;
  min-height: 0;
}

[data-panel-key="growth"] #growthReasons > .widget-row {
  display: none;
}

.mission-learning {
  margin-bottom: 14px;
}

.mission-divider {
  height: 1px;
  margin: 4px 0 12px;
  background: linear-gradient(90deg, rgba(215, 167, 89, 0.48), rgba(215, 167, 89, 0.08));
}

.home-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.home-status-tile {
  padding: 12px;
  border: 1px solid rgba(215, 167, 89, 0.2);
  background: rgba(255, 255, 255, 0.025);
}

.home-status-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 6px;
}

.home-status-tile strong {
  display: block;
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.25;
}

.quick-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-entry {
  min-height: 82px;
  padding: 12px;
  border: 1px solid rgba(215, 167, 89, 0.22);
  background: rgba(255, 255, 255, 0.026);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.quick-entry:hover {
  transform: translateY(-1px);
  border-color: rgba(244, 210, 137, 0.48);
  background: rgba(244, 210, 137, 0.07);
}

.quick-entry span {
  display: block;
  color: var(--gold);
  font-size: 1.08rem;
  margin-bottom: 6px;
}

.quick-entry strong {
  display: block;
  font-size: 0.95rem;
  line-height: 1.2;
}

.quick-entry small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.today-task-card {
  display: grid;
  gap: 14px;
}

.today-task-title {
  display: grid;
  gap: 7px;
}

.today-task-title span {
  color: var(--gold-light);
  font-size: 0.82rem;
  font-weight: 700;
}

.today-task-title strong {
  color: var(--text-primary);
  font-size: clamp(26px, 3.4vw, 42px);
  line-height: 1.16;
  text-wrap: balance;
}

.today-task-meta,
.judgement-list {
  display: grid;
  gap: 10px;
}

.today-task-meta {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.today-task-meta .meta-chip,
.judgement-list .meta-chip {
  min-height: 68px;
}

.today-task-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  padding-top: 10px;
  margin-top: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.today-task-actions .command-button {
  min-height: 48px;
  border-radius: 9px;
  font-size: clamp(15px, 1.35vw, 18px);
  letter-spacing: 0.01em;
  justify-content: center;
}

.today-task-actions .command-button.locked,
.today-task-actions .command-button:disabled {
  opacity: 0.45;
  background: linear-gradient(180deg, rgba(25, 31, 35, 0.62), rgba(10, 13, 15, 0.78));
  border-color: rgba(215, 167, 89, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.018);
}

.task-more {
  position: relative;
  display: inline-block;
}

.task-more summary {
  list-style: none;
  min-width: 44px;
  min-height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(215, 167, 89, 0.34);
  border-radius: 8px;
  color: var(--gold-light);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.026);
}

.task-more summary::-webkit-details-marker {
  display: none;
}

.task-more-menu {
  position: static;
  min-width: 180px;
  margin-top: 8px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(215, 167, 89, 0.28);
  border-radius: 8px;
  background: rgba(11, 14, 16, 0.98);
  box-shadow: var(--shadow-panel);
}

.task-more:not([open]) .task-more-menu {
  display: none;
}

.task-more[open] {
  display: grid;
  gap: 8px;
  width: min(220px, 100%);
}

.panel-judgement {
  grid-column: span 2;
  border-color: rgba(244, 210, 137, 0.36);
  background: linear-gradient(145deg, rgba(24, 21, 16, 0.9), rgba(10, 13, 15, 0.92));
}

.home-learning-wide {
  grid-column: span 2;
}

.home-light-wide {
  grid-column: span 2;
}

.light-side-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 18px;
  border: 1px solid rgba(215, 167, 89, 0.2);
  border-radius: 10px;
  background: linear-gradient(105deg, rgba(255, 255, 255, 0.032), rgba(255, 255, 255, 0.012));
}

.light-side-card span {
  display: block;
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.light-side-card strong {
  display: block;
  margin-top: 5px;
  color: var(--text-primary);
  font-size: clamp(18px, 1.55vw, 23px);
  font-weight: 500;
  line-height: 1.18;
}

.light-side-card small {
  display: block;
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: clamp(12px, 1.05vw, 15px);
  line-height: 1.35;
}

.light-side-card .command-button {
  min-width: 86px;
  min-height: 44px;
  border-radius: 9px;
  font-size: clamp(14px, 1.1vw, 17px);
  justify-content: center;
}

.judgement-callout {
  padding: 14px;
  border-left: 3px solid var(--gold);
  background: rgba(244, 210, 137, 0.055);
  color: var(--text-primary);
  line-height: 1.55;
}

.judgement-callout .reborn-life-status {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.judgement-callout .reborn-life-status .status-chip {
  min-height: 60px;
  align-items: flex-start;
  justify-content: center;
}

.home-panel-hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .today-task-meta,
  .home-status-grid,
  .quick-entry-grid {
    grid-template-columns: 1fr;
  }

  .home-learning-wide {
    grid-column: span 1;
  }

  .home-light-wide {
    grid-column: span 1;
  }

  .panel-judgement {
    grid-column: span 1;
  }

  .light-side-card {
    grid-template-columns: 1fr;
  }

  .judgement-callout .reborn-life-status {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .learning-light-action {
    grid-template-columns: 1fr;
  }

  .task-more-menu {
    min-width: 0;
  }
}

#radar:empty {
  display: none;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.mini-stat {
  border-right: 1px solid rgba(215, 167, 89, 0.14);
}

.mini-stat:last-child { border-right: 0; }

.mini-stat span {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
}

.mini-stat strong {
  display: block;
  margin-top: 4px;
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 500;
}

.panel-link {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--gold-light);
  background: transparent;
  border: 0;
  width: 100%;
  text-align: right;
  font-weight: 700;
}

.page-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 8px 0 14px;
}

.page-title h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 500;
}

.page-title p {
  margin: 6px 0 0;
  color: var(--text-secondary);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .full { grid-column: 1 / -1; }

label {
  display: grid;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 13px;
}

.chat {
  height: 410px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding-right: 6px;
}

.reborn-stage-panel {
  overflow: hidden;
}

.reborn-stage-content {
  max-height: none;
  padding: 0;
  overflow: hidden;
}

.reborn-stage-scene {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  background:
    radial-gradient(circle at 54% 22%, rgba(226, 185, 110, 0.12), transparent 18%),
    linear-gradient(180deg, rgba(8, 10, 12, 0.22), rgba(7, 9, 11, 0.76) 62%, rgba(5, 7, 8, 0.98)),
    #07090b;
}

.reborn-stage-scene::before {
  content: "";
  position: absolute;
  inset: -22px 0 0;
  background: url("../images/reborn-command-portrait.png") center top / auto 112% no-repeat;
  filter: saturate(0.96) brightness(0.9) contrast(1.05);
  opacity: 0.96;
  pointer-events: none;
}

.reborn-stage-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 0 42%, rgba(7, 9, 11, 0.28) 60%, rgba(5, 7, 8, 0.78));
  pointer-events: none;
}

.reborn-stage-scene .chat {
  position: absolute;
  z-index: 3;
  left: 20px;
  right: 20px;
  bottom: 18px;
  height: min(250px, 46%);
  box-sizing: border-box;
  padding: 34px 0 0;
  overflow: hidden;
  scrollbar-width: none;
  align-content: end;
}

.reborn-stage-scene .chat::-webkit-scrollbar {
  display: none;
}

.reborn-stage-scene .bubble.user {
  justify-self: end;
  max-width: 78%;
  margin-right: 10px;
  border-radius: 8px;
  background: rgba(55, 42, 28, 0.78);
  backdrop-filter: blur(8px);
}

.reborn-stage-scene .chat-dialog {
  margin: 18px 0 0;
  min-height: 172px;
  max-height: none;
  width: 100%;
  box-sizing: border-box;
  background:
    linear-gradient(100deg, rgba(27, 31, 32, 0.9), rgba(8, 12, 15, 0.88) 48%, rgba(12, 16, 18, 0.86));
  backdrop-filter: blur(6px);
}

.reply-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
  padding: 14px 16px 16px;
  border-top: 1px solid rgba(215, 167, 89, 0.16);
  background: rgba(7, 10, 12, 0.96);
}

.reply-composer input {
  min-height: 50px;
  background: rgba(4, 6, 8, 0.88);
}

.reply-composer .command-button {
  min-height: 50px;
}

#quickActions {
  gap: 12px;
}

.choice-button {
  position: relative;
  min-height: 54px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 18px 0 14px;
  text-align: left;
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 50%, calc(100% - 20px) 100%, 0 100%, 10px 50%);
}

.choice-button::before {
  content: attr(data-icon);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(225, 194, 125, 0.42);
  border-radius: 50%;
  color: var(--gold-light);
  background: rgba(6, 8, 10, 0.72);
  font-size: 13px;
  line-height: 1;
}

.bubble {
  position: relative;
  max-width: 84%;
  padding: 12px 14px;
  border: 1px solid rgba(215, 167, 89, 0.16);
  background: rgba(255, 255, 255, 0.035);
  line-height: 1.55;
}

.bubble.user {
  justify-self: end;
  border-color: rgba(215, 167, 89, 0.42);
  background: rgba(116, 78, 28, 0.28);
}

.bubble.reborn {
  width: 100%;
  max-width: 100%;
  min-height: 118px;
  padding: 44px 30px 22px 34px;
  border-color: transparent;
  background:
    linear-gradient(90deg, rgba(5, 8, 10, 0.92), rgba(12, 15, 16, 0.84)),
    url("../images/dialog-frame.png") center / 100% 100% no-repeat;
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.45;
}

.bubble.reborn::before {
  content: "REBORN";
  position: absolute;
  left: 34px;
  top: 18px;
  color: rgba(240, 200, 121, 0.7);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  letter-spacing: 0.08em;
}

.reborn-dialog {
  position: relative;
  isolation: isolate;
  display: block;
  width: 100%;
  aspect-ratio: 3.65 / 1;
  min-height: 145px;
  max-height: 210px;
  border: 1px solid rgba(175, 142, 85, 0.52);
  border-radius: 6px;
  color: var(--text-primary);
  background:
    linear-gradient(100deg, rgba(25, 29, 30, 0.88), rgba(8, 12, 15, 0.94) 48%, rgba(12, 16, 18, 0.89));
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.025);
  cursor: pointer;
  user-select: none;
  overflow: visible;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 140ms ease;
}

.reborn-dialog:hover {
  border-color: rgba(184, 148, 88, 0.65);
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.reborn-dialog:active { transform: translateY(1px); }

.dialog-file-tab {
  position: absolute;
  z-index: 2;
  top: -22px;
  left: 0;
  width: 190px;
  height: 62px;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(32, 36, 36, 0.98), rgba(11, 14, 15, 0.98));
  border: 0;
  border-top-left-radius: 7px;
  clip-path: polygon(0 100%, 0 7px, 7px 0, calc(100% - 28px) 0, 100% 36%, calc(100% - 6px) 100%);
  filter:
    drop-shadow(0 -1px 0 rgba(170, 137, 80, 0.24))
    drop-shadow(0 1px 0 rgba(170, 137, 80, 0.34));
}

.dialog-file-tab::before {
  content: "";
  position: absolute;
  left: 20px;
  right: 30px;
  top: 1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(222, 188, 127, 0.42), transparent);
}

.dialog-file-tab::after {
  content: "";
  position: absolute;
  inset: 1px 1px 0 1px;
  background:
    linear-gradient(180deg, rgba(26, 30, 31, 0.98), rgba(12, 16, 18, 0.97));
  border-top-left-radius: 6px;
  clip-path: polygon(0 100%, 0 6px, 6px 0, calc(100% - 34px) 0, calc(100% - 2px) 35%, calc(100% - 12px) 100%);
}

.dialog-inner {
  position: relative;
  z-index: 4;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  padding: 0;
}

.dialog-speaker {
  position: absolute;
  z-index: 6;
  top: -8px;
  left: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 142px;
  min-width: 0;
  margin: 0;
  text-align: center;
  pointer-events: auto;
}

.speaker-name {
  color: #c6a66e;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
  line-height: 1;
}

.speaker-line {
  display: none;
  width: auto;
  min-width: 0;
  flex: 0;
  height: 1px;
  margin-top: 0;
  opacity: 0.62;
  background: linear-gradient(90deg, rgba(172, 133, 72, 0.62), rgba(172, 133, 72, 0.1), transparent);
}

.dialog-collapse-button {
  position: relative;
  z-index: 20;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--gold-light);
  cursor: pointer;
  pointer-events: auto;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.65));
}

.dialog-collapse-button span {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.dialog-collapse-button[aria-expanded="false"] span {
  transform: translateY(2px) rotate(225deg);
}

.dialog-content {
  position: relative;
  position: absolute;
  left: 42px;
  right: 40px;
  top: 54px;
  bottom: 42px;
  display: flex;
  align-items: flex-start;
  min-height: 0;
  padding-top: 0;
}

.dialog-text {
  display: block;
  min-width: 0;
  width: 82%;
  margin: 0;
  max-width: 82%;
  color: #eee9df;
  font-size: clamp(18px, 1.85vw, 25px);
  font-weight: 400;
  letter-spacing: 0.025em;
  line-height: 1.55;
  white-space: pre-line;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.65);
}

.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 5px;
  margin-bottom: 0.18em;
  background: #d2b27b;
  box-shadow: 0 0 6px rgba(210, 178, 123, 0.45);
  animation: cursor-blink 0.85s steps(1) infinite;
}

.typing-cursor.is-hidden {
  opacity: 0;
  animation: none;
}

@keyframes cursor-blink {
  0%, 46% { opacity: 1; }
  47%, 100% { opacity: 0; }
}

.dialog-hint {
  display: none;
  color: rgba(203, 190, 166, 0.42);
  font-size: 11px;
  letter-spacing: 0.08em;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.reborn-dialog.is-complete .dialog-hint {
  opacity: 0.74;
  transform: translateY(0);
}

.dialog-texture {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.018), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.014), transparent 25%, transparent 72%, rgba(0, 0, 0, 0.18));
  opacity: 1;
}

.dialog-texture::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0.025), transparent 34%);
  opacity: 0.5;
}

.dialog-texture::after {
  content: "";
  position: absolute;
  right: 35px;
  bottom: 15px;
  width: 80px;
  height: 38px;
  opacity: 0.035;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 60%, transparent 38%, #c9aa70 40% 43%, transparent 45%);
  transform: rotate(-8deg);
}

.corner {
  position: absolute;
  z-index: 4;
  width: 20px;
  height: 20px;
  opacity: 1;
  pointer-events: none;
}

.corner::before,
.corner::after {
  content: "";
  position: absolute;
  background: linear-gradient(90deg, rgba(223, 186, 120, 0.74), rgba(109, 82, 46, 0.42));
  box-shadow: 0 0 3px rgba(216, 166, 85, 0.13);
}

.corner::before {
  width: 17px;
  height: 1px;
}

.corner::after {
  width: 1px;
  height: 17px;
}

.corner-top-left { top: 10px; left: 10px; }
.corner-top-right { top: 10px; right: 10px; transform: rotate(90deg); opacity: 0.74; }
.corner-bottom-left { bottom: 10px; left: 10px; transform: rotate(-90deg); opacity: 0.72; }
.corner-bottom-right { right: 10px; bottom: 10px; transform: rotate(180deg); }

.character-command .reborn-dialog {
  min-height: 104px;
  max-height: 118px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.34);
}

.character-command .dialog-file-tab {
  top: -16px;
  left: 0;
  width: 148px;
  height: 46px;
}

.character-command .dialog-speaker {
  left: 0;
  top: -1px;
  width: 148px;
}

.character-command .speaker-name {
  font-size: 13px;
}

.character-command .speaker-line {
  width: 48px;
  margin-top: 6px;
}

.character-command .dialog-content {
  left: 32px;
  right: 28px;
  top: 44px;
  bottom: 28px;
}

.character-command .dialog-text {
  font-size: clamp(17px, 1.45vw, 20px);
  line-height: 1.48;
  width: 88%;
  max-width: 88%;
}

.chat-dialog {
  margin: 18px 0 2px;
  min-height: 160px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

#chatForm {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  align-items: stretch;
}

#chatForm .command-button {
  min-height: 48px;
}

.flow-panel {
  display: grid;
  gap: 14px;
}

.flow-card {
  border: 1px solid rgba(215, 167, 89, 0.18);
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(22, 27, 31, 0.92), rgba(8, 11, 13, 0.9));
}

.flow-card h3 {
  margin: 0 0 8px;
  color: var(--gold-light);
  font-size: 18px;
  font-weight: 500;
}

.flow-card p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

.step-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.step-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.step-index {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(215, 167, 89, 0.32);
  color: var(--gold-light);
  background: rgba(215, 167, 89, 0.07);
}

.flow-form {
  display: grid;
  gap: 10px;
}

.split-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.status-chip {
  border: 1px solid rgba(215, 167, 89, 0.14);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.024);
  color: var(--text-secondary);
  line-height: 1.35;
}

.status-chip strong {
  display: block;
  margin-top: 4px;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 500;
}

.file-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.top-popover {
  position: fixed;
  z-index: 70;
  top: 82px;
  right: 24px;
  width: min(420px, calc(100vw - 28px));
  max-height: calc(100dvh - 112px);
  display: none;
  overflow: auto;
  border: 1px solid rgba(215, 167, 89, 0.28);
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(24, 29, 32, 0.98), rgba(7, 10, 12, 0.98));
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.top-popover.active { display: block; }

.popover-head {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(215, 167, 89, 0.16);
}

.popover-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

.popover-body {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.badge-count {
  position: absolute;
  right: -7px;
  top: -7px;
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  margin-left: 0;
  border-radius: 50%;
  color: #15100b;
  background: var(--gold-light);
  font-size: 11px;
  font-weight: 800;
}

.quick-report-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.timer-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
  padding: 13px;
  border: 1px solid rgba(215, 167, 89, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.024);
}

.timer-card strong {
  display: block;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
  color: var(--gold-light);
}

.reborn-overlay {
  position: fixed;
  z-index: 60;
  right: 14px;
  bottom: 12px;
  width: min(380px, calc(100vw - 20px));
  height: min(88dvh, 680px);
  display: none;
  pointer-events: none;
}

.reborn-overlay.active,
.reborn-overlay.idle {
  display: block;
}

.reborn-overlay > * {
  pointer-events: auto;
}

.overlay-character {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: default;
  pointer-events: none;
  opacity: 0.96;
  background:
    linear-gradient(180deg, rgba(5, 7, 9, 0.08), rgba(5, 7, 9, 0.18) 48%, rgba(5, 7, 9, 0.28)),
    url("../images/reborn-command-portrait.png") center 18px / 92% auto no-repeat,
    linear-gradient(180deg, rgba(12, 14, 15, 0.96), rgba(7, 9, 11, 0.98));
  border: 1px solid rgba(178, 145, 86, 0.38);
  border-radius: 22px;
  outline: none;
  background-color: transparent;
  filter:
    drop-shadow(0 28px 30px rgba(0, 0, 0, 0.56))
    drop-shadow(0 0 18px rgba(213, 168, 92, 0.08));
  transform-origin: bottom right;
  overflow: hidden;
  animation: reborn-breathe 4.5s ease-in-out infinite;
}

.overlay-character::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px) 0 0 / 28px 100%,
    radial-gradient(circle at 70% 78%, rgba(215, 167, 89, 0.12), transparent 30%);
  mix-blend-mode: screen;
  opacity: 0.26;
  pointer-events: none;
}

@keyframes reborn-breathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

.overlay-dialog-wrap {
  position: absolute;
  z-index: 2;
  left: 22px;
  right: 22px;
  bottom: 22px;
  width: auto;
  margin: 0;
  transition: bottom 180ms ease;
}

.reborn-overlay.idle .overlay-dialog-wrap {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

.reborn-overlay.active .overlay-dialog-wrap {
  bottom: 124px;
}

.collapsed-dialog-tab {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 20;
  width: 176px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px 0 24px;
  border: 0;
  border-radius: 0;
  clip-path: polygon(0 100%, 0 7px, 7px 0, calc(100% - 28px) 0, 100% 36%, calc(100% - 6px) 100%);
  background: linear-gradient(180deg, rgba(26, 30, 31, 0.98), rgba(12, 16, 18, 0.97));
  backdrop-filter: blur(7px);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.34);
}

.overlay-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 3;
  min-width: 104px;
  display: none;
  border: 1px solid rgba(215, 167, 89, 0.32);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--gold-light);
  background: rgba(8, 11, 13, 0.9);
  text-align: center;
  font-weight: 700;
}

.reborn-overlay.idle .overlay-badge {
  display: none;
}

.overlay-actions {
  position: absolute;
  z-index: 3;
  left: auto;
  right: 32px;
  bottom: -4px;
  display: none;
  grid-template-columns: minmax(170px, 240px);
  gap: 7px;
  width: min(42%, 260px);
  margin: 0;
}

.reborn-overlay.active .overlay-actions:not(:empty) {
  display: grid;
}

.overlay-actions .command-button {
  min-height: 34px;
  padding: 7px 14px;
  font-size: 13px;
  text-align: center;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.overlay-chat-form {
  position: absolute;
  z-index: 2;
  left: 22px;
  right: 22px;
  top: calc(100% + 14px);
  bottom: auto;
  display: none;
  grid-template-columns: minmax(0, 1fr) 64px;
  gap: 8px;
  width: auto;
  margin: 0;
  padding: 8px;
  border: 1px solid rgba(215, 167, 89, 0.16);
  border-radius: 8px;
  background: rgba(8, 11, 13, 0.9);
  backdrop-filter: blur(8px);
}

.reborn-overlay.active .overlay-chat-form {
  display: grid;
}

.overlay-chat-form input {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 6px;
}

.overlay-chat-form .command-button {
  min-height: 38px;
  border-radius: 6px;
}

.reborn-dialog.overlay-dialog {
  position: relative;
  z-index: 4;
  min-height: 190px;
  max-height: none;
  aspect-ratio: auto;
  border-color: rgba(175, 142, 85, 0.56);
  border-radius: 9px;
  background:
    linear-gradient(180deg, rgba(16, 20, 23, 0.94), rgba(10, 14, 17, 0.95));
  backdrop-filter: blur(7px);
}

.reborn-dialog.overlay-dialog .dialog-texture {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.012), transparent 28%, transparent 74%, rgba(0, 0, 0, 0.14));
  opacity: 0.72;
}

.reborn-dialog.overlay-dialog .dialog-texture::before {
  opacity: 0;
}

.reborn-dialog.overlay-dialog .dialog-content {
  left: 42px;
  right: 36px;
  top: 58px;
  bottom: 34px;
  z-index: 3;
}

.reborn-dialog.overlay-dialog .dialog-text {
  width: 88%;
  max-width: 88%;
  font-size: clamp(18px, 1.62vw, 23px);
  line-height: 1.42;
  color: var(--text-primary);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}

.reborn-dialog.overlay-dialog .dialog-file-tab {
  top: -22px;
  left: 0;
  width: 170px;
  height: 62px;
}

.reborn-dialog.overlay-dialog .dialog-speaker {
  left: 14px;
  top: -8px;
  width: 142px;
}

.reborn-dialog.overlay-dialog .speaker-name {
  font-size: 18px;
  letter-spacing: 0.13em;
}

.reborn-overlay[data-mood="warning"] .overlay-character,
.reborn-overlay[data-mood="annoyed"] .overlay-character {
  filter: drop-shadow(0 0 18px rgba(156, 37, 45, 0.32)) saturate(1.08);
}

.reborn-overlay[data-mood="satisfied"] .overlay-character,
.reborn-overlay[data-mood="soft"] .overlay-character {
  filter: drop-shadow(0 0 16px rgba(215, 167, 89, 0.24)) saturate(1.05);
}

.reborn-overlay[data-mood="tired"] .overlay-character,
.reborn-overlay[data-activity="resting"] .overlay-character {
  opacity: 0.86;
  filter: saturate(0.86) brightness(0.9);
}

.reborn-overlay[data-activity="observing"] .overlay-character {
  animation: reborn-watch-breathe 5.4s ease-in-out infinite;
}

.reborn-overlay[data-activity="talking"] .overlay-character {
  animation: reborn-talk-breathe 2.6s ease-in-out infinite;
}

@keyframes reborn-watch-breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(2px) scale(1.006); }
}

@keyframes reborn-talk-breathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.empty {
  color: var(--text-secondary);
  padding: 14px 0;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  border: 1px solid var(--border-strong);
  background: rgba(8, 11, 14, 0.94);
  color: var(--gold-light);
  padding: 12px 14px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 180ms ease;
  box-shadow: var(--shadow-panel);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.mobile-nav { display: none; }

body[data-page="reborn"] .dashboard {
  padding-right: 22px;
}

body[data-page="reborn"] .reborn-overlay {
  display: none !important;
}

body[data-page="home"] .mission-panel .inline-progress {
  display: none;
}

body[data-page="home"] .panel-header h1,
body[data-page="home"] .panel-header h2,
body[data-page="home"] .today-task-title strong,
body[data-page="home"] .skill-slot strong,
body[data-page="home"] .light-side-card strong,
body[data-page="home"] .status-chip strong,
body[data-page="home"] .meta-chip strong,
body[data-page="home"] .judgement-callout strong {
  font-weight: 400;
}

body[data-page="home"] .today-task-title span,
body[data-page="home"] .skill-slot span,
body[data-page="home"] .light-side-card span {
  font-weight: 500;
}

@media (max-width: 1320px) {
  .topbar { grid-template-columns: 140px 1fr; }
  .top-actions { display: none; }
  .dashboard { padding-right: 22px; }
  .metric-list { grid-template-columns: repeat(4, minmax(76px, 1fr)); }
  .hero-grid, .content-grid { grid-template-columns: 1fr; }
  .widget-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .active-learning-panel .skill-slot {
    grid-template-columns: 106px minmax(150px, 0.7fr) minmax(0, 1fr);
  }
  .unlock-order-panel .widget-list {
    grid-template-columns: 1fr;
  }
  .character-panel { min-height: 420px; }
  .reborn-overlay.active {
    width: min(330px, calc(100vw - 24px));
    height: min(72dvh, 560px);
    min-height: 0;
    right: 12px;
    bottom: 84px;
  }
  .reborn-overlay.active .overlay-dialog-wrap {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 106px;
  }
  .reborn-overlay.active .overlay-dialog {
    min-height: 142px;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "topbar"
      "dashboard";
  }
  .sidebar { display: none; }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }
  .level {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .metric-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .skill-slot-grid,
  .learning-summary {
    grid-template-columns: 1fr;
  }
  .active-learning-panel .skill-slot {
    grid-template-columns: 1fr;
    gap: 7px;
    min-height: 0;
  }
  .active-learning-panel .skill-slot span,
  .active-learning-panel .skill-slot strong,
  .active-learning-panel .skill-slot small:first-of-type,
  .active-learning-panel .skill-slot small:last-of-type {
    grid-column: 1;
    grid-row: auto;
    padding-top: 0;
    max-width: none;
  }
  .active-learning-panel,
  .unlock-order-panel {
    grid-column: span 1;
  }
  .active-learning-panel .status-strip {
    grid-template-columns: 1fr;
  }
  .dashboard { padding: 12px 12px 108px; }
  .widget-grid, .form-grid { grid-template-columns: 1fr; }
  .mission-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .inline-progress { grid-template-columns: 1fr; }
  .mission-actions { grid-template-columns: 1fr; }
  .character-panel { min-height: 360px; }
  .character-command {
    min-height: 0;
    padding: 0;
  }
  .dialog-file-tab {
    top: -18px;
    left: 0;
    width: 160px;
    height: 54px;
  }
  .reborn-dialog,
  .chat-dialog {
    aspect-ratio: auto;
    min-height: 170px;
  }
  .dialog-speaker {
    left: 45px;
  }
  .dialog-content {
    left: 30px;
    right: 28px;
    top: 50px;
    bottom: 38px;
  }
  .dialog-text,
  .character-command .dialog-text {
    max-width: 88%;
    font-size: 18px;
  }
  .reborn-stage-scene {
    min-height: 438px;
  }
  .reborn-stage-scene::before {
    inset: -10px -34px 0 -34px;
    background-position: center top;
    background-size: auto 104%;
  }
  .reborn-stage-scene .chat {
    left: 12px;
    right: 12px;
    bottom: 12px;
    height: 180px;
    padding-top: 28px;
  }
  .reborn-stage-scene .chat-dialog {
    min-height: 138px;
    margin-top: 12px;
  }
  .reborn-stage-scene .dialog-file-tab {
    width: 150px;
    height: 50px;
  }
  .reborn-stage-scene .dialog-speaker {
    left: 0;
    width: 150px;
  }
  .reborn-stage-scene .dialog-content {
    left: 28px;
    right: 24px;
    top: 48px;
    bottom: 30px;
  }
  .reborn-stage-scene .dialog-text {
    width: 100%;
    max-width: 100%;
    font-size: 22px;
    line-height: 1.45;
  }
  .reply-composer {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  #chatForm {
    grid-template-columns: 1fr;
  }
  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 25;
    border: 1px solid var(--border-subtle);
    background: rgba(8, 11, 14, 0.94);
    padding: 6px;
    box-shadow: var(--shadow-panel);
  }
  .mobile-nav button {
    border: 0;
    min-height: 44px;
    background: transparent;
    color: var(--text-secondary);
  }
  .mobile-nav button.active {
    color: var(--gold-light);
    background: rgba(213, 151, 63, 0.16);
  }
  body[data-page="reborn"] .dashboard {
    padding-bottom: 24px;
  }
  body[data-page="reborn"] .mobile-nav {
    display: none;
  }
  .reborn-overlay,
  .reborn-overlay.active {
    left: auto;
    right: 12px;
    top: 148px;
    bottom: auto;
    width: 150px;
    height: 48px;
    max-height: none;
  }
  .reborn-overlay.idle {
    display: none;
  }
  .reborn-overlay.active .overlay-character,
  .reborn-overlay.active .overlay-dialog-wrap,
  .reborn-overlay.active .overlay-actions,
  .reborn-overlay.active .overlay-chat-form {
    display: none;
  }
  .reborn-overlay.active .overlay-badge {
    position: static;
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 48px;
    border-color: rgba(215, 167, 89, 0.42);
    background: rgba(8, 11, 14, 0.96);
    box-shadow: var(--shadow-panel);
  }
}
