:root {
  --ink: #2a2118;
  --paper: #fff6e4;
  --card: #fffdf7;
  --tomato: #e85d4c;
  --leaf: #2f8f6b;
  --sun: #f4c14b;
  --sky: #7ec8e3;
  --clay: #c9844a;
  --line: #2a2118;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Trebuchet MS", "PingFang HK", "Noto Sans TC", sans-serif;
  color: var(--ink);
  background: var(--paper);
  padding: 0 0 calc(88px + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }

.sky {
  position: fixed; inset: 0 0 auto 0; height: 160px;
  background: linear-gradient(#9ad4e8, transparent);
  pointer-events: none; z-index: 0;
}
.top {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 0;
}
.logo {
  display: flex; align-items: center; gap: 8px;
  background: none; border: 0; padding: 0; font-weight: 800; font-size: 1.25rem;
}
.soli { width: 46px; height: 46px; }
.tag {
  margin: 0; font-size: .72rem; font-weight: 700;
  background: #fff; border: 2px solid var(--ink); border-radius: 999px;
  padding: 4px 10px; transform: rotate(3deg);
}

#app { position: relative; z-index: 1; padding: 12px 16px 24px; max-width: 560px; margin: 0 auto; }

.hero {
  background: var(--sun);
  border: 3px solid var(--ink);
  border-radius: 28px 36px 24px 40px;
  padding: 18px 18px 16px;
  box-shadow: 6px 7px 0 var(--ink);
  margin: 8px 0 18px;
}
.hero h1 { margin: 0 0 6px; font-size: 1.55rem; line-height: 1.2; }
.hero p { margin: 0; font-size: .95rem; }

.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.chip {
  border: 2px solid var(--ink); background: #fff; border-radius: 999px;
  padding: 4px 10px; font-size: .78rem; font-weight: 700;
}

.stage {
  display: block; width: 100%; text-align: left;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 26px 18px 30px 22px;
  padding: 14px 14px 12px;
  margin: 0 0 12px;
  box-shadow: 4px 5px 0 var(--ink);
}
.stage:nth-child(2) { background: #ffe8a3; }
.stage:nth-child(3) { background: #ffd4c4; }
.stage:nth-child(4) { background: #c8efe0; }
.stage:nth-child(5) { background: #d7e9ff; }
.stage b { font-size: 1.15rem; }
.stage .meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stamp { font-size: 1.8rem; }
.bar { height: 10px; background: #efe3c8; border: 2px solid var(--ink); border-radius: 999px; margin-top: 10px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--leaf); width: 0; }

.search {
  width: 100%; border: 3px solid var(--ink); border-radius: 18px;
  padding: 12px 14px; background: #fff; font-size: 1rem;
  box-shadow: 3px 4px 0 var(--ink);
}
.filters { display: flex; gap: 8px; overflow: auto; padding: 10px 0 4px; -webkit-overflow-scrolling: touch; }
.filters button, .dock button, .btn {
  border: 2px solid var(--ink); background: #fff; border-radius: 14px; padding: 8px 12px; font-weight: 700;
}
.filters button.on { background: var(--tomato); color: #fff; }
.card {
  background: var(--card); border: 3px solid var(--ink); border-radius: 22px;
  padding: 12px; margin: 10px 0; box-shadow: 3px 4px 0 #d9c7a2;
}
.word { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.word h2 { margin: 0; font-size: 1.35rem; }
.ipa { margin: 2px 0 0; color: #6a5844; font-size: .82rem; }
.zh { margin: 6px 0 0; font-weight: 700; }
.ex { margin: 8px 0 0; padding: 8px 10px; background: #fff3d0; border-radius: 12px; border: 2px dashed var(--ink); }
.mic, .star {
  min-width: 44px; min-height: 44px; border-radius: 50%;
  border: 2px solid var(--ink); background: var(--sun); font-size: 1.1rem;
}
.star.on { background: var(--tomato); color: #fff; }
.tiny { font-size: .75rem; font-weight: 700; background: var(--sky); border: 2px solid var(--ink); border-radius: 8px; padding: 1px 6px; }

.talk { display: grid; gap: 8px; margin: 12px 0; }
.bubble {
  max-width: 88%; border: 2px solid var(--ink); border-radius: 18px; padding: 10px 12px; background: #fff;
}
.bubble.soli { background: #d8f3ea; }
.bubble.you { margin-left: auto; background: #ffe3b3; border-radius: 18px 18px 6px 18px; }
.bubble small { display: block; color: #5c4d3a; margin-top: 4px; }
.quiz { margin-top: 14px; }
.opt { display: block; width: 100%; text-align: left; margin: 8px 0; padding: 12px; border-radius: 16px; border: 2px solid var(--ink); background: #fff; }
.opt.ok { background: #b8ebc8; }
.opt.no { background: #ffc3b8; }
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 999px; font-size: .85rem; z-index: 5;
}

.badge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.badge { border: 3px solid var(--ink); border-radius: 20px; padding: 12px; text-align: center; background: #efe6d2; }
.badge.got { background: #fff3b0; box-shadow: 3px 4px 0 var(--ink); }
.badge .ico { font-size: 1.8rem; }

.dock {
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  background: #fffaf0; border: 3px solid var(--ink); border-radius: 22px;
  padding: 8px; z-index: 4; box-shadow: 4px 5px 0 var(--ink);
}
.dock button { padding: 10px 4px; font-size: .85rem; }
.dock button.on { background: var(--sun); }

body.gate { padding-bottom: 24px; }
body.gate .dock { display: none; }
#auth .search { margin-top: 0; }

.empty { text-align: center; padding: 28px 8px; }
.note { font-size: .8rem; color: #5d4d3c; }
.stage.lock { opacity: .55; box-shadow: none; }
.stage.today { background: #ffe08a; }
textarea.search { min-height: 140px; resize: vertical; line-height: 1.4; }
.hero .bar { margin-top: 12px; }
.clock {
  margin: 0; min-width: 64px; text-align: center;
  font-weight: 800; font-variant-numeric: tabular-nums;
  background: #fff; border: 2px solid var(--ink); border-radius: 999px;
  padding: 4px 10px;
}
.clock.low { background: var(--tomato); color: #fff; }
.top { gap: 8px; }
.skill-h { margin: 16px 0 8px; font-size: 1rem; }
