:root {
  --sky: #CDEDF8;
  --sea: #9FD4EF;
  --sea-deep: #7FC2E8;
  --sand: #F2DFA8;
  --sand-edge: #D8C08A;
  --deep: #0C447C;
  --ink: #1E3A5C;
  --teal: #0F6E56;
  --coral: #D85A30;
  --amber: #BA7517;
  --card: #FFFFFF;
  --ok: #2F9E44;
  --bad: #D64545;
  --muted: #5F7A94;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  background: linear-gradient(180deg, var(--sky) 0%, #BFE7F6 100%);
  color: var(--ink);
  min-height: 100vh;
}
#app { max-width: 780px; margin: 0 auto; padding-bottom: 76px; position: relative; }

.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px 8px;
}
.topbar .logo { font-size: 18px; font-weight: 700; color: var(--deep); }
.topbar .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.topbar .spacer { flex: 1; }
.res {
  display: flex; align-items: center; gap: 5px;
  background: var(--card); border: 1px solid #B5D4F4;
  border-radius: 999px; padding: 5px 12px; font-size: 14px; font-weight: 700; color: var(--amber);
}
.res svg { width: 16px; height: 16px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--teal); color: #fff; border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; cursor: pointer;
}
.night-banner {
  display: none; margin: 4px 18px; padding: 8px 14px;
  background: #293A5E; color: #DCE8FF; border-radius: 10px; font-size: 13px;
}
.night-banner.show { display: block; }

.task-bottle {
  margin: 6px 18px 10px; background: var(--card);
  border: 1px solid #B5D4F4; border-radius: var(--radius);
  padding: 12px 16px;
}
.task-bottle h3 { margin: 0 0 8px; font-size: 14px; color: var(--deep); }
.task-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 0; }
.task-row .dot { width: 8px; height: 8px; border-radius: 50%; background: #D3D1C7; }
.task-row.done .dot { background: var(--teal); }
.task-row .grow { flex: 1; }
.task-row .rw { color: var(--amber); font-weight: 700; }
.task-row button {
  border: none; background: var(--teal); color: #fff; border-radius: 8px;
  font-size: 12px; padding: 3px 10px; cursor: pointer;
}
.task-row button:disabled { background: #B4C6D6; cursor: default; }

.map-wrap { margin: 0 12px; position: relative; }
.map-svg { width: 100%; display: block; }
.island-g { cursor: pointer; }
.island-g.locked { cursor: default; }
.island-g:hover .isl-body { stroke-width: 2.5; }

.review-entry {
  margin: 10px 18px; display: flex; align-items: center; gap: 12px;
  background: linear-gradient(90deg, #FFF3DC, #FFE9C2);
  border: 1.5px solid var(--amber); border-radius: var(--radius);
  padding: 12px 16px; cursor: pointer;
}
.review-entry.locked { opacity: .55; }
.review-entry .big { font-size: 15px; font-weight: 700; color: #6B4A08; }
.review-entry .small { font-size: 12px; color: #8A6A2A; margin-top: 2px; }

.nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 780px; margin: 0 auto; z-index: 40;
  display: flex; background: var(--card); border-top: 1px solid #C9DEEF;
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
}
.nav button {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; color: var(--muted); padding: 4px 0;
}
.nav button svg { width: 22px; height: 22px; }
.nav button.active { color: var(--teal); font-weight: 700; }
.nav .dot-badge {
  position: absolute; margin-top: -6px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--coral);
}

.modal-mask {
  position: fixed; inset: 0; background: rgba(12, 68, 124, .45);
  z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.top { z-index: 95; }
.modal {
  background: var(--card); border-radius: 18px; max-width: 560px; width: 100%;
  max-height: 82vh; overflow: auto; padding: 18px 20px;
}
.modal h2 { margin: 0 0 4px; font-size: 17px; color: var(--deep); }
.modal .sub { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.sec-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid #E3EDF6; border-radius: 12px; margin-bottom: 8px;
}
.sec-row.locked { opacity: .5; }
.sec-row .info { flex: 1; }
.sec-row .name { font-size: 14px; font-weight: 700; color: var(--deep); }
.sec-row .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sec-row .go {
  border: none; background: var(--teal); color: #fff; border-radius: 10px;
  padding: 8px 14px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.sec-row .go:disabled { background: #B4C6D6; }
.star-row svg { width: 16px; height: 16px; }

.btn {
  border: none; border-radius: 12px; padding: 11px 20px;
  font-size: 15px; font-weight: 700; cursor: pointer;
  background: var(--teal); color: #fff;
}
.btn.secondary { background: #E3EDF6; color: var(--deep); }
.btn.warn { background: var(--coral); }
.btn:disabled { opacity: .5; cursor: default; }

.play-overlay {
  position: fixed; inset: 0; z-index: 80; overflow: auto;
  background: linear-gradient(180deg, var(--sky), #BFE7F6);
}
.play-head {
  max-width: 780px; margin: 0 auto; padding: 14px 18px 4px;
  display: flex; align-items: center; gap: 10px;
}
.play-head .quit { border: none; background: none; color: var(--deep); font-size: 20px; cursor: pointer; line-height: 1; }
.play-head .title { font-size: 14px; font-weight: 700; color: var(--deep); flex: 1; }
.play-head .combo { font-size: 13px; font-weight: 700; color: var(--coral); }
.play-head .timer { font-size: 13px; font-weight: 700; color: var(--deep); }
.dots { display: flex; gap: 6px; max-width: 780px; margin: 6px auto; padding: 0 20px; }
.dots i {
  flex: 1; height: 7px; border-radius: 4px; background: #CFE4F2;
}
.dots i.ok { background: var(--ok); }
.dots i.bad { background: var(--bad); }
.dots i.cur { background: var(--deep); }

.qcard {
  max-width: 640px; margin: 14px auto; background: var(--card);
  border-radius: 18px; padding: 22px 24px; min-height: 130px;
  box-shadow: 0 4px 18px rgba(12,68,124,.08);
}
.qcard .qtype { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.qcard .qtext { font-size: 17px; line-height: 1.7; color: var(--ink); }
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 3px; font-size: .85em; }
.frac > span:first-child { border-bottom: 1.5px solid currentColor; padding: 0 4px; }
.frac > span:last-child { padding: 0 4px; }

.opts { max-width: 640px; margin: 0 auto 8px; display: grid; gap: 10px; padding: 0 8px; }
.opt {
  text-align: left; border: 1.5px solid #C9DEEF; background: var(--card);
  border-radius: 14px; padding: 13px 16px; font-size: 15px; color: var(--ink);
  cursor: pointer; display: flex; align-items: center; gap: 10px;
}
.opt .tag {
  width: 26px; height: 26px; border-radius: 8px; background: #E3EDF6; color: var(--deep);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none;
}
.opt.sel { border-color: var(--deep); background: #EEF6FC; }
.opt.right { border-color: var(--ok); background: #EAF6EC; }
.opt.wrong { border-color: var(--bad); background: #FBEAEA; }
.opt:disabled { cursor: default; }

.input-zone { max-width: 640px; margin: 0 auto; padding: 0 8px; display: flex; gap: 10px; }
.input-zone input {
  flex: 1; font-size: 17px; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid #C9DEEF; outline: none; color: var(--ink); background: var(--card);
}
.input-zone input:focus { border-color: var(--deep); }

.judge-zone { max-width: 640px; margin: 0 auto; padding: 0 8px; display: flex; gap: 12px; }
.judge-zone .btn { flex: 1; }
.judge-zone .btn.true { background: var(--ok); }
.judge-zone .btn.false { background: var(--bad); }

.feedback {
  max-width: 640px; margin: 12px auto 0; padding: 0 8px;
}
.fb-card { border-radius: 14px; padding: 14px 16px; font-size: 14px; line-height: 1.6; }
.fb-card.ok { background: #EAF6EC; border: 1.5px solid var(--ok); color: #1E5B2A; }
.fb-card.bad { background: #FBEAEA; border: 1.5px solid var(--bad); color: #7A2A2A; }
.play-actions { max-width: 640px; margin: 14px auto 40px; padding: 0 8px; display: flex; gap: 12px; }
.play-actions .btn { flex: 1; padding: 13px; }

.result-wrap { max-width: 520px; margin: 40px auto; text-align: center; padding: 0 16px; }
.result-wrap h1 { font-size: 22px; color: var(--deep); }
.stars-big { display: flex; justify-content: center; gap: 10px; margin: 18px 0; }
.stars-big svg { width: 52px; height: 52px; }
.result-stats { display: flex; gap: 12px; justify-content: center; margin: 14px 0 22px; }
.result-stats .stat {
  background: var(--card); border-radius: 12px; padding: 10px 18px; min-width: 90px;
}
.result-stats .num { font-size: 20px; font-weight: 700; color: var(--deep); }
.result-stats .lbl { font-size: 12px; color: var(--muted); }

.list-wrap { max-width: 640px; margin: 0 auto; padding: 4px 18px 20px; }
.list-wrap h2 { font-size: 16px; color: var(--deep); }
.mist-item {
  background: var(--card); border: 1px solid #E3EDF6; border-radius: 14px;
  padding: 12px 14px; margin-bottom: 10px; font-size: 14px;
}
.mist-item .m-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.mist-item .m-sec { font-size: 12px; color: var(--muted); }
.mist-item .m-state { font-size: 12px; font-weight: 700; border-radius: 8px; padding: 2px 8px; }
.mist-item .m-state.w0 { background: #FBEAEA; color: var(--bad); }
.mist-item .m-state.w1 { background: #FFF3DC; color: var(--amber); }
.mist-item .m-state.w2 { background: #EAF6EC; color: var(--ok); }
.mist-item .redo {
  margin-top: 8px; border: none; background: var(--deep); color: #fff;
  border-radius: 8px; padding: 6px 12px; font-size: 12px; cursor: pointer;
}
.empty-tip { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 0; }

.pet-zone { display: flex; gap: 16px; align-items: center; background: var(--card); border-radius: 16px; padding: 16px; border: 1px solid #E3EDF6; }
.pet-zone .pet-img { width: 110px; flex: none; }
.pet-zone .pet-name { font-size: 15px; font-weight: 700; color: var(--deep); }
.pet-zone .pet-form { font-size: 12px; color: var(--amber); margin: 2px 0 8px; }
.xp-bar { height: 10px; border-radius: 6px; background: #E3EDF6; overflow: hidden; }
.xp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #45B97C, #2F9E44); }
.pet-zone .feed-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.badge-cell {
  background: var(--card); border: 1px solid #E3EDF6; border-radius: 12px;
  padding: 12px 8px; text-align: center;
}
.badge-cell.off { opacity: .45; filter: grayscale(1); }
.badge-cell svg { width: 34px; height: 34px; }
.badge-cell .b-name { font-size: 12px; font-weight: 700; color: var(--deep); margin-top: 6px; }
.badge-cell .b-cond { font-size: 11px; color: var(--muted); margin-top: 2px; }
.week-bars { display: flex; align-items: flex-end; gap: 8px; height: 90px; padding: 10px 4px 0; }
.week-bars .wb { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.week-bars .bar { width: 100%; max-width: 30px; border-radius: 6px 6px 0 0; background: var(--sea-deep); min-height: 3px; }
.week-bars .bar.today { background: var(--teal); }
.week-bars .w-lbl { font-size: 10px; color: var(--muted); }
.week-bars .w-val { font-size: 10px; color: var(--deep); }
.set-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #EEF4F9; font-size: 14px; }
.set-row .grow { flex: 1; }
.set-row input[type=range] { width: 150px; }
.set-row select { padding: 6px; border-radius: 8px; border: 1px solid #C9DEEF; }
.set-row .val { font-weight: 700; color: var(--deep); min-width: 56px; text-align: right; }

.lock-screen {
  position: fixed; inset: 0; z-index: 90; background: linear-gradient(180deg, #12365E, #0C447C);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.lock-card { background: var(--card); border-radius: 20px; padding: 28px 26px; max-width: 440px; width: 100%; text-align: center; }
.lock-card h2 { margin: 0 0 8px; color: var(--deep); font-size: 19px; }
.lock-card p { font-size: 14px; color: var(--muted); line-height: 1.7; margin: 6px 0; }
.gate-row { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.gate-row input { width: 90px; font-size: 17px; padding: 9px; border-radius: 10px; border: 1.5px solid #C9DEEF; text-align: center; }
.break-ring { width: 130px; height: 130px; margin: 12px auto; position: relative; }
.break-ring svg { width: 100%; height: 100%; }
.break-ring .mid { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; color: var(--teal); font-size: 22px; }
.break-ring .mid small { font-size: 11px; color: var(--muted); font-weight: 400; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: rgba(15, 110, 86, .95); color: #fff; font-size: 14px;
  border-radius: 999px; padding: 9px 20px; z-index: 100; pointer-events: none;
  animation: toastIn .25s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(8px); } }
@keyframes popIn { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.pop { animation: popIn .3s ease; }
@keyframes floatUp { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-26px); opacity: 0; } }
.float-up { position: absolute; animation: floatUp 1s ease forwards; color: var(--amber); font-weight: 700; }
@keyframes swim { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.swim { animation: swim 2.2s ease-in-out infinite; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
.shake { animation: shake .3s ease; }
@media (prefers-reduced-motion: reduce) { .swim, .pop, .float-up { animation: none; } }
