/* 原子落杯：界面样式。配色和版式依据 docs/visual-design.md。 */
@import url('./panels.css');

:root {
  --paper: #f4efe4;
  --paper-2: #ebe4d6;
  --card: #fffdf8;
  --ink: #23262d;
  --ink-2: #5f636c;
  --line: #d8cfbf;
  --glass: #b9c6d2;
  --amber: #f2a93b;
  --amber-ink: #6b4100;
  --warn: #d9480f;
  --teal: #116466;
  --o: #e5484d;
  --n: #3e63dd;
  --c: #3b3d42;
  --h: #f6f4ee;
  --radius: 16px;
  --shadow: 0 6px 20px rgba(35, 38, 45, 0.12), 0 1px 3px rgba(35, 38, 45, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* 组件上写了 display 会盖过浏览器默认的 [hidden]，这里统一兜底，否则隐藏的弹窗会挡住点击。 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  overscroll-behavior: none;
}

body { overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

.app {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* —— 顶栏 —— */
.topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 2px;
  min-height: 56px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
}
.icon-btn:active { background: var(--paper-2); }

.scorebox { flex: 1; min-width: 0; padding-left: 4px; line-height: 1.05; }
.score-num {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.score-sub { font-size: 12px; color: var(--ink-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pill-btn {
  min-width: 56px;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  font-size: 15px;
  font-weight: 600;
}
.pill-btn:active { transform: translateY(1px); background: var(--paper-2); }

/* —— 订单关目标条 —— */
.level-bar {
  margin: 0 12px 2px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--card);
  border: 1.5px solid var(--line);
  font-size: 14px;
  line-height: 1.45;
}
.level-bar b { font-weight: 800; }
.level-bar .lesson { color: var(--ink-2); font-size: 13px; }

/* —— 舞台 —— */
/* 显式指定行号：目标条隐藏时不能让舞台挤到 auto 行里 */
.topbar { grid-row: 1; }
.level-bar { grid-row: 2; }
.stage-wrap { grid-row: 3; position: relative; min-height: 0; }
.bottombar { grid-row: 4; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* —— 底栏 —— */
.bottombar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 76px;
  padding: 8px 14px 10px;
}

.tool-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 52px;
  padding: 0 18px 0 14px;
  border: 0;
  border-radius: 26px;
  background: var(--amber);
  color: var(--amber-ink);
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 3px 0 #c98418;
}
.tool-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #c98418; }
.tool-btn[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: 0 3px 0 #000; }
.tool-btn:disabled { background: #ebe4d6; color: #5f636c; box-shadow: none; cursor: default; }
.tool-btn.bump { animation: bump 0.2s ease-out; }
@keyframes bump { 0% { transform: scale(1); } 50% { transform: scale(1.08); } 100% { transform: scale(1); } }
.tool-btn.secondary-tool { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); box-shadow: 0 2px 0 var(--line); }
.tool-btn.secondary-tool:disabled { background: transparent; color: #5f636c; box-shadow: none; }
.tool-btn { height: 48px; padding: 0 12px 0 10px; font-size: 15px; gap: 4px; }
.badge {
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.75);
  color: inherit;
  font-size: 14px;
  line-height: 24px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* 提示行固定两行高：提示出现、换行、消失时舞台不变高矮（不然画布被拉伸，点的位置也对不上） */
.hint { flex: 1 1 100%; height: 38px; overflow: hidden; font-size: 13px; color: var(--ink-2); line-height: 19px; }
.hint .tag { line-height: 16px; }
.hint:empty { visibility: hidden; }
.bottombar { flex-wrap: wrap; row-gap: 6px; }
.tray { order: -1; flex: 1 1 100%; justify-content: center; }

/* 顶栏里的"下一个" */
.next { display: flex; align-items: center; gap: 4px; padding: 0 4px; }
.next-label { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
#next-atom { width: 28px; height: 28px; }

/* 订单关托盘 */
.tray { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--card);
  padding: 0;
}
.chip canvas { width: 46px; height: 46px; }
.chip[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 2px; }
.chip:disabled { opacity: 0.25; }
.chip .count {
  position: absolute;
  right: -6px;
  bottom: -4px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
}
/* 订单关目标条里的结构图 */
.goal-row { display: flex; align-items: center; gap: 10px; }
.goal-row canvas { flex: none; } /* 尺寸由画布自己的 style 定：一般 96×60，7 个原子以上 120×72 */
.goal-figs { display: flex; gap: 4px; flex: none; }
.level-bar .lesson { color: var(--ink-2); font-size: 13px; }
.fineprint .tag { margin-right: 4px; }
