/* Shiatsuna – Oberfläche. Systemschriften, damit alles offline funktioniert. */

:root{
  --paper:#F1F4F1; --surface:#FFFFFF; --surface-2:#E6ECE8; --sunken:#DFE7E2;
  --ink:#16211E; --ink-2:#4A5B56; --ink-3:#7C8C86;
  --line:#D3DDD8; --line-2:#C0CDC7;
  --accent:#1F6B58; --accent-ink:#FFFFFF; --accent-soft:#DCEDE6;
  --ok:#2E7D5B; --bad:#B33A2E; --warn:#A87A1E;
  --wasser:#2B4C7E; --holz:#3E7C4A; --feuer:#B33A2E; --erde:#A87A1E; --metall:#6F7C89;
  --grundlagen:#1F6B58; --pathologie:#7A4A8C; --praxis:#B06A3B; --anatomie:#4A6572; --eigene:#556B2F;
  --shadow:0 1px 2px rgba(22,33,30,.06), 0 6px 20px rgba(22,33,30,.06);
  --r:14px; --tap:44px;
  --sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono:ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --paper:#0F1816; --surface:#17221F; --surface-2:#1E2B27; --sunken:#131D1A;
    --ink:#E9F0EC; --ink-2:#A6B6B0; --ink-3:#7A8A85;
    --line:#293733; --line-2:#35453F;
    --accent:#63C0A3; --accent-ink:#0F1816; --accent-soft:#1A322B;
    --ok:#63C0A3; --bad:#E0796A; --warn:#D6AC53;
    --wasser:#7098CE; --holz:#74B47B; --feuer:#E0796A; --erde:#D6AC53; --metall:#A6B2BE;
    --grundlagen:#63C0A3; --pathologie:#B98FD0; --praxis:#DA9A6A; --anatomie:#8CA6B4; --eigene:#A3B86B;
    --shadow:0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.32);
  }
}
:root[data-theme="dark"]{
  --paper:#0F1816; --surface:#17221F; --surface-2:#1E2B27; --sunken:#131D1A;
  --ink:#E9F0EC; --ink-2:#A6B6B0; --ink-3:#7A8A85;
  --line:#293733; --line-2:#35453F;
  --accent:#63C0A3; --accent-ink:#0F1816; --accent-soft:#1A322B;
  --ok:#63C0A3; --bad:#E0796A; --warn:#D6AC53;
  --wasser:#7098CE; --holz:#74B47B; --feuer:#E0796A; --erde:#D6AC53; --metall:#A6B2BE;
  --grundlagen:#63C0A3; --pathologie:#B98FD0; --praxis:#DA9A6A; --anatomie:#8CA6B4; --eigene:#A3B86B;
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.32);
}

*{box-sizing:border-box; -webkit-tap-highlight-color:transparent}
[hidden]{display:none !important}
html,body{height:100%}
body{
  margin:0; background:var(--paper); color:var(--ink);
  font-family:var(--sans); font-size:16px; line-height:1.5;
  -webkit-font-smoothing:antialiased; overscroll-behavior-y:none;
}
h1,h2,h3,h4{margin:0; line-height:1.2; text-wrap:balance; letter-spacing:-.01em}
button{font:inherit; color:inherit}
a{color:var(--accent)}
:focus-visible{outline:2px solid var(--accent); outline-offset:2px; border-radius:8px}

/* ---------- Grundgerüst ---------- */
#app{
  display:flex; flex-direction:column; min-height:100dvh;
  max-width:760px; margin:0 auto; background:var(--paper);
}
header.bar{
  position:sticky; top:0; z-index:20; background:var(--surface);
  border-bottom:1px solid var(--line);
  padding:calc(env(safe-area-inset-top) + 10px) 16px 10px;
  display:flex; align-items:center; gap:12px; min-height:52px;
}
header.bar h1{font-size:19px; font-weight:600; flex:1; min-width:0;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
header.bar .sub{font-family:var(--mono); font-size:11.5px; color:var(--ink-3); white-space:nowrap}
.iconbtn{
  background:none; border:0; padding:8px; margin:-8px; cursor:pointer; color:var(--ink-2);
  font-size:18px; line-height:1; min-width:var(--tap); min-height:var(--tap);
  display:grid; place-items:center; border-radius:10px;
}
.iconbtn:active{background:var(--surface-2)}

main{flex:1; padding:16px 16px 24px; display:flex; flex-direction:column; gap:14px}
nav.tabs{
  position:sticky; bottom:0; z-index:20; display:grid; grid-template-columns:repeat(5,1fr);
  background:var(--surface); border-top:1px solid var(--line);
  padding-bottom:env(safe-area-inset-bottom);
}
nav.tabs button{
  background:none; border:0; cursor:pointer; padding:8px 2px 9px;
  display:flex; flex-direction:column; align-items:center; gap:2px;
  font-size:10.5px; font-family:var(--mono); color:var(--ink-3); letter-spacing:.01em;
}
nav.tabs button span{font-size:17px; line-height:1.05}
nav.tabs button[aria-current="page"]{color:var(--accent); box-shadow:inset 0 2px 0 var(--accent)}

/* ---------- Bausteine ---------- */
.card{background:var(--surface); border:1px solid var(--line); border-radius:var(--r); padding:15px}
.tile{background:var(--sunken); border-radius:12px; padding:13px 15px}
.row{display:flex; align-items:center; justify-content:space-between; gap:12px}
.col{display:flex; flex-direction:column; gap:12px}
.lbl{font-family:var(--mono); font-size:11px; letter-spacing:.1em; text-transform:uppercase; color:var(--ink-3)}
.sm{font-size:14px; color:var(--ink-2)}
.xs{font-size:12.5px; color:var(--ink-3)}
.big{font-size:34px; font-weight:700; letter-spacing:-.02em; font-variant-numeric:tabular-nums; line-height:1}
.muted{color:var(--ink-3)}
.center{text-align:center}
.grow{flex:1}
.hidden{display:none !important}

.btn{
  display:block; width:100%; padding:13px 16px; border-radius:12px; border:0;
  background:var(--accent); color:var(--accent-ink); font-weight:600; font-size:16px;
  cursor:pointer; min-height:var(--tap); text-align:center;
}
.btn:active{filter:brightness(.94)}
.btn[disabled]{opacity:.45; cursor:default}
.btn.ghost{background:transparent; color:var(--ink-2); border:1px solid var(--line-2)}
.btn.small{padding:9px 12px; font-size:14px; font-weight:500}
.btnrow{display:flex; gap:10px}
.btnrow .btn{flex:1}

.chip{
  display:inline-flex; align-items:center; gap:7px; padding:8px 13px; border-radius:999px;
  border:1px solid var(--line-2); background:var(--surface); color:var(--ink-2);
  font-size:14px; cursor:pointer; user-select:none; min-height:38px;
}
.chip .box{width:15px; height:15px; border-radius:5px; border:1.5px solid var(--line-2);
  display:grid; place-items:center; flex:none}
.chip.on{border-color:currentColor; background:var(--accent-soft)}
.chip.on .box{background:currentColor; border-color:currentColor}
.chip.on .box::after{content:"✓"; color:var(--surface); font-size:10px; font-weight:700; line-height:1}
.chips{display:flex; flex-wrap:wrap; gap:8px}

.dot{width:10px; height:10px; border-radius:50%; display:inline-block; flex:none}
.bar-track{height:8px; border-radius:5px; background:var(--surface-2); overflow:hidden}
.bar-track > i{display:block; height:100%; border-radius:5px; background:var(--accent)}

input[type=text], input[type=password], input[type=search], textarea, select{
  width:100%; padding:12px 14px; border-radius:12px; border:1px solid var(--line-2);
  background:var(--surface); color:var(--ink); font:inherit; min-height:var(--tap);
}
textarea{min-height:110px; resize:vertical; line-height:1.5}

/* ---------- Heute ---------- */
.heat{display:grid; grid-template-columns:repeat(5,1fr); gap:6px}
.heat button{border:0; border-radius:10px; padding:11px 4px; cursor:pointer; color:#fff}
.heat .n{font-family:var(--mono); font-size:15px; font-weight:600}
.heat .e{font-size:10.5px; opacity:.9}
.heat2{grid-template-columns:repeat(4,1fr)}
.spark{display:flex; align-items:flex-end; gap:3px; height:38px}
.spark i{flex:1; max-width:14px; background:var(--accent); border-radius:2px 2px 0 0; min-height:2px; opacity:.75}
.spark{justify-content:flex-start}

/* ---------- Lernkarte ---------- */
.face{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r);
  padding:22px 18px; min-height:210px; display:flex; flex-direction:column;
  justify-content:center; gap:12px; cursor:pointer;
}
.face .q{font-size:21px; font-weight:600; line-height:1.3}
.face .a{font-size:17px; line-height:1.5; border-top:1px solid var(--line); padding-top:14px}
.face .x{font-size:14.5px; color:var(--ink-2); line-height:1.5}
.grade{display:grid; grid-template-columns:repeat(4,1fr); gap:8px}
.grade button{
  padding:11px 3px; border-radius:12px; border:1px solid var(--line-2); background:var(--surface);
  cursor:pointer; font-family:var(--mono); font-size:11px; color:var(--ink-3); line-height:1.35;
  min-height:var(--tap);
}
.grade button b{display:block; font-family:var(--sans); font-size:14px; color:var(--ink); font-weight:600}

/* ---------- Quiz ---------- */
.opt{
  display:flex; gap:11px; align-items:flex-start; width:100%; text-align:left;
  border:1px solid var(--line); border-radius:12px; padding:13px 14px; background:var(--surface);
  cursor:pointer; font-size:15.5px; line-height:1.4; min-height:var(--tap);
}
.opt .k{font-family:var(--mono); font-size:12px; color:var(--ink-3); padding-top:2px; flex:none}
.opt.sel{border-color:var(--accent); background:var(--accent-soft)}
.opt.right{border-color:var(--ok); background:color-mix(in srgb, var(--ok) 12%, transparent)}
.opt.wrong{border-color:var(--bad); background:color-mix(in srgb, var(--bad) 10%, transparent)}
.opt[disabled]{cursor:default}
.why{border-left:3px solid var(--accent); background:var(--accent-soft);
  padding:12px 14px; border-radius:0 10px 10px 0; font-size:14.5px; line-height:1.5}
.src{font-family:var(--mono); font-size:11px; color:var(--ink-3); margin-top:8px}

.pairs{display:flex; flex-direction:column; gap:8px}
.pair{display:grid; grid-template-columns:1fr 1fr; gap:8px; align-items:center}
.pair .l{font-size:14.5px; font-weight:600}
.pair select{min-height:40px; padding:8px 10px}

/* ---------- Doku ---------- */
.hit{border:1px solid var(--line); border-radius:12px; padding:13px 14px; background:var(--surface);
  display:flex; flex-direction:column; gap:5px; cursor:pointer; text-align:left; width:100%}
.hit b{font-size:14.5px; font-weight:600}
.hit .t{font-size:14px; color:var(--ink-2); line-height:1.45}
.hit.derived{opacity:.75}
mark{background:color-mix(in srgb, var(--erde) 34%, transparent); color:inherit; border-radius:3px; padding:0 2px}
.doctext{font-size:16px; line-height:1.6; white-space:pre-wrap; word-wrap:break-word}
.page-img{width:100%; border-radius:10px; border:1px solid var(--line); background:var(--surface-2)}

/* ---------- Ablauf ---------- */
.step{display:flex; gap:11px; align-items:flex-start; font-size:15px; line-height:1.45; padding:3px 0}
.step .n{font-family:var(--mono); font-size:11px; width:23px; height:23px; flex:none; border-radius:50%;
  border:1px solid var(--line-2); display:grid; place-items:center; color:var(--ink-3)}
.step.done .n{background:var(--accent); border-color:var(--accent); color:var(--accent-ink)}
.step.now .n{border-color:var(--accent); color:var(--accent); font-weight:700}
.step.now{font-weight:600}
.step.todo{color:var(--ink-3)}

/* ---------- Listen ---------- */
.list{display:flex; flex-direction:column; gap:1px; background:var(--line);
  border:1px solid var(--line); border-radius:var(--r); overflow:hidden}
.list > button, .list > a{
  background:var(--surface); border:0; padding:14px 15px; text-align:left; cursor:pointer;
  display:flex; align-items:center; gap:11px; font-size:15.5px; color:inherit; text-decoration:none;
  min-height:var(--tap);
}
.list > button:active{background:var(--surface-2)}
.list .meta{margin-left:auto; font-family:var(--mono); font-size:11.5px; color:var(--ink-3)}

.pill{font-family:var(--mono); font-size:10.5px; padding:2px 8px; border-radius:999px;
  background:var(--surface-2); color:var(--ink-3); white-space:nowrap}

.toast{
  position:fixed; left:50%; bottom:calc(72px + env(safe-area-inset-bottom));
  transform:translateX(-50%); background:var(--ink); color:var(--paper);
  padding:11px 17px; border-radius:999px; font-size:14px; z-index:60; box-shadow:var(--shadow);
  max-width:88vw; text-align:center;
}
.empty{text-align:center; color:var(--ink-3); padding:36px 16px; font-size:15px}
.empty .big{font-size:40px; margin-bottom:8px; opacity:.5}

@media (min-width:700px){
  main{padding:22px 22px 30px}
  .face{min-height:250px}
}
@media (prefers-reduced-motion:no-preference){
  .opt,.chip,.face{transition:background-color .13s ease, border-color .13s ease}
}
