/* Keystone v1 — dark, mobile-first, no external assets. */
:root {
  --bg: #0b0e14;
  --surface: #141926;
  --surface-2: #1b2233;
  --border: #2a3348;
  --text: #e8ecf4;
  --muted: #9aa5bb;
  --accent: #f5c542;
  --accent-ink: #1a1405;
  --green: #3fce8f;
  --red: #ff6b6b;
  --amber: #ffb454;
  --blue: #6ea8fe;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin: 6px 0 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 110px; resize: vertical; }
label { font-size: 14px; color: var(--muted); display: block; margin-top: 10px; }
h1 { font-size: 26px; margin: 0 0 6px; }
h2 { font-size: 19px; margin: 22px 0 8px; }
h3 { font-size: 16px; margin: 16px 0 6px; }
p { margin: 6px 0 10px; }
small, .muted { color: var(--muted); font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; }
.hidden { display: none !important; }

.app { max-width: 640px; margin: 0 auto; padding: 16px 16px 96px; min-height: 100vh; }
header.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 2px 14px; border-bottom: 1px solid var(--border); margin-bottom: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; background: var(--accent);
  color: var(--accent-ink); font-weight: 800; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.brand-name { font-weight: 800; letter-spacing: .04em; font-size: 18px; }
.brand-sub { font-size: 12px; color: var(--muted); }

.btn {
  display: inline-block; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); border-radius: 10px; padding: 11px 16px; cursor: pointer;
  text-decoration: none; text-align: center; font-weight: 600;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-danger { background: #3a1620; border-color: #6b2233; color: #ffb3b3; }
.btn-ghost { background: transparent; }
.btn-block { display: block; width: 100%; margin: 8px 0; }
.btn-small { padding: 7px 10px; font-size: 14px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin: 12px 0;
}
.notice {
  background: #2a2113; border: 1px solid #6b5518; border-radius: 12px;
  padding: 13px 14px; margin: 12px 0; font-size: 14px;
}
.notice.red { background: #33161c; border-color: #6b2233; }
.notice.green { background: #122b20; border-color: #1f5c40; }
.notice.blue { background: #14233d; border-color: #274b7a; }
.inline-status { font-size: 14px; margin: 6px 0; min-height: 20px; }
.ok { color: var(--green); } .bad { color: var(--red); } .warn { color: var(--amber); }

.score-ring { display: flex; align-items: center; gap: 16px; }
.score-num { font-size: 44px; font-weight: 800; line-height: 1; }
.score-num small { font-size: 18px; color: var(--muted); }
.shortcut-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.shortcut {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; text-align: left; cursor: pointer; color: var(--text);
}
.shortcut b { display: block; font-size: 15px; }
.shortcut span { font-size: 13px; color: var(--muted); }

.item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 13px 14px; margin: 10px 0;
}
.item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.item-title { font-weight: 700; }
.item-meta { font-size: 13px; color: var(--muted); word-break: break-all; }
.item-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.pw-row { display: flex; align-items: center; gap: 8px; }
.pw-row code { font-size: 15px; }
.tag {
  display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 3px 7px; color: var(--muted); margin-left: 6px; vertical-align: middle;
}

.code-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; margin: 10px 0;
}
.code-digits { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 28px; letter-spacing: .12em; font-weight: 700; }
.progress { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.progress > div { height: 100%; background: var(--accent); }
.skill-row, .lesson, .check-row {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px; margin: 10px 0;
}
.skill-row b, .lesson b { display: block; }
.skill-row p, .lesson p { margin: 3px 0 0; font-size: 14px; color: var(--muted); }
.switch { margin-left: auto; flex-shrink: 0; }
.switch input { width: 52px; height: 30px; accent-color: var(--accent); margin: 0; padding: 0; }
.check-row .mark { font-size: 20px; flex-shrink: 0; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(11, 14, 20, .97); border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; padding: 6px 2px calc(8px + env(safe-area-inset-bottom));
}
.bottom-nav button {
  background: none; border: none; color: var(--muted); font-size: 11px;
  padding: 6px 2px; cursor: pointer; flex: 1; min-width: 0;
}
.bottom-nav button .nav-ico { display: block; font-size: 19px; line-height: 1.2; }
.bottom-nav button.active { color: var(--accent); }
.lock-screen { text-align: center; padding-top: 28px; }
.lock-screen .brand-mark { width: 64px; height: 64px; font-size: 34px; margin: 0 auto 12px; }
.footer-links { margin-top: 22px; font-size: 14px; }
.footer-links button {
  background: none; border: none; color: var(--accent); cursor: pointer;
  padding: 6px 8px; font-size: 14px; text-decoration: underline;
}
.info-page { padding-bottom: 96px; }
.meter { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.meter > div { height: 100%; background: var(--red); }
.meter > div.mid { background: var(--amber); }
.meter > div.strong { background: var(--green); }
.flag { border-left: 3px solid var(--amber); padding: 8px 12px; background: var(--surface); border-radius: 0 8px 8px 0; margin: 8px 0; font-size: 14px; }
.flag.red { border-color: var(--red); }
.flag.green { border-color: var(--green); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.kv:last-child { border-bottom: none; }
@media (min-width: 520px) { .app { padding-left: 24px; padding-right: 24px; } }
