:root {
  --app-top-gap: clamp(18px, 3vh, 34px);
  --theme-toggle-right: 16px;
  --theme-toggle-width: 122px;
  --bg: #020617;
  --panel: rgba(15, 23, 42, 0.8);
  --ink: #e5ecff;
  --muted: #9fb2da;
  --social-action-gap: 18px;
  --primary: #ef4444;
  --secondary: #06b6d4;
  --warn: #eab308;
  --line: rgba(148, 163, 184, 0.2);
  --map-island-border: rgba(229, 236, 255, 0.72);
  --map-island-bg: rgba(2, 6, 23, 0.86);
  --map-island-inset: rgba(2, 6, 23, 0.6);
  --map-island-glow: rgba(229, 236, 255, 0.38);
  --map-bubble-border: rgba(229, 236, 255, 0.45);
  --map-bubble-bg: rgba(2, 6, 23, 0.9);
  --map-player-shadow: rgba(2, 6, 23, 0.66);
  --map-player-glow: rgba(229, 236, 255, 0.35);
  --glow-cyan: 0 0 18px rgba(6, 182, 212, 0.45);
  --glow-red: 0 0 16px rgba(239, 68, 68, 0.4);
  --glow-yellow: 0 0 14px rgba(234, 179, 8, 0.4);
}

body[data-theme="light"] {
  --bg: #eaf2ff;
  --panel: rgba(255, 255, 255, 0.86);
  --ink: #0b1d35;
  --muted: #4c6486;
  --primary: #dc2626;
  --secondary: #0891b2;
  --warn: #b45309;
  --line: rgba(59, 89, 152, 0.18);
  --map-island-border: rgba(11, 29, 53, 0.64);
  --map-island-bg: rgba(255, 255, 255, 0.96);
  --map-island-inset: rgba(11, 29, 53, 0.1);
  --map-island-glow: rgba(11, 29, 53, 0.28);
  --map-bubble-border: rgba(11, 29, 53, 0.36);
  --map-bubble-bg: rgba(255, 255, 255, 0.98);
  --map-player-shadow: rgba(11, 29, 53, 0.35);
  --map-player-glow: rgba(11, 29, 53, 0.28);
  --glow-cyan: 0 0 16px rgba(8, 145, 178, 0.22);
  --glow-red: 0 0 12px rgba(220, 38, 38, 0.22);
  --glow-yellow: 0 0 12px rgba(180, 83, 9, 0.22);
}

* {
  box-sizing: border-box;
}

body,
#app,
.card,
.panel,
.post,
.comment-item,
.wall,
pre,
input,
textarea,
select,
button,
.topic-card-body,
.social-header,
.feed-card,
.social-rail-card,
.social-rail-card p,
.side-column .post,
.feed-column .post,
.system-id-box,
.brand-icon {
  transition:
    background-color 280ms ease,
    color 280ms ease,
    border-color 280ms ease,
    box-shadow 320ms ease,
    text-shadow 280ms ease;
}

body.theme-switching .card,
body.theme-switching .panel,
body.theme-switching .post,
body.theme-switching .comment-item,
body.theme-switching .wall,
body.theme-switching pre {
  transition-delay: 40ms;
}

@media (prefers-reduced-motion: reduce) {
  body,
  #app,
  .card,
  .panel,
  .post,
  .comment-item,
  .wall,
  pre,
  input,
  textarea,
  select,
  button,
  .topic-card-body,
  .social-header,
  .feed-card,
  .social-rail-card,
  .social-rail-card p,
  .side-column .post,
  .feed-column .post,
  .system-id-box,
  .brand-icon {
    transition: none;
  }
}

body {
  margin: 0;
  font-family: "Noto Sans TC", "PingFang TC", sans-serif;
  font-size: 18px;
  background:
    radial-gradient(circle at top left, rgba(14, 116, 144, 0.24) 0%, transparent 42%),
    radial-gradient(circle at bottom right, rgba(99, 102, 241, 0.2) 0%, transparent 38%),
    var(--bg);
  color: var(--ink);
}

body[data-theme="light"] {
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.18) 0%, transparent 40%),
    radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.14) 0%, transparent 35%),
    var(--bg);
}

body[data-page="phase1"] {
  background: var(--bg);
}

body[data-page="progress"] {
  background: var(--bg);
}

body[data-page="phase2"] {
  background: var(--bg);
}

#app {
  max-width: 1360px;
  margin: var(--app-top-gap) auto 0;
  padding: 20px clamp(18px, 3.2vw, 36px);
  padding-top: calc(34px + env(safe-area-inset-top));
}

h1,
h2,
h3 {
  margin: 0 0 12px;
}

.card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.5);
}

body[data-theme="light"] .card,
body[data-theme="light"] .panel {
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.09);
}

.pick-card {
  text-align: left;
  color: var(--ink);
  background: #111a2a;
  position: relative;
  overflow: visible;
}

body[data-theme="light"] .pick-card {
  background: rgba(240, 248, 255, 0.95);
}

.pick-card h4 {
  margin: 0 0 6px;
}

.pick-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.pick-card.selected {
  border-color: var(--secondary);
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.5);
}

.pick-card::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 20px;
  pointer-events: none;
  opacity: 0;
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.18),
    0 0 18px rgba(34, 211, 238, 0.22),
    0 0 32px rgba(34, 211, 238, 0.12);
  transition: opacity 320ms ease;
}

.pick-card.selected::after {
  opacity: 1;
  animation: pickCardGlowPulse 1.8s ease-in-out infinite;
}

.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.phase1-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.phase1-card-list .pick-card {
  width: 100%;
}

.phase1-vertical {
  display: block;
}

.topic-sticky {
  position: sticky;
  top: 10px;
  z-index: 30;
}

.topic-info-header {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topic-card-body {
  margin-top: 8px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.5);
  line-height: 1.75;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

body[data-theme="light"] .topic-card-body {
  background: rgba(241, 245, 255, 0.9);
}

.topic-card-clue {
  margin-top: 18px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(34, 211, 238, 0.26);
  background: rgba(3, 14, 26, 0.5);
}

.topic-card-clue-title {
  font-size: 20px;
  font-weight: 700;
  color: #67e8f9;
  margin-bottom: 8px;
  line-height: 1.4;
}

.topic-card-clue p {
  margin: 6px 0;
  line-height: 1.7;
  font-size: 17px;
  color: var(--ink);
}

.topic-card-clue-label {
  color: #67e8f9;
  font-weight: 700;
  margin-right: 4px;
}

.topic-card-clue-text {
  color: var(--ink);
}

body[data-theme="light"] .topic-card-clue {
  background: rgba(236, 249, 255, 0.95);
  border-color: rgba(8, 145, 178, 0.28);
}

body[data-theme="light"] .topic-card-clue-title {
  color: #0f5c73;
}

body[data-theme="light"] .topic-card-clue-label {
  color: #0f5c73;
}

.thinking-box {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(6, 182, 212, 0.4);
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.55);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #67e8f9;
  font-family: "Noto Sans TC", "PingFang TC", sans-serif;
  letter-spacing: 0.05em;
}

body[data-theme="light"] .thinking-box {
  background: rgba(230, 245, 252, 0.92);
  color: #0f5c73;
}

.thinking-spinner {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(103, 232, 249, 0.28);
  border-top-color: #67e8f9;
  box-shadow: var(--glow-cyan);
  animation: enteringSpin 0.8s linear infinite;
  flex: 0 0 auto;
}

.phase1-split {
  width: 100%;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 10px;
  align-items: start;
}

.phase1-left,
.phase1-right {
  min-width: 0;
}

.phase1-right .card {
  margin-bottom: 10px;
}

.phase1-topic-loading {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.phase1-topic-loading .thinking-box {
  width: min(560px, 100%);
  justify-content: center;
}

@media (max-width: 980px) {
  .phase1-split {
    grid-template-columns: 1fr;
  }
}

body[data-page="phase2"] .phase2-loading-panel {
  background: transparent;
  border: none;
  box-shadow: none;
}

body[data-page="phase1"] .panel,
body[data-page="phase1"] .card {
  padding: 12px;
  margin-bottom: 10px;
}

body[data-page="phase1"] .badge {
  font-size: 12px;
  padding: 3px 8px;
}

body[data-page="phase1"] .topic-title {
  font-size: 28px;
  margin-top: 2px;
}

body[data-page="phase1"] .topic-card-body {
  max-height: none;
  overflow: visible;
  font-size: 20px;
  line-height: 1.7;
  padding: 10px;
}

body[data-page="phase1"] .phase1-card-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 14px 14px 18px;
  scroll-padding-inline: 14px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

body[data-page="phase1"] .phase1-card-list::-webkit-scrollbar {
  height: 8px;
}

body[data-page="phase1"] .phase1-card-list::-webkit-scrollbar-thumb {
  background: rgba(125, 211, 252, 0.34);
  border-radius: 999px;
}

body[data-page="phase1"] .pick-card {
  flex: 0 0 188px;
  width: 188px;
  scroll-snap-align: center;
  padding: 10px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  text-align: center;
  gap: 8px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  overflow: visible;
  transform: scale(0.94);
  transform-origin: center;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease, filter 220ms ease;
}

body[data-page="phase1"] .phase1-card-list:hover .pick-card:not(:hover):not(.selected) {
  transform: scale(0.92);
}

body[data-page="phase1"] .pick-card.selected {
  transform: scale(1.02);
  border-color: transparent;
}

body[data-page="phase1"] .pick-card:hover,
body[data-page="phase1"] .pick-card:focus-visible {
  transform: scale(1.08);
  z-index: 3;
}

body[data-page="phase1"] .pick-card.selected:hover,
body[data-page="phase1"] .pick-card.selected:focus-visible {
  transform: scale(1.1);
}

body[data-page="phase1"] .pick-card::after {
  border-radius: 34px;
}

body[data-page="phase1"] .pick-card.selected .pick-card-media {
  border-color: rgba(34, 211, 238, 0.72);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.24);
}

body[data-page="phase1"] .pick-card-media {
  width: min(100%, 150px);
  margin: 0 auto;
  aspect-ratio: 4 / 5;
  border-radius: 30px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.35);
}

body[data-page="phase1"] .pick-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

body[data-theme="light"][data-page="phase1"] .pick-card-image {
  background: transparent;
}

body[data-theme="light"][data-page="phase1"] .pick-card-media {
  background: rgba(255, 255, 255, 0.92);
}

body[data-theme="light"] .pick-card.selected {
  box-shadow: none;
}

body[data-theme="light"] .pick-card::after {
  box-shadow:
    0 0 0 1px rgba(8, 145, 178, 0.26),
    0 0 14px rgba(8, 145, 178, 0.2),
    0 0 26px rgba(8, 145, 178, 0.12);
}

@keyframes pickCardGlowPulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.08);
  }
}

body[data-page="phase1"] .pick-card h4 {
  font-size: 16px;
  margin: 0;
  text-align: center;
  width: 100%;
}

body[data-page="phase1"] .pick-card p {
  display: none;
}

body[data-page="phase1"] .phase1-right .card {
  margin-bottom: 8px;
}

body[data-page="phase1"] .phase1-right .composer-card {
  margin-top: -4px;
}

body[data-page="phase1"] textarea {
  min-height: 160px;
}

body[data-page="phase1"] #producerDraft {
  min-height: 160px;
  resize: none;
}

body[data-page="phase1"] .social-sidebar {
  max-height: none;
  overflow: visible;
}

body[data-page="phase1"] .topic-card-body {
  flex: 1;
  min-height: clamp(220px, 33vh, 460px);
}

body[data-page="phase1"] .topic-sticky {
  position: static;
}

body[data-page="phase1"] .topic-info-header,
body[data-page="phase1"] .topic-card-body {
  font-size: 20px;
}

body[data-page="phase1"] pre:not(.llm-response) {
  max-height: 23vh;
  overflow: auto;
  font-size: 16px;
  line-height: 1.5;
  padding: 8px;
}

.llm-response,
.boss-comment,
.hint-content {
  white-space: pre-wrap;
  overflow: visible;
  max-height: none;
  text-overflow: clip;
}

.selected-card-info {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.45);
}

body[data-theme="light"] .selected-card-info {
  background: rgba(241, 245, 255, 0.9);
}

.selected-card-info h4 {
  margin: 0 0 6px;
  font-size: 18px;
}

.selected-card-info p {
  margin: 0;
  line-height: 1.55;
}

.entering-screen {
  width: 100%;
  min-height: 65vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.entering-ring {
  width: 132px;
  height: 132px;
  border-radius: 999px;
  border: 3px solid var(--line);
  border-top-color: var(--ink);
  box-shadow: none;
  animation: enteringSpin 1.1s linear infinite;
}

.entering-title {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-shadow: none;
}

.entering-sub {
  color: var(--muted);
  font-size: 16px;
}

@keyframes enteringSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.thinking-dots {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.thinking-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: none;
  animation: thinkingPulse 1s infinite ease-in-out;
}

.thinking-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.thinking-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes thinkingPulse {
  0%, 80%, 100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

input,
textarea,
select,
button {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: rgba(2, 6, 23, 0.7);
  margin-top: 6px;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 9px;
}

body[data-theme="light"] input,
body[data-theme="light"] textarea,
body[data-theme="light"] select,
body[data-theme="light"] button {
  background: rgba(255, 255, 255, 0.9);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #06b6d4;
  box-shadow: var(--glow-cyan);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

#checkerDraft {
  min-height: 160px;
  max-height: 180px;
  overflow-y: auto;
  resize: none;
}

.checker-rationale-textarea {
  min-height: 160px;
  max-height: 180px;
  overflow-y: auto;
  resize: none;
}

button {
  background: #06b6d4;
  color: #032833;
  border-color: #22d3ee;
  cursor: pointer;
  box-shadow: var(--glow-cyan);
  font-weight: 800;
}

button.secondary {
  background: var(--secondary);
}

button.warn {
  background: var(--primary);
  border-color: #f87171;
  color: #2a0a0a;
  box-shadow: var(--glow-red);
}

button.ghost {
  background: #1fb7a6;
  color: #062a2f;
  border-color: #2ed7c4;
}

small,
.muted {
  color: var(--muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.social-shell {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

.social-header {
  position: sticky;
  top: 8px;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 16px;
  background: rgba(10, 18, 34, 0.9);
}

body[data-theme="light"] .social-header {
  background: rgba(255, 255, 255, 0.93);
}

.social-header h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.05em;
}

.progress-topbar-slot {
  display: inline-flex;
  align-items: center;
}

.progress-topbar-center {
  justify-content: center;
  min-width: 0;
  text-align: center;
}

.progress-topbar-title-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.progress-topbar-title-group h2 {
  margin: 0;
}

.progress-topbar-title-group .muted {
  margin: 0;
  white-space: nowrap;
}

.progress-topbar-left {
  justify-content: flex-start;
  width: 48px;
}

.progress-topbar-right {
  justify-content: flex-end;
  width: 48px;
}

body[data-page="phase1"] .phase1-topbar h2 {
  text-align: center;
  font-size: 28px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  margin: 0;
}

body[data-page="phase1"] .phase1-topbar-center {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

body[data-page="phase2"] .phase2-topbar h2 {
  text-align: center;
  font-size: 28px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  margin: 0;
}

body[data-page="phase2"] .phase2-topbar-center {
  justify-content: center;
  min-width: 0;
  text-align: center;
}

body[data-page="phase1"] .phase1-topbar-right {
  padding-right: 0;
}

body[data-page="phase2"] .phase2-loading-panel {
  width: min(100%, 1476px);
  margin: 0 auto;
  text-align: center;
}

body[data-page="phase2"] .phase2-loading-panel .muted {
  text-align: center;
}

body[data-page="phase1"] .phase1-topbar .back-arrow {
  background: transparent;
  background-color: transparent;
}

body[data-page="phase2"] .phase2-topbar .back-arrow {
  background: transparent;
  background-color: transparent;
}

body[data-page="progress"] .progress-topbar .back-arrow {
  background: transparent;
  background-color: transparent;
}

.producer-hint-trigger {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 999px;
  border: 1px solid rgba(124, 211, 255, 0.42);
  background: rgba(10, 30, 52, 0.72);
  color: #c7eeff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.producer-hint-trigger:hover {
  transform: translateY(-1px);
  border-color: rgba(167, 243, 255, 0.75);
  background: rgba(14, 49, 78, 0.86);
}

.producer-hint-trigger:focus-visible {
  outline: 2px solid rgba(103, 232, 249, 0.8);
  outline-offset: 2px;
}

.producer-hint-overlay {
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(2, 6, 23, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  will-change: opacity;
}

.producer-hint-overlay.opening {
  opacity: 0;
  animation: producerHintOverlayIn 180ms ease forwards;
}

.producer-hint-overlay.shown {
  opacity: 1;
}

.producer-hint-overlay.closing {
  opacity: 1;
  animation: producerHintOverlayOut 180ms ease forwards;
}

.producer-hint-panel {
  width: min(640px, calc(100vw - 28px));
  border-radius: 24px;
  border: 1px solid rgba(120, 198, 255, 0.38);
  background: linear-gradient(160deg, rgba(8, 26, 45, 0.96), rgba(12, 31, 58, 0.96));
  box-shadow: 0 22px 46px rgba(2, 10, 26, 0.45);
  padding: 24px 28px 24px;
  will-change: transform, opacity;
  transform: translateZ(0);
}

.producer-hint-panel.opening {
  opacity: 0;
  transform: translateY(10px) scale(0.97);
  animation: producerHintPanelIn 280ms cubic-bezier(0.22, 0.85, 0.3, 1) forwards;
}

.producer-hint-panel.shown {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.producer-hint-panel.closing {
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: producerHintPanelOut 220ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.producer-hint-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.producer-hint-panel-head h3 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0.02em;
  color: #c8f4ff;
}

.producer-hint-close {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(164, 229, 255, 0.5);
  background: rgba(10, 37, 64, 0.82);
  color: #d4f6ff;
  font-size: 24px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  cursor: pointer;
}

.producer-hint-close > span {
  display: block;
  transform: translateY(-1px);
}

.producer-hint-panel-body {
  margin-top: 18px;
}

.producer-hint-panel-body ol {
  margin: 0;
  padding-left: 28px;
  color: #d9f3ff;
  line-height: 2;
  font-size: 20px;
}

body[data-theme="light"] .producer-hint-overlay {
  background: rgba(15, 23, 42, 0.3);
}

body[data-theme="light"] .producer-hint-panel {
  border-color: rgba(14, 116, 144, 0.26);
  background: linear-gradient(160deg, rgba(248, 253, 255, 0.98), rgba(240, 249, 255, 0.98));
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
}

body[data-theme="light"] .producer-hint-panel-head h3 {
  color: #0f4f6a;
}

body[data-theme="light"] .producer-hint-close {
  border-color: rgba(14, 116, 144, 0.35);
  background: rgba(227, 247, 255, 0.95);
  color: #0f4f6a;
}

body[data-theme="light"] .producer-hint-panel-body ol {
  color: #0f3f52;
}

body[data-theme="light"] .producer-hint-trigger {
  border-color: rgba(14, 116, 144, 0.35);
  background: rgba(220, 242, 255, 0.95);
  color: #0f4f6a;
}

body[data-theme="light"] .producer-hint-trigger:hover {
  border-color: rgba(14, 116, 144, 0.55);
  background: rgba(205, 236, 255, 0.98);
}

@media (max-width: 640px) {
  .producer-hint-panel {
    width: calc(100vw - 20px);
    padding: 20px 20px 20px;
  }

  .producer-hint-panel-head h3 {
    font-size: 22px;
  }

  .producer-hint-panel-body ol {
    font-size: 18px;
    line-height: 1.9;
  }
}

@keyframes producerHintOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes producerHintOverlayOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes producerHintPanelIn {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(0.9);
  }
  62% {
    opacity: 1;
    transform: translateY(-7px) scale(1.03);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes producerHintPanelOut {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(12px) scale(0.94);
  }
}

.social-two-col {
  grid-template-columns: 0.82fr 1.48fr;
  gap: 12px;
}

.left-collapsible-layout {
  display: grid;
  align-items: stretch;
  gap: 0;
}

body[data-page="phase1"] .phase1-split.left-collapsible-layout {
  grid-template-columns: minmax(360px, 44%) 20px minmax(0, 1fr);
  align-items: stretch;
}

body[data-page="phase1"] .phase1-left.left-panel {
  display: flex;
  min-height: 100%;
}

body[data-page="phase1"] .phase1-left.left-panel .left-panel-content {
  width: 100%;
  display: flex;
}

body[data-page="phase1"] .phase1-left .social-sidebar {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

body[data-page="phase1"] .phase1-right.right-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

@media (max-width: 1180px) {
  body[data-page="phase1"] .pick-card {
    flex-basis: 176px;
    width: 176px;
  }
}

@media (max-width: 760px) {
  body[data-page="phase1"] .pick-card {
    flex-basis: min(72vw, 220px);
    width: min(72vw, 220px);
  }
}

body[data-page="phase2"] .phase2-social.left-collapsible-layout {
  grid-template-columns: minmax(320px, 1.38fr) 20px minmax(0, 1fr);
}

.left-collapsible-layout .left-panel {
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.left-collapsible-layout .right-panel {
  min-width: 0;
  width: 100%;
}

.left-collapsible-layout .left-panel .left-panel-content {
  width: 100%;
  height: 100%;
  display: block;
}

.left-collapsible-layout .collapse-rail {
  width: 20px;
  min-width: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: relative;
  overflow: visible;
  z-index: 45;
}

body[data-page="phase1"] .phase1-split.left-collapsible-layout.left-collapsed,
body[data-page="phase2"] .phase2-social.left-collapsible-layout.left-collapsed {
  grid-template-columns: 0 20px minmax(0, 1fr);
}

.left-collapsible-layout.left-collapsed .left-panel .left-panel-content {
  display: none;
}

/* 收合左欄後，右欄吃進控制細欄寬度，但收合鍵仍固定在原控制欄。 */
.left-collapsible-layout.left-collapsed .right-panel {
  grid-column: 3 / 4;
  margin-left: -20px;
  width: calc(100% + 20px);
}

.collapse-toggle {
  position: sticky;
  top: 50vh;
  transform: translateY(-50%);
  z-index: 40;
  width: 28px;
  height: 48px;
  padding: 0;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.92);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.25);
}

.collapse-toggle:hover {
  border-color: var(--secondary);
  color: #67e8f9;
}

body[data-theme="light"] .collapse-toggle {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 14px rgba(37, 99, 235, 0.12);
}

.social-sidebar {
  margin-bottom: 0;
  max-height: calc(100vh - 110px);
  overflow: auto;
}

.social-left-rail {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.social-rail-card {
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.95), rgba(17, 48, 66, 0.72));
  border: 1px solid rgba(34, 211, 238, 0.22);
}

body[data-theme="light"] .social-rail-card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(237, 248, 255, 0.9));
  border-color: rgba(8, 145, 178, 0.25);
}

.social-rail-card h3 {
  font-size: 20px;
  margin-bottom: 10px;
}

.social-rail-card p {
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.45);
}

body[data-theme="light"] .social-rail-card p {
  background: rgba(223, 239, 255, 0.76);
}

.feed-card {
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.88);
}

body[data-theme="light"] .feed-card {
  background: rgba(255, 255, 255, 0.9);
}

.composer-card textarea {
  min-height: 160px;
}

.phase2-social:not(.left-collapsible-layout) {
  grid-template-columns: 1.38fr 1fr;
  align-items: start;
}

.feed-column,
.side-column {
  border-radius: 16px;
  margin-bottom: 0;
}

.feed-column {
  max-height: calc(100vh - 118px);
  overflow: auto;
}

.side-column {
  position: sticky;
  top: 84px;
}

.hint-assistant-bubble {
  margin: 10px 0 8px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(6, 182, 212, 0.45);
  background: rgba(8, 26, 45, 0.92);
  box-shadow: 0 10px 22px rgba(2, 6, 23, 0.35);
  animation: hintBubbleIn 280ms ease;
}

.hint-assistant-bubble.hint-level3 {
  border-color: rgba(56, 189, 248, 0.5);
}

.hint-assistant-bubble.hint-level5 {
  border-color: rgba(250, 204, 21, 0.55);
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.26), 0 12px 24px rgba(2, 6, 23, 0.42);
}

.hint-assistant-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  margin-bottom: 6px;
}

.hint-assistant-icon {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(56, 189, 248, 0.2);
}

.hint-assistant-body {
  line-height: 1.55;
  color: var(--ink);
}

.hint-assistant-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

@keyframes hintBubbleIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

body[data-theme="light"] .hint-assistant-bubble {
  background: rgba(247, 252, 255, 0.96);
  border-color: rgba(14, 116, 144, 0.36);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.12);
}

body[data-theme="light"] .hint-assistant-bubble.hint-level5 {
  border-color: rgba(202, 138, 4, 0.45);
  box-shadow: 0 0 0 1px rgba(202, 138, 4, 0.18), 0 8px 18px rgba(37, 99, 235, 0.14);
}

@media (max-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid var(--line);
  margin-right: 6px;
  font-family: "Noto Sans TC", "PingFang TC", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #67e8f9;
  background: rgba(6, 182, 212, 0.14);
}

body[data-theme="light"] .badge {
  color: #0b1d35;
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 89, 152, 0.28);
}

.wall {
  max-height: 380px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #0e1626;
}

body[data-theme="light"] .wall {
  background: #f3f8ff;
}

.post {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 30px;
  margin-bottom: 30px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.feed-column .post {
  padding: 16px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: rgba(10, 18, 34, 0.72);
  box-shadow: 0 12px 22px rgba(2, 6, 23, 0.35);
}

body[data-theme="light"] .feed-column .post {
  background: rgba(248, 252, 255, 0.95);
  box-shadow: 0 10px 20px rgba(30, 64, 175, 0.09);
}

.side-column .post {
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: rgba(10, 18, 34, 0.68);
}

body[data-theme="light"] .side-column .post {
  background: rgba(244, 250, 255, 0.95);
}

.post h4 {
  margin: 0 0 6px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.5;
}

body[data-page="phase2"] .post h4 {
  font-weight: 400;
}

.social-post-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.avatar-dot {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 25%, #67e8f9, #0e7490);
  box-shadow: var(--glow-cyan);
  flex: 0 0 auto;
}

.avatar-img {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  object-fit: cover;
  flex: 0 0 auto;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: radial-gradient(circle at 30% 25%, #67e8f9, #0e7490);
}

.social-name {
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
}

.social-actions {
  margin: 8px 0 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  align-items: center;
  gap: var(--social-action-gap);
  font-size: 15px;
}

.social-action-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}

.social-action-meta .action-icon,
.social-action-btn .action-icon {
  width: 22px;
  height: 22px;
  stroke-width: 2;
  flex: 0 0 auto;
}

.social-action-btn {
  width: auto;
  margin: 0;
  padding: 4px;
  border: none;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
  cursor: pointer;
}

.like-action .heart-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 180ms ease;
}

.like-action .heart-icon .action-icon {
  transition: transform 180ms ease, color 180ms ease, fill 180ms ease;
}

.like-action.liked {
  color: #ef4444;
}

.like-action.liked .heart-icon {
  transform: scale(1.12);
}

.like-action.like-pop .heart-icon,
.comment-like-action.like-pop .heart-icon {
  transform: scale(1.16);
}

.social-action-btn:hover {
  color: var(--secondary);
  text-decoration: none;
}

.inline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.inline button {
  width: auto;
  padding: 8px 10px;
}

.stars {
  font-size: 20px;
  color: var(--warn);
  text-shadow: var(--glow-yellow);
}

pre {
  white-space: pre-wrap;
  background: #0e1626;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

body[data-theme="light"] pre {
  background: #f5f9ff;
}

.report-analysis {
  font-family: "Noto Sans TC", "PingFang TC", sans-serif;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--ink);
}

body[data-page="end"] #app {
  max-width: 1500px;
  padding: 12px;
  padding-top: calc(12px + env(safe-area-inset-top));
  margin-top: 0;
}

body[data-page="end"] .panel {
  padding: 12px;
  margin-bottom: 10px;
}

.end-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 10px;
  align-items: start;
}

.end-card {
  margin-bottom: 8px;
  padding: 12px;
}

.end-card p {
  margin: 6px 0;
}

.end-heading {
  font-size: 26px;
  margin: 8px 0;
}

.end-copy {
  font-family: "Noto Sans TC", "PingFang TC", sans-serif;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--ink);
}

.learning-radar-panel {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(26, 38, 62, 0.82), rgba(10, 18, 33, 0.88));
}

body[data-theme="light"] .learning-radar-panel {
  background: linear-gradient(180deg, rgba(245, 251, 255, 0.96), rgba(233, 244, 255, 0.96));
}

.learning-radar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.learning-radar-head h4 {
  margin: 0;
  font-size: 22px;
}

.learning-radar-legend {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend-current {
  background: #1fb7a6;
  box-shadow: 0 0 12px rgba(31, 183, 166, 0.7);
}

.legend-history {
  background: #78b4ff;
  box-shadow: 0 0 10px rgba(120, 180, 255, 0.65);
}

.learning-radar-controls {
  margin-top: 10px;
}

#levelSummaryRadar {
  width: 100%;
  max-width: 640px;
  height: auto;
  margin-top: 10px;
}

.learning-radar-notes {
  margin-top: 8px;
}

.learning-radar-notes p {
  margin: 7px 0;
  line-height: 1.55;
}

.end-advice {
  max-height: 140px;
  overflow: auto;
  font-family: "Noto Sans TC", "PingFang TC", sans-serif;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--ink);
}

@media (max-width: 980px) {
  .end-grid {
    grid-template-columns: 1fr;
  }

  .learning-radar-head h4 {
    font-size: 20px;
  }

  .learning-radar-legend {
    font-size: 13px;
  }
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 10px;
}

.comment-item {
  padding: 15px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.comment-text {
  line-height: 1.55;
}

.comment-meta {
  margin-top: 6px;
  font-size: 12px;
}

.comment-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 22px;
  width: auto;
  margin-top: 8px;
  color: var(--muted);
}

.comment-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-start;
  flex: 0 0 auto;
  width: auto;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 2px 4px;
  margin: 0;
  color: inherit;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
}

.comment-like-action .like-count {
  font-size: 15px;
  font-weight: 600;
}

.comment-like-action {
  background: transparent;
  background-color: transparent;
  box-shadow: none;
  border: none;
  cursor: pointer;
}

body[data-theme="light"] .comment-actions .comment-like-action {
  background: transparent;
  background-color: transparent;
  box-shadow: none;
  border: none;
}

.comment-reply-icon,
.comment-share-icon {
  cursor: default;
  pointer-events: none;
}

.comment-share-icon .share-count {
  font-size: 15px;
  font-weight: 600;
  margin-left: 2px;
}

.comment-action .action-icon,
.comment-action .heart-icon .action-icon {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.comment-like-action .heart-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 180ms ease, color 180ms ease, fill 180ms ease;
}

.comment-like-action.liked {
  color: #ef4444;
}

.comment-like-action.liked .heart-icon {
  transform: scale(1.12);
}

body[data-theme="light"] .comment-item {
  background: transparent;
}

.feed-column .comment-list {
  gap: 15px;
}

.feed-column .comment-item {
  padding: 15px;
  line-height: 1.55;
}

.comment-list .comment-item + .comment-item {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 14px;
}

.topic-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 6px;
}

.login-screen {
  width: 100%;
  min-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.brand-icon-wrap {
  transform: rotate(-8deg);
}

.brand-icon {
  width: 104px;
  height: 104px;
  border-radius: 24px;
  border: 1px solid rgba(6, 182, 212, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  color: #67e8f9;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--glow-cyan);
}

.brand-title {
  margin: 0;
  font-size: clamp(52px, 10vw, 84px);
  font-weight: 900;
  font-style: italic;
  line-height: 1;
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, #67e8f9 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 24px rgba(103, 232, 249, 0.28);
}

.login-card {
  width: 100%;
  max-width: 560px;
  padding: 22px;
}

.setup-footer-note {
  margin: 18px 0 0;
  text-align: center;
  font-size: 10px;
  line-height: 1.45;
  color: var(--muted);
  max-width: 760px;
  padding: 0 12px;
}

.system-id-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(6, 182, 212, 0.4);
  background: rgba(2, 6, 23, 0.62);
}

body[data-theme="light"] .system-id-box {
  background: rgba(240, 250, 255, 0.9);
}

.theme-toggle {
  position: fixed;
  right: var(--theme-toggle-right);
  top: calc(14px + env(safe-area-inset-top));
  width: var(--theme-toggle-width);
  min-width: var(--theme-toggle-width);
  padding: 10px 14px;
  border-radius: 999px;
  z-index: 9999;
  border: 1px solid #22d3ee;
  background: rgba(8, 145, 178, 0.9);
  color: #ecfeff;
  font-weight: 800;
  box-shadow: var(--glow-cyan);
}

body[data-theme="light"] .theme-toggle {
  border-color: rgba(8, 145, 178, 0.4);
  background: rgba(255, 255, 255, 0.94);
  color: #0f4f63;
}

.system-id-label {
  font-family: "Noto Sans TC", "PingFang TC", sans-serif;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: #7dd3fc;
  text-transform: uppercase;
}

.system-id-value {
  margin-top: 6px;
  font-family: "Noto Sans TC", "PingFang TC", sans-serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #67e8f9;
  text-shadow: var(--glow-cyan);
}

.enter-btn {
  margin-top: 16px;
  width: 100%;
  min-height: 52px;
  font-size: 22px;
  font-weight: 900;
}

.back-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  padding: 4px 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  font-weight: 600;
  box-shadow: none;
  min-height: 32px;
}

body[data-theme="light"] .back-arrow {
  background: transparent;
  background-color: transparent;
  border: none;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}

.back-arrow:hover {
  background: transparent;
}

body[data-theme="light"] .back-arrow:hover {
  background: transparent;
}

.back-arrow:focus-visible,
body[data-theme="light"] .back-arrow:focus-visible {
  background: transparent;
  box-shadow: none;
}

.back-button {
  gap: 0;
}

.back-button .arrow-icon {
  font-size: 22px;
  line-height: 1;
}

.back-button .back-label {
  display: none;
}

.level-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.level-select-card {
  padding: 14px;
}

.level-summary-card {
  padding: 14px;
}

.level-summary-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.level-summary-left,
.level-summary-right {
  min-width: 0;
}

.level-summary-left h3,
.level-summary-left h4 {
  margin: 0 0 8px;
}

.level-summary-left p {
  margin: 6px 0;
}

.level-summary-right .learning-radar-panel {
  margin-top: 0;
}

.level-summary-footer {
  margin-top: 14px;
  justify-content: flex-end;
}

.level-select-layout {
  display: grid;
  grid-template-columns: 122px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.level-select-avatar-trigger {
  width: 104px;
  height: 104px;
  align-self: start;
}

.level-select-content {
  min-width: 0;
}

.level-select-heading {
  margin-bottom: 10px;
}

.level-select-heading h2 {
  margin: 0;
}

.level-select-heading .muted {
  margin: 4px 0 0;
}

.level-button {
  width: 100%;
  font-size: 1.125rem;
  font-weight: 600;
}

.level-button.completed {
  background: var(--ink) !important;
  color: var(--bg) !important;
  border-color: var(--ink) !important;
}

.level-journey-card {
  margin-top: clamp(36px, 16vh, 180px);
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.level-journey-map {
  position: relative;
  height: 166px;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.journey-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.journey-segment {
  fill: none;
  stroke: var(--line);
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.9;
  transition: stroke 420ms ease, opacity 420ms ease;
}

.journey-segment.is-reached {
  stroke: var(--ink);
  opacity: 1;
}

.journey-node {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%) scale(var(--s));
  transform-origin: center;
}

.journey-node-core {
  display: block;
  width: 52px;
  height: 36px;
  border-radius: 999px;
  border: 2px solid var(--map-island-border);
  background: var(--map-island-bg);
  box-shadow: inset 0 0 0 1px var(--map-island-inset);
  transition: box-shadow 360ms ease, background-color 360ms ease, border-color 360ms ease;
}

.journey-node.journey-node-start .journey-node-core,
.journey-node.journey-node-goal .journey-node-core {
  width: 36px;
  height: 36px;
  border-radius: 999px;
}

.journey-node.is-reached .journey-node-core {
  border-color: var(--ink);
}

.journey-node.is-completed .journey-node-core {
  box-shadow:
    inset 0 0 0 1px var(--map-island-border),
    0 0 0 1px var(--map-island-border),
    0 0 16px var(--map-island-glow);
}

.journey-node-lock {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translate(-50%, -50%);
  color: color-mix(in srgb, var(--ink) 80%, transparent);
  opacity: 0.92;
  pointer-events: none;
}

.journey-node-lock svg {
  display: block;
  width: 100%;
  height: 100%;
}

.journey-lock-hover {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(6px);
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--map-bubble-border);
  background: var(--map-bubble-bg);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
  z-index: 7;
}

.journey-lock-hover::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 8px solid var(--map-bubble-bg);
}

.journey-lock-hover::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 0;
  height: 0;
  transform: translateX(-50%) translateY(1px);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 9px solid var(--map-bubble-border);
  z-index: -1;
}

.journey-node.is-locked:hover .journey-lock-hover,
.journey-node.is-locked:focus-within .journey-lock-hover {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.journey-player {
  --journey-hover-lift: 0px;
  position: absolute;
  left: var(--player-x);
  top: var(--player-y);
  width: 34px;
  height: 44px;
  transform: translate(-50%, calc(-96% + var(--journey-hover-lift))) scale(var(--player-scale));
  transform-origin: center bottom;
  transition: left 720ms cubic-bezier(0.22, 0.8, 0.2, 1), top 720ms cubic-bezier(0.22, 0.8, 0.2, 1), transform 960ms cubic-bezier(0.2, 0.74, 0.24, 1), filter 520ms ease;
  filter: drop-shadow(0 2px 4px var(--map-player-shadow));
  z-index: 3;
  pointer-events: auto;
}

.journey-player.moving {
  filter: drop-shadow(0 4px 10px var(--map-player-glow));
}

.journey-player:hover,
.journey-player:focus-visible {
  --journey-hover-lift: -18px;
  animation: journeyPlayerFloat 880ms ease-in-out infinite alternate;
}

.journey-player:focus-visible {
  outline: none;
}

.journey-player-head {
  position: absolute;
  left: 50%;
  top: 0;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  transform: translateX(-50%);
  background: var(--ink);
}

.journey-player-body {
  position: absolute;
  left: 50%;
  top: 12px;
  width: 20px;
  height: 28px;
  border-radius: 11px 11px 8px 8px;
  transform: translateX(-50%);
  background: var(--ink);
}

.journey-goal-hover {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(6px);
  min-width: 200px;
  max-width: 240px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--map-bubble-border);
  background: var(--map-bubble-bg);
  color: var(--ink);
  text-align: center;
  font-size: 13px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease, transform 260ms ease;
  z-index: 8;
}

.level-journey-map.goal-reached .journey-node.is-goal:hover .journey-goal-hover {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.journey-goal-confetti {
  position: absolute;
  inset: -20px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 320ms ease;
}

.level-journey-map.goal-reached .journey-goal-confetti {
  opacity: 1;
}

.journey-goal-confetti i {
  position: absolute;
  width: 3px;
  height: 14px;
  border-radius: 3px;
  background: var(--ink);
  animation: journeyConfettiFloat 980ms ease-in-out infinite alternate;
}

.journey-goal-confetti i:nth-child(1) { left: 6px; top: 4px; animation-delay: 0ms; }
.journey-goal-confetti i:nth-child(2) { left: 20px; top: -2px; animation-delay: 120ms; }
.journey-goal-confetti i:nth-child(3) { left: 40px; top: 0; animation-delay: 180ms; }
.journey-goal-confetti i:nth-child(4) { right: 38px; top: -1px; animation-delay: 260ms; }
.journey-goal-confetti i:nth-child(5) { right: 18px; top: 3px; animation-delay: 340ms; }
.journey-goal-confetti i:nth-child(6) { right: 4px; top: 7px; animation-delay: 440ms; }

@keyframes journeyConfettiFloat {
  from { transform: translateY(0) rotate(0deg); opacity: 0.55; }
  to { transform: translateY(-6px) rotate(14deg); opacity: 1; }
}

@keyframes journeyPlayerFloat {
  from { transform: translate(-50%, calc(-96% + var(--journey-hover-lift) - 2px)) scale(calc(var(--player-scale) * 1.02)); }
  to { transform: translate(-50%, calc(-96% + var(--journey-hover-lift) - 8px)) scale(calc(var(--player-scale) * 1.06)); }
}

@media (max-width: 760px) {
  .level-select-layout {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .level-summary-layout {
    grid-template-columns: 1fr;
  }

  .level-summary-footer {
    justify-content: flex-start;
  }

  .level-select-avatar-trigger {
    width: 88px;
    height: 88px;
  }

  .level-journey-map {
    height: 146px;
  }

  .level-journey-card {
    margin-top: clamp(20px, 10vh, 96px);
  }

  .journey-goal-hover {
    min-width: 176px;
    max-width: 208px;
    font-size: 12px;
  }
}

.page-shell {
  display: block;
  width: 100%;
}

.back-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  margin: 0 0 24px 0;
}

.page-body {
  display: block;
  width: 100%;
}

.progress-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.player-dashboard-trigger {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.5);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.4);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.18);
}

body[data-theme="light"] .player-dashboard-trigger {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(8, 145, 178, 0.35);
  box-shadow: 0 0 0 2px rgba(8, 145, 178, 0.16);
}

.player-dashboard-trigger .avatar-img,
.player-dashboard-avatar .avatar-img {
  width: 100%;
  height: 100%;
  border: none;
}

.player-dashboard-trigger.level-select-avatar-trigger {
  width: 104px;
  height: 104px;
}

.level-progress-card {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.level-progress-avatar-trigger {
  width: 104px;
  height: 104px;
}

.level-progress-content p {
  margin: 0 0 8px 0;
}

.level-score-bars {
  display: grid;
  gap: 10px;
  margin: 6px 0 14px;
}

.level-score-bar-item {
  display: grid;
  gap: 6px;
}

.level-score-bar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.level-score-bar-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
}

.level-score-bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22d3ee 0%, #38bdf8 100%);
}

@media (max-width: 760px) {
  .level-progress-card {
    grid-template-columns: 1fr;
  }

  .level-progress-avatar-trigger {
    width: 88px;
    height: 88px;
  }

  .player-dashboard-trigger.level-select-avatar-trigger {
    width: 88px;
    height: 88px;
  }
}

.player-dashboard-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.58);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.player-dashboard-backdrop.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.player-dashboard-modal {
  width: min(860px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: var(--panel);
  box-shadow: 0 22px 44px rgba(2, 6, 23, 0.35);
  padding: 18px;
  opacity: 0;
  transform: translateY(12px) scale(0.985);
  transition: transform 260ms ease, opacity 220ms ease;
}

.player-dashboard-backdrop.show .player-dashboard-modal {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.player-dashboard-backdrop.closing {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.player-dashboard-backdrop.closing .player-dashboard-modal {
  opacity: 0;
  transform: translateY(8px) scale(0.985);
}

.game-confirm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.52);
  display: grid;
  place-items: center;
  z-index: 2200;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.game-confirm-backdrop.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.game-confirm-backdrop.closing {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.game-confirm-modal {
  width: min(520px, 94vw);
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 22px 44px rgba(2, 6, 23, 0.35);
  padding: 16px;
  opacity: 0;
  transform: translateY(10px) scale(0.985);
  transition: transform 240ms ease, opacity 220ms ease;
}

.game-confirm-backdrop.show .game-confirm-modal {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.game-confirm-backdrop.closing .game-confirm-modal {
  opacity: 0;
  transform: translateY(8px) scale(0.985);
}

.game-confirm-modal h3 {
  margin: 0 0 8px;
}

.game-confirm-body p {
  margin: 0 0 6px;
  line-height: 1.55;
}

.game-confirm-body p:last-child {
  margin-bottom: 0;
}

.game-confirm-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.game-confirm-actions button {
  width: auto;
  min-width: 96px;
}

.game-confirm-actions button.ghost {
  color: #ef4444;
}

body[data-theme="light"] .player-dashboard-modal {
  border-color: rgba(148, 163, 184, 0.4);
}

.player-dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.player-dashboard-head h3 {
  margin: 0;
}

.player-dashboard-close {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.player-dashboard-profile {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.player-dashboard-avatar {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
}

.player-dashboard-profile p {
  margin: 0 0 4px 0;
}

.player-dashboard-progress {
  margin-bottom: 16px;
}

.player-dashboard-progress-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.player-dashboard-progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
}

.player-dashboard-progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #22d3ee 0%, #38bdf8 100%);
}

.player-dashboard-level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.player-dashboard-level-item {
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: rgba(15, 23, 42, 0.28);
  padding: 10px;
}

body[data-theme="light"] .player-dashboard-level-item {
  background: rgba(255, 255, 255, 0.72);
}

.player-dashboard-level-item.completed {
  border-color: rgba(34, 211, 238, 0.52);
}

.player-dashboard-level-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.player-dashboard-level-item p {
  margin: 2px 0;
  font-size: 13px;
}

.player-dashboard-report {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.player-dashboard-report h4 {
  margin: 0 0 8px 0;
  font-size: 18px;
}

.player-dashboard-report-copy {
  margin: 6px 0;
  line-height: 1.55;
  color: var(--ink);
}

@media (max-width: 1100px) {
  .social-two-col {
    grid-template-columns: 1fr;
  }

  .left-collapsible-layout,
  body[data-page="phase1"] .phase1-split.left-collapsible-layout,
  body[data-page="phase2"] .phase2-social.left-collapsible-layout {
    grid-template-columns: minmax(180px, 42%) 20px minmax(0, 1fr);
  }

  body[data-page="phase1"] .phase1-split.left-collapsible-layout.left-collapsed,
  body[data-page="phase2"] .phase2-social.left-collapsible-layout.left-collapsed {
    grid-template-columns: 0 20px minmax(0, 1fr);
  }

  .social-left-rail {
    grid-template-rows: auto;
  }

  .social-sidebar {
    position: static;
    max-height: none;
  }

  .phase2-social:not(.left-collapsible-layout) {
    grid-template-columns: 1fr;
  }

  body[data-page="phase1"] .phase1-topbar-right {
    padding-right: 0;
  }

  .feed-column,
  .side-column {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

/* Monochrome Theme Override */
:root {
  --bg: #000000;
  --panel: rgba(0, 0, 0, 0.92);
  --ink: #ffffff;
  --muted: #c9c9c9;
  --primary: #ffffff;
  --secondary: #ffffff;
  --warn: #ffffff;
  --line: rgba(255, 255, 255, 0.28);
  --glow-cyan: none;
  --glow-red: none;
  --glow-yellow: none;
}

body[data-theme="light"] {
  --bg: #ffffff;
  --panel: rgba(255, 255, 255, 0.96);
  --ink: #000000;
  --muted: #4a4a4a;
  --primary: #000000;
  --secondary: #000000;
  --warn: #000000;
  --line: rgba(0, 0, 0, 0.28);
  --glow-cyan: none;
  --glow-red: none;
  --glow-yellow: none;
}

body,
body[data-page="phase1"],
body[data-page="phase2"],
body[data-page="progress"],
body[data-theme="light"],
body[data-theme="light"][data-page="phase1"],
body[data-theme="light"][data-page="phase2"],
body[data-theme="light"][data-page="progress"] {
  background: var(--bg) !important;
  color: var(--ink);
}

.card,
.panel,
.post,
.wall,
.feed-card,
.social-rail-card,
.topic-card-body,
.selected-card-info,
.player-dashboard-modal,
.learning-radar-panel,
.producer-hint-panel,
.player-dashboard-level-item,
pre,
input,
textarea,
select,
button,
.pick-card {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: none;
}

.pick-card.selected,
.player-dashboard-level-item.completed {
  border-color: var(--ink);
  box-shadow: none;
}

.pick-card::after {
  box-shadow: none;
}

.player-dashboard-progress-bar,
.level-score-bar-track {
  background: var(--line);
}

.player-dashboard-progress-bar span,
.level-score-bar-track span {
  background: var(--ink);
}

.like-action.liked,
.comment-like-action.liked,
.comment-actions .comment-like-action.liked {
  color: var(--ink);
}

button,
button.secondary,
button.ghost,
button.warn {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: none;
}

button[data-select-post],
button[data-select-post].ghost,
button[data-select-post].secondary {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: none;
}

button[data-select-post].secondary {
  border-color: var(--ink);
}

.game-confirm-backdrop .game-confirm-actions button.ghost {
  color: #ef4444;
}

/* Follow system theme only: hide legacy manual toggle if present */
.theme-toggle {
  display: none !important;
}

.level-select-card,
.login-card {
  border-color: transparent !important;
}

.level-detail-card {
  border-color: transparent !important;
}

/* Monochrome loading states (including setup/login related loading boxes) */
.thinking-box,
body[data-theme="light"] .thinking-box {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.thinking-spinner {
  border-color: var(--line);
  border-top-color: var(--ink);
  box-shadow: none;
}

/* Phase1 hint ? button in monochrome */
.producer-hint-trigger,
body[data-theme="light"] .producer-hint-trigger {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
  box-shadow: none;
}

.producer-hint-trigger:hover,
body[data-theme="light"] .producer-hint-trigger:hover {
  border-color: var(--ink);
  background: var(--panel);
}

.producer-hint-trigger:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Phase2 unified separators */
body[data-page="phase2"] {
  --phase2-post-separator: 2px;
  --phase2-comment-separator: 1px;
  --phase2-news-comment-separator: 1px;
}

body[data-page="phase2"] .social-post-card .comment-list,
body[data-page="phase2"] .comment-thread {
  border-top: var(--phase2-news-comment-separator) solid var(--line);
  margin-top: 10px;
  padding-top: 10px;
}

body[data-page="phase2"] .comment-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

body[data-page="phase2"] .comment-item {
  margin: 0 !important;
  padding: 12px 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-page="phase2"] .comment-item + .comment-item {
  border-top: var(--phase2-comment-separator) solid var(--line) !important;
  margin-top: 0 !important;
  padding-top: 12px !important;
}

/* Feed posts: use line separators between posts (no boxed cards) */
body[data-page="phase2"] .feed-column .social-post-card {
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  margin-bottom: 0;
  padding: 14px 0;
}

body[data-page="phase2"] .feed-column .social-post-card + .social-post-card {
  border-top: var(--phase2-post-separator) solid var(--line);
  margin-top: 10px;
  padding-top: 14px;
}

/* Post title and social actions should stay together (no extra gap/line) */
body[data-page="phase2"] .social-actions {
  margin: 0;
  padding-top: 0;
  border-top: none;
}

/* Phase2 uses pure separators instead of boxed frames */
body[data-page="phase2"] .wall,
body[data-page="phase2"] .feed-column,
body[data-page="phase2"] .feed-column .post {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

/* Re-apply post separators after frame reset */
body[data-page="phase2"] .feed-column .social-post-card + .social-post-card {
  border-top: var(--phase2-post-separator) solid var(--line) !important;
  margin-top: 10px;
  padding-top: 14px;
}

/* Entry page monochrome overrides */
.brand-title {
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: var(--ink);
  text-shadow: none;
}

.brand-icon {
  border-color: var(--line);
  color: var(--ink);
  background: var(--panel);
  box-shadow: none;
}

.system-id-box {
  border-color: var(--line);
  background: var(--panel);
}

.system-id-label {
  color: var(--muted);
}

.system-id-value {
  color: var(--ink);
}

/* Hard-sync topbar/back button layout across progress / phase1 / phase2 / end */
body[data-page="phase1"] #app,
body[data-page="phase2"] #app,
body[data-page="progress"] #app,
body[data-page="end"] #app {
  max-width: 1500px !important;
  padding: 10px clamp(18px, 3.2vw, 36px) !important;
  padding-top: calc(10px + env(safe-area-inset-top)) !important;
  margin-top: 0 !important;
}

body[data-page="phase1"] .phase1-topbar,
body[data-page="phase2"] .phase2-topbar,
body[data-page="progress"] .progress-topbar,
body[data-page="end"] .progress-topbar {
  position: sticky !important;
  top: 0 !important;
  z-index: 42 !important;
  width: min(100%, 1476px) !important;
  display: grid !important;
  grid-template-columns: 48px minmax(0, 1fr) 48px !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 58px !important;
  padding: 58px 10px !important;
  margin: 0 auto 8px !important;
  border: 1px solid transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: var(--bg) !important;
}

body[data-theme="light"][data-page="phase1"] .phase1-topbar,
body[data-theme="light"][data-page="phase2"] .phase2-topbar,
body[data-theme="light"][data-page="progress"] .progress-topbar,
body[data-theme="light"][data-page="end"] .progress-topbar {
  background: var(--bg) !important;
}
