/* 1dayleft — 主樣式（《24》琥珀橘 LED 風） */

@font-face {
  font-family: "DSEG7";
  src: url("../assets/fonts/DSEG7Classic-Bold.woff2") format("woff2"),
       url("../assets/fonts/DSEG7Classic-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --amber: #ff9a1f;
  --amber-bright: #ffc266;
  --amber-dim: rgba(255, 154, 31, 0.55);
  --amber-faint: rgba(255, 154, 31, 0.28);
  --danger: #ff3b1f;
  /* 結算色塊語意色 */
  --c-loved: #ff9a1f;   /* 🟧 給所愛的人 */
  --c-self:  #ffd24a;   /* 🟨 給自己 */
  --c-others: #cfcfcf;  /* ⬜ 為別人的眼光 */
  --c-hesit: #3a3a3a;   /* ⬛ 猶豫流失 */
  --c-accept: #7ad17a;  /* 🟩 靜靜放下 */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: #000;
  color: var(--amber);
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", sans-serif;
}
body { overflow-x: hidden; }

/* 背景輝光 + 暗角 */
body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 40%, rgba(255,120,20,0.06), transparent 70%),
    radial-gradient(ellipse 120% 120% at 50% 50%, transparent 55%, rgba(0,0,0,0.92));
  pointer-events: none; z-index: 1;
}
/* 顆粒雜訊 */
body::after {
  content: "";
  position: fixed; inset: -50%;
  opacity: 0.05; pointer-events: none; z-index: 2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.6s steps(2) infinite;
}
@keyframes grain { to { transform: translate(8px, -6px); } }

/* === 畫面容器 === */
.screen {
  position: relative; z-index: 3;
  display: none;
  min-height: 100vh;
  flex-direction: column; align-items: center; justify-content: center;
  padding: 6vh 6vw; gap: 2rem;
  text-align: center;
}
.screen.active { display: flex; }

/* === 共用排版 === */
.led {
  font-family: "DSEG7", "Courier New", monospace;
  color: var(--amber-bright);
  text-shadow: 0 0 8px rgba(255,154,31,0.7), 0 0 24px rgba(255,90,10,0.4);
  letter-spacing: 0.05em;
}
.title-lg { font-size: clamp(36px, 7.5vw, 70px); }
/* 中文主標（不用 LED 字體，七段字無法顯示中文） */
.home-title {
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", sans-serif;
  font-weight: 500; font-size: clamp(40px, 9vw, 84px);
  letter-spacing: 0.12em; color: var(--amber-bright);
  text-shadow: 0 0 10px rgba(255,154,31,0.55), 0 0 30px rgba(255,90,10,0.3);
}
.home-en { font-size: clamp(16px, 3vw, 22px); letter-spacing: 0.35em; color: var(--amber-dim); margin-top: -0.4rem; }
.eyebrow {
  font-size: 15px; letter-spacing: 0.5em; color: var(--amber-dim);
  text-transform: uppercase;
}
.prose {
  max-width: 680px; line-height: 1.95; font-size: clamp(18px, 2.6vw, 23px);
  color: #e9d9c4; white-space: pre-line;
  text-wrap: balance;
}
.muted { color: var(--amber-dim); font-size: 16px; letter-spacing: 0.1em; line-height: 1.9; text-wrap: balance; }

/* 中文置中文字：平衡每行長度，避免孤兒字 */
.prose, .muted, .punch, .reflect, .narrative, .overlay-inner .q,
.eyebrow, .scenario-card .sub, .game-meta, .footer-note, .helpline {
  text-wrap: balance;
}

/* === 按鈕 === */
button, .btn {
  background: transparent; color: var(--amber);
  border: 1px solid var(--amber-faint);
  padding: 14px 28px;
  font-family: inherit; font-size: 18px; letter-spacing: 0.08em;
  cursor: pointer; border-radius: 2px;
  transition: all 0.15s;
}
button:hover, .btn:hover { background: rgba(255,154,31,0.12); border-color: var(--amber); }
button:active, .btn:active { transform: scale(0.98); }
button:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-primary {
  border-color: var(--amber); color: var(--amber-bright);
  box-shadow: 0 0 16px rgba(255,120,10,0.25);
}
.btn-ghost { border-color: transparent; color: var(--amber-dim); }
.btn-ghost:hover { color: var(--amber); background: transparent; }

/* === 警語頁 === */
#screen-warning .prose { color: #d8c7b0; }
.warning-box {
  border: 1px solid var(--amber-faint); border-radius: 4px;
  padding: 1.75rem 2rem; max-width: 640px;
  background: rgba(255,154,31,0.03); text-align: left;
}
.warning-box h3 { color: var(--amber); font-weight: 500; font-size: 18px; letter-spacing: 0.1em; margin-bottom: 0.75rem; }
.helpline { font-size: 16px; color: var(--amber-dim); line-height: 2.1; margin-top: 0.75rem; }
.helpline b { color: var(--amber-bright); font-weight: 700; }

/* === 場景選擇 === */
.scenario-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px; max-width: 800px; width: 100%;
}
.scenario-card {
  border: 1px solid var(--amber-faint); border-radius: 4px;
  padding: 1.75rem 1.5rem; cursor: pointer; text-align: left;
  transition: all 0.18s; background: rgba(255,154,31,0.02);
}
.scenario-card:hover { border-color: var(--amber); background: rgba(255,154,31,0.08); transform: translateY(-2px); }
.scenario-card h3 { font-size: 26px; font-weight: 500; color: var(--amber-bright); margin-bottom: 8px; }
.scenario-card .sub { font-size: 14px; letter-spacing: 0.2em; color: var(--amber-dim); }

/* === 遊戲畫面 === */
#screen-game { justify-content: flex-start; padding-top: 0; gap: 1.25rem; }
/* 倒數鐘固定在頂端，選項在下方捲動時仍看得到 */
.game-header {
  position: sticky; top: 0; z-index: 6;
  width: 100%; display: flex; flex-direction: column; align-items: center;
  padding: 2.2vh 0 1rem;
  background: #000;
  border-bottom: 1px solid var(--amber-faint);
  box-shadow: 0 10px 24px 6px rgba(0,0,0,0.85);
}
.clock {
  position: relative; font-family: "DSEG7", "Courier New", monospace;
  font-size: clamp(44px, 12vw, 120px); line-height: 1; letter-spacing: 0.04em;
}
.clock .ghost { position: absolute; inset: 0; color: rgba(255,154,31,0.06); z-index: 0; user-select: none; }
.clock .live {
  position: relative; z-index: 1; color: var(--amber);
  text-shadow: 0 0 6px rgba(255,154,31,0.9), 0 0 18px rgba(255,120,10,0.6), 0 0 40px rgba(255,80,0,0.35);
  transition: color 0.6s, text-shadow 0.6s;
}
.clock.warn .live { color: #ff7a2f; text-shadow: 0 0 8px rgba(255,90,20,0.9), 0 0 26px rgba(255,50,0,0.6); }
.clock.danger .live { color: var(--danger); text-shadow: 0 0 10px rgba(255,40,10,1), 0 0 32px rgba(255,0,0,0.7); animation: flicker 1.1s infinite; }
@keyframes flicker { 0%,90%,100%{opacity:1;} 94%{opacity:0.55;} }
.clock-labels { display: flex; gap: clamp(20px,7vw,72px); justify-content: center; margin-top: 8px; font-size: 13px; letter-spacing: 0.35em; color: var(--amber-dim); }

.game-meta { font-size: clamp(17px, 2.4vw, 21px); font-weight: 500; letter-spacing: 0.12em; line-height: 1.7; color: var(--amber-bright); max-width: 640px; text-wrap: balance; }
.game-hint { font-size: 14px; letter-spacing: 0.08em; line-height: 1.7; color: var(--amber-dim); max-width: 560px; text-wrap: balance; margin-top: -0.5rem; }

/* 任務清單 */
.task-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px; max-width: 920px; width: 100%; margin-top: 0.5rem;
}
.task {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border: 1px solid var(--amber-faint); border-radius: 3px;
  padding: 14px 16px; cursor: pointer; text-align: left;
  transition: all 0.14s; font-size: 16px; color: #e3d3bd; background: transparent;
}
.task:hover:not(.done):not(.locked) { border-color: var(--amber); background: rgba(255,154,31,0.08); }
.task .cost { font-family: "DSEG7","Courier New",monospace; font-size: 15px; color: var(--amber); white-space: nowrap; }
.task.done { opacity: 0.4; cursor: default; text-decoration: line-through; }
.task.locked { opacity: 0.3; cursor: not-allowed; }
.task.done .cost::before { content: "✓ "; }

/* 確認 / 敘事 疊層 */
.overlay {
  position: fixed; inset: 0; z-index: 10; display: none;
  align-items: center; justify-content: center; padding: 8vw;
  background: rgba(0,0,0,0.82); backdrop-filter: blur(2px);
}
.overlay.active { display: flex; }
.overlay-inner { max-width: 580px; text-align: center; }
.overlay-inner .q { font-size: clamp(21px,3.4vw,28px); color: #f0e2cd; line-height: 1.6; margin-bottom: 0.5rem; }
.overlay-inner .cost-note { color: var(--amber-dim); font-size: 16px; letter-spacing: 0.1em; margin-bottom: 1.5rem; }
.overlay-actions { display: flex; gap: 14px; justify-content: center; }
.narrative { font-size: clamp(21px,3.6vw,30px); line-height: 1.75; color: #f0e2cd; font-family: "Noto Sans TC","Microsoft JhengHei","PingFang TC",sans-serif; white-space: pre-line; }

/* === 結算 === */
#screen-result { justify-content: flex-start; padding-top: 6vh; gap: 1.5rem; }
.result-head .led { font-size: clamp(30px,6.5vw,56px); }
.spectrum { width: 100%; max-width: 680px; }
.spectrum-bar { display: flex; width: 100%; height: 28px; border-radius: 3px; overflow: hidden; border: 1px solid rgba(255,154,31,0.2); }
.spectrum-bar > span { height: 100%; transition: width 0.6s; }
.spectrum-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; margin-top: 14px; font-size: 15px; color: #d8c7b0; }
.spectrum-legend .item { display: flex; align-items: center; gap: 7px; }
.swatch { width: 14px; height: 14px; border-radius: 2px; display: inline-block; }
.punch { font-size: clamp(20px,3vw,25px); color: var(--amber-bright); line-height: 1.6; max-width: 640px; }
.reflect { max-width: 640px; line-height: 1.95; color: #e9d9c4; font-size: 18px; white-space: pre-line; }

.lists { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; max-width: 760px; width: 100%; text-align: left; }
.lists h4 { font-size: 15px; letter-spacing: 0.2em; color: var(--amber-dim); margin-bottom: 8px; font-weight: 500; }
.lists ul { list-style: none; font-size: 15px; line-height: 2; color: #cdbda7; }
.lists .undone { color: rgba(205,189,167,0.5); }
/* 每個清單項目前的分類色點（與光譜同色），懸掛縮排對齊首行 */
.lists li { display: flex; align-items: flex-start; gap: 0.6em; }
.lists li .axis-dot { width: 0.62em; height: 0.62em; border-radius: 2px; flex-shrink: 0; margin-top: 0.68em; }
.lists .undone .axis-dot { opacity: 0.55; }
.lists li.empty { opacity: 0.5; }
@media (max-width: 560px) { .lists { grid-template-columns: 1fr; } }

/* 分享卡 */
.share-card {
  font-family: "Consolas","Courier New",monospace; white-space: pre-wrap;
  border: 1px solid var(--amber-faint); border-radius: 4px;
  padding: 1.5rem 1.75rem; max-width: 560px; width: 100%;
  text-align: left; font-size: 16px; line-height: 1.75; color: #e3d3bd;
  background: rgba(255,154,31,0.03);
}
.share-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: rgba(255,154,31,0.15); border: 1px solid var(--amber); color: var(--amber-bright);
  padding: 12px 24px; border-radius: 3px; font-size: 15px; z-index: 20;
  opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.toast.show { opacity: 1; }

.footer-note { font-size: 13px; color: rgba(255,154,31,0.3); letter-spacing: 0.1em; max-width: 600px; line-height: 1.8; }
/* 遺室合作版:結尾引導詩（多行、較可讀、置中） */
#result-footer { white-space: pre-line; font-size: 15px; line-height: 2.1; letter-spacing: 0.12em;
  color: rgba(255,154,31,0.6); max-width: 30em; margin: 2.75rem auto; text-align: center; }
a { color: var(--amber); }

/* === 關於頁 === */
#screen-about { justify-content: flex-start; padding-top: 7vh; }
.about { max-width: 680px; width: 100%; text-align: left; }
.about-head { text-align: center; margin-bottom: 2.5rem; }
.about-block { margin-bottom: 2.5rem; }
.about-block h3 {
  font-size: 16px; letter-spacing: 0.25em; font-weight: 500;
  color: var(--amber); margin-bottom: 1rem;
  padding-bottom: 0.5rem; border-bottom: 1px solid var(--amber-faint);
}
.about-block p {
  font-size: 17px; line-height: 1.95; color: #e9d9c4; margin-bottom: 1rem;
}

/* === 進場動畫 === */
@keyframes riseIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes ledBoot {
  0%   { opacity: 0; transform: translateY(14px); }
  22%  { opacity: 0.55; transform: none; }
  28%  { opacity: 0.12; }
  36%  { opacity: 1; }
  43%  { opacity: 0.35; }
  50%  { opacity: 1; }
  100% { opacity: 1; }
}

/* 首頁：元素依序浮現 */
#screen-home.active > * { animation: riseIn 0.7s ease both; }
#screen-home.active > *:nth-child(1) { animation-delay: 0.05s; }
#screen-home.active > *:nth-child(2) { animation-delay: 0.15s; }
#screen-home.active > *:nth-child(3) { animation-delay: 0.32s; }
#screen-home.active > *:nth-child(4) { animation-delay: 0.46s; }
#screen-home.active > *:nth-child(5) { animation-delay: 0.60s; }
#screen-home.active > *:nth-child(6) { animation-delay: 0.78s; }
#screen-home.active > *:nth-child(7) { animation-delay: 0.92s; }
/* 倒數鐘：載入時由 JS 控制（從 00:00:00 飆到 24:00:00 + 接觸不良閃爍），停用 CSS 進場動畫避免覆蓋透明度 */
#screen-home.active #home-clock { animation: none; }
/* 爬升期間用較輕的光暈，避免每幀重繪巨大多層陰影拖慢動畫 */
#home-clock.booting { text-shadow: 0 0 6px rgba(255,154,31,0.55); will-change: contents, opacity; }

/* 場景前言：標題浮現、內文逐行浮現、按鈕最後出現 */
#screen-intro.active #intro-eyebrow { animation: riseIn 0.7s ease 0.05s both; }
#screen-intro.active #intro-title   { animation: riseIn 0.8s ease 0.20s both; }
#screen-intro.active > div          { animation: riseIn 0.7s ease 1.15s both; }
.intro-line { display: block; }
.intro-line.spacer { height: 0.7em; }
#screen-intro.active .intro-line { animation: riseIn 0.7s ease both; }

@media (prefers-reduced-motion: reduce) {
  #screen-home.active > *, #screen-home.active .title-lg,
  #screen-intro.active #intro-eyebrow, #screen-intro.active #intro-title,
  #screen-intro.active > div, #screen-intro.active .intro-line,
  body::after {
    animation: none !important; opacity: 1 !important; transform: none !important;
  }
}

/* ---------- 左下角聲音控制 ---------- */
.sound-ctrl {
  position: fixed; left: 16px; bottom: 16px; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px 7px 8px;
  background: rgba(10,8,5,0.55);
  border: 1px solid var(--amber-faint); border-radius: 999px;
  backdrop-filter: blur(4px);
  opacity: 0.55; transition: opacity 0.25s ease, border-color 0.25s ease;
}
.sound-ctrl:hover, .sound-ctrl:focus-within { opacity: 1; border-color: var(--amber); }
/* 只在有聲音的畫面出現；靜音頁淡出、不可互動 */
.sound-ctrl.is-hidden { opacity: 0; pointer-events: none; }
.sound-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  background: transparent; border: none; border-radius: 50%;
  color: var(--amber); cursor: pointer;
}
.sound-toggle:hover { background: rgba(255,154,31,0.14); }
.sound-toggle.off { color: var(--amber-dim); }
.sound-vol {
  -webkit-appearance: none; appearance: none;
  width: 84px; height: 3px; border-radius: 3px; cursor: pointer;
  background: var(--amber-faint); outline: none;
}
.sound-vol::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--amber); border: none; cursor: pointer;
  box-shadow: 0 0 6px rgba(255,154,31,0.7);
}
.sound-vol::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--amber); border: none; cursor: pointer;
  box-shadow: 0 0 6px rgba(255,154,31,0.7);
}
@media (max-width: 520px) { .sound-vol { width: 64px; } }

/* ---------- 「卡住」狀態：再也做不了任何一件事 ---------- */
.game-hint.stuck { color: var(--amber-bright); font-size: 16px; }
/* 強調「停下，靜靜度過剩下的時間」按鈕 */
.btn-stop-urge {
  border-color: var(--amber); color: var(--amber-bright);
  box-shadow: 0 0 0 1px var(--amber-faint), 0 0 16px rgba(255,154,31,0.3);
  animation: urgePulse 1.9s ease-in-out infinite;
}
.btn-stop-urge:hover { color: var(--amber-bright); }
@keyframes urgePulse {
  0%,100% { box-shadow: 0 0 0 1px var(--amber-faint), 0 0 12px rgba(255,154,31,0.25); }
  50%     { box-shadow: 0 0 0 1px var(--amber),       0 0 26px rgba(255,154,31,0.55); }
}
@media (prefers-reduced-motion: reduce) {
  .btn-stop-urge { animation: none; }   /* 關掉脈動，保留靜態光暈 */
}

/* ---------- 集體數據（匿名統計）---------- */
.lists ul { padding-left: 0; }
.lists li { position: relative; }
.lists li .li-body { flex: 1; }
.lists li > * { position: relative; z-index: 1; }   /* 內容在長條之上 */
/* 每列底色長條：寬度＝人氣 %（由 JS 設 --pct） */
.lists li.has-stat::before {
  content: ""; position: absolute; left: -7px; top: 1px; bottom: 1px;
  width: var(--pct, 0%); z-index: 0; pointer-events: none;
  background: rgba(255,154,31,0.10); border-radius: 5px;
  transition: width .5s ease;
}
/* 行尾小百分比 */
.opstat {
  flex: 0 0 auto; align-self: flex-start; margin-top: 0.62em; margin-left: 0.8em;
  font-size: 13px; letter-spacing: 0.04em; color: var(--amber-dim); white-space: nowrap;
}
.lists .undone .opstat { opacity: 0.85; }
/* 清單上方一句總說明 */
.lists-caption { font-size: 13px; letter-spacing: 0.06em; color: var(--amber-dim);
  text-align: left; max-width: 760px; margin: 0 auto 8px; }
/* 「大家的一天」對照光譜 */
.collective { margin-top: 6px; }
/* 集體 bar 降低彩度，與玩家自己（鮮豔）的光譜 bar 做出區別 */
#collective-bar { filter: saturate(0.4) brightness(0.92); }
.collective-label { font-size: 14px; letter-spacing: 0.1em; color: var(--amber-dim); text-align: center; margin-bottom: 8px; }
.collective-note { font-size: 12.5px; line-height: 1.7; color: var(--amber-dim); text-align: center; max-width: 40em; margin: 10px auto 0; }
