:root {
  --navy-900: #16293f;
  --navy-800: #1e3a5f;
  --navy-700: #2a4d7a;
  --navy-100: #e8eef6;
  --gold: #ffc72c;
  --gold-dark: #e0ac12;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1c2733;
  --muted: #5d6b7a;
  --line: #dfe6ee;
  --good: #2e8b57;
  --warn: #d97b06;
  --bad: #c0392b;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(22, 41, 63, 0.08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: 84px; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 8px; }
h1 { font-size: 22px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0 0 10px; }
ul { margin: 0 0 10px; padding-left: 20px; }
li { margin-bottom: 6px; }
small { color: var(--muted); }

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(160deg, var(--navy-800), var(--navy-900));
  color: #fff;
  padding: 14px 16px 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar .title { font-weight: 700; font-size: 17px; }
.topbar .sub { font-size: 12px; opacity: 0.75; }

.page { padding: 14px 14px 8px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
}
.card.tap:active { transform: scale(0.985); }

.hero {
  background: linear-gradient(150deg, var(--navy-700), var(--navy-900));
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 12px;
}
.hero h1 { color: var(--gold); margin-bottom: 6px; }
.hero p { opacity: 0.9; font-size: 14px; margin-bottom: 0; }

.badge {
  display: inline-block;
  background: var(--navy-100);
  color: var(--navy-800);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  margin: 0 6px 6px 0;
}
.badge.gold { background: var(--gold); color: var(--navy-900); }

.btn {
  display: inline-block;
  background: var(--navy-800);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
}
.btn:active { transform: scale(0.98); }
.btn.gold { background: var(--gold); color: var(--navy-900); }
.btn.ghost {
  background: transparent; color: var(--navy-800);
  border: 1.5px solid var(--navy-800);
}
.btn.small { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn.wide { display: block; width: 100%; }
.btn:disabled { opacity: 0.45; cursor: default; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.stat { text-align: center; padding: 12px 6px; }
.stat .num { font-size: 26px; font-weight: 800; color: var(--navy-800); }
.stat .lbl { font-size: 12px; color: var(--muted); }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  z-index: 60;
  max-width: 560px;
  margin: 0 auto;
}
.tab {
  flex: 1;
  text-align: center;
  padding: 6px 2px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: none; border: none; font-family: inherit;
}
.tab .ico { font-size: 20px; display: block; margin-bottom: 2px; }
.tab.active { color: var(--navy-800); background: var(--navy-100); }

.quiz-q { margin-bottom: 16px; }
.quiz-q .q { font-weight: 600; margin-bottom: 10px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  text-align: left;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
}
.opt.sel { border-color: var(--navy-800); background: var(--navy-100); font-weight: 600; }
.opt:active { border-color: var(--navy-700); }

.progress { height: 6px; background: var(--navy-100); border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
.progress .fill { height: 100%; background: var(--gold); transition: width 0.25s; }

.score-big { text-align: center; padding: 8px 0 2px; }
.score-big .num { font-size: 44px; font-weight: 800; color: var(--navy-800); }
.score-big .of { color: var(--muted); font-size: 14px; }
.level-label { text-align: center; font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.level-label.l-good { color: var(--good); }
.level-label.l-mid { color: var(--warn); }
.level-label.l-low { color: var(--bad); }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.bar-row .name { flex: 0 0 118px; color: var(--muted); }
.bar-row .track { flex: 1; height: 10px; background: var(--navy-100); border-radius: 999px; overflow: hidden; }
.bar-row .val { flex: 0 0 44px; text-align: right; font-weight: 700; color: var(--navy-800); }

.check-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: none; }
.check-row input[type=checkbox] {
  width: 22px; height: 22px; margin-top: 2px;
  accent-color: var(--navy-800);
  flex: 0 0 22px;
}
.check-row .t { font-size: 14px; }
.check-row .t .tt { font-weight: 700; }
.check-row .t .dd { color: var(--muted); font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: 999px; padding: 7px 14px;
  font-size: 13px; font-weight: 600; color: var(--muted);
  font-family: inherit; cursor: pointer;
}
.chip.active { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }

textarea, select, input[type=text], input[type=number] {
  width: 100%;
  font-family: inherit; font-size: 15px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}
textarea { min-height: 90px; resize: vertical; }
select { appearance: none; -webkit-appearance: none; }

.entry { border-left: 3px solid var(--gold); padding-left: 10px; margin-bottom: 12px; }
.entry .date { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }

.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); }

.notice {
  background: #fff8e6;
  border: 1px solid #f2ddad;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: #7a5b12;
  margin-bottom: 12px;
}

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: var(--navy-900); color: #fff;
  padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  z-index: 100; box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  animation: fadein 0.2s;
}
@keyframes fadein { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }

.empty { text-align: center; color: var(--muted); padding: 30px 16px; font-size: 14px; }
.back {
  background: none; border: none; color: #fff; font-family: inherit;
  font-size: 20px; padding: 0 8px 0 0; cursor: pointer;
}

@media (min-width: 700px) {
  body { background: var(--navy-100); }
  #app { background: var(--bg); box-shadow: 0 0 40px rgba(22,41,63,0.12); }
}
