:root {
  --ground: #F2F4EF;
  --card: #FFFFFF;
  --ink: #1E2621;
  --muted: #5B6660;
  --line: #D3D9CF;
  --moss: #3F6B4E;
  --moss-soft: #E4ECE2;
  --sage: #9DBBA4;
  --apricot: #F0BE9C;
  --apricot-soft: #F6DCC8;
  --apricot-ink: #6B3A1C;
  --mist: #B9C4CE;
  --empty: #E6EAE3;
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --sans: -apple-system, "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--sans); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
main {
  max-width: 480px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 24px) 20px calc(env(safe-area-inset-bottom) + 96px);
  display: flex; flex-direction: column; gap: 18px;
}
h1 { margin: 0; font-family: var(--serif); font-size: 28px; font-weight: 700; line-height: 1.3; }
p { margin: 0; }
.small { font-size: 13px; color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--card); border-radius: 22px; padding: 18px; }
.soft { background: var(--moss-soft); border-radius: 20px; padding: 14px 16px; }
.big { font-family: var(--serif); font-size: 20px; font-weight: 700; line-height: 1.5; }
.quote { font-family: var(--serif); font-size: 17px; line-height: 1.7; }
.tag { font-size: 12px; border-radius: 10px; padding: 3px 10px; background: var(--moss-soft); color: var(--moss); }
.tag.warm { background: var(--apricot-soft); color: var(--apricot-ink); }

button, .btn {
  font-family: var(--sans); font-size: 16px; font-weight: 500;
  min-height: 52px; border-radius: 26px; border: none; padding: 0 20px;
  background: var(--moss); color: #fff; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s ease, opacity .2s;
}
button:active { transform: scale(.97); }
button:disabled { opacity: .5; }
.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.plain { background: transparent; color: var(--muted); font-size: 14px; min-height: 44px; }
.warm { background: var(--apricot-soft); color: var(--apricot-ink); }
.dark { background: var(--ink); color: #fff; }
.grow { flex: 1; }
.choice {
  width: 100%; justify-content: flex-start; text-align: left; background: var(--card);
  color: var(--ink); border: 1.5px solid var(--line); border-radius: 18px; font-size: 15px; font-weight: 400;
}
.choice[aria-pressed="true"] { border: 2px solid var(--moss); background: var(--moss-soft); font-weight: 500; }

textarea, input[type=text], input[type=password] {
  width: 100%; font-family: var(--sans); font-size: 16px; line-height: 1.6; color: var(--ink);
  background: var(--card); border: 1.5px solid #C9D3C6; border-radius: 16px; padding: 12px 14px; resize: none;
}
textarea:focus, input:focus { outline: 2px solid var(--moss); outline-offset: 1px; }
label { font-size: 14px; font-weight: 700; }

.ring { position: relative; width: 236px; height: 236px; margin: 0 auto; }
.ring svg { width: 236px; height: 236px; }
.ring .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.ring .num { font-family: var(--serif); font-size: 30px; font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 10px; height: 10px; border-radius: 5px; display: inline-block; }

.timer { position: relative; width: 190px; height: 190px; margin: 6px auto; }
.timer svg { width: 190px; height: 190px; transform: rotate(-90deg); }
.timer .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.timer .num { font-family: var(--serif); font-size: 42px; font-weight: 700; font-variant-numeric: tabular-nums; }

.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tile { border-radius: 18px; padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; }
.tile .n { font-family: var(--serif); font-size: 22px; font-weight: 700; }

.door { background: var(--card); border-radius: 20px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; border: none; width: 100%; text-align: left; color: var(--ink); min-height: 0; font-weight: 400; }
.door b { font-size: 15px; }
.door span { font-size: 13px; color: #3E4A43; }
.setting { display: flex; align-items: center; justify-content: space-between; min-height: 52px; border-bottom: 1px solid var(--empty); font-size: 14px; }
.setting:last-child { border-bottom: none; }
.round { width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 18px; background: #fff; color: var(--ink); border: 1.5px solid #C9D0C6; }

.drop { animation: pop .5s cubic-bezier(.2, 1.4, .4, 1) both; }
.drop:nth-child(2) { animation-delay: .12s; }
.drop:nth-child(3) { animation-delay: .24s; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.8); } to { opacity: 1; transform: none; } }
.fade { animation: fade .35s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

#nav {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around;
  padding: 10px 0 calc(env(safe-area-inset-bottom) + 10px); background: rgba(242, 244, 239, .92);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--empty);
}
#nav a { color: var(--muted); text-decoration: none; font-size: 13px; padding: 8px 18px; min-height: 44px; display: flex; align-items: center; }
#nav a.on { color: var(--ink); font-weight: 700; }
#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 84px); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 14px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .25s; max-width: 86vw;
}
#toast.show { opacity: 1; }
