/* =========================================================
   Fokus-Wächter – app.css
   Eigene Palette: Schiefer-Blau + Bernstein/Rot-Akzent
   ========================================================= */

:root {
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --amber: #f59e0b;
  --amber-dark: #b45309;
  --red: #ef4444;
  --red-dark: #b91c1c;
  --green: #22c55e;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  --maxw: 760px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Dark (default) ---------- */
[data-theme="dark"] {
  --bg: #0b1120;
  --bg-grad-1: #0f172a;
  --bg-grad-2: #1e293b;
  --surface: #1e293b;
  --surface-2: #243450;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #334155;
  --input-bg: #0f172a;
  --chip-bg: #243450;
  --accent: var(--amber);
  --accent-text: #1a1304;
}

/* ---------- Light ---------- */
[data-theme="light"] {
  --bg: #eef2f8;
  --bg-grad-1: #f8fafc;
  --bg-grad-2: #e2e8f0;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #cbd5e1;
  --input-bg: #ffffff;
  --chip-bg: #e2e8f0;
  --accent: var(--amber-dark);
  --accent-text: #ffffff;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(245, 158, 11, 0.10), transparent 60%),
    linear-gradient(160deg, var(--bg-grad-1), var(--bg-grad-2));
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-text);
  padding: .6rem 1rem;
  border-radius: var(--radius-sm);
  z-index: 1000;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ---------- Header ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.1rem 1rem .6rem;
}
.brand { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.brand-logo { border-radius: 9px; flex: 0 0 auto; }
.brand-text { min-width: 0; }
.brand h1 {
  font-size: 1.3rem;
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.brand-sub { margin: 0; font-size: .78rem; color: var(--text-muted); }

.theme-toggle {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform .2s var(--ease), background .2s var(--ease);
}
.theme-toggle:hover { transform: scale(1.06); }
.theme-toggle:active { transform: scale(0.96); }

/* ---------- Main ---------- */
.app-main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.1rem 1.25rem;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 .8rem; font-size: 1.1rem; }

/* ---------- Honesty card ---------- */
.honesty {
  border-left: 4px solid var(--amber);
  background:
    linear-gradient(0deg, rgba(245,158,11,0.04), rgba(245,158,11,0.04)),
    var(--surface);
}
.honesty-title { color: var(--accent); margin-bottom: .5rem; font-size: 1rem; }
.honesty p { margin: 0; font-size: .92rem; }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: .4rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .35rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto;
  white-space: nowrap;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 600;
  padding: .55rem .8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.tab:hover { color: var(--text); }
.tab.is-active {
  background: var(--accent);
  color: var(--accent-text);
}

/* ---------- Fields ---------- */
.field { margin-bottom: 1rem; }
.field > label {
  display: block;
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: .4rem;
}
.field-inline {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-top: .6rem;
  flex-wrap: wrap;
}
.field-inline label { font-size: .85rem; }

input[type="text"],
input[type="number"],
input[type="password"] {
  width: 100%;
  padding: .7rem .8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
input[type="number"] { width: auto; max-width: 120px; }
input::placeholder { color: var(--text-muted); opacity: .8; }
input:focus-visible,
.tab:focus-visible,
.btn:focus-visible,
.chip:focus-visible,
.theme-toggle:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--text);
  padding: .5rem .85rem;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s var(--ease), background .15s var(--ease), border-color .15s var(--ease);
}
.chip:hover { transform: translateY(-1px); }
.chip.is-active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: .8rem 1.1rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform .12s var(--ease), filter .15s var(--ease), opacity .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(0.98); }
.btn-block { display: block; width: 100%; margin-top: .4rem; }
.btn-small { padding: .5rem .8rem; font-size: .85rem; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-amber { background: var(--amber); color: #1a1304; }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

/* ---------- Hints / misc ---------- */
.hint { font-size: .85rem; margin: .5rem 0 0; min-height: 1.1em; color: var(--text-muted); }
.hint-error { color: var(--red); }
.hint-ok { color: var(--green); }
.muted { color: var(--text-muted); }
.small { font-size: .82rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .6rem; }
.panel-head h2 { margin: 0; }

/* ---------- History ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .6rem;
  margin-bottom: 1rem;
}
.stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .7rem .5rem;
  text-align: center;
}
.stat-num { display: block; font-size: 1.4rem; font-weight: 800; color: var(--accent); }
.stat-label { display: block; font-size: .72rem; color: var(--text-muted); }

.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.history-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: .7rem .85rem;
}
.history-item.is-fail { border-left-color: var(--red); }
.hi-top { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.hi-name { font-weight: 700; }
.hi-date { font-size: .76rem; color: var(--text-muted); }
.hi-meta { font-size: .82rem; color: var(--text-muted); margin-top: .25rem; }
.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: .1rem .5rem;
  border-radius: 999px;
}
.badge-ok { background: rgba(34,197,94,.18); color: var(--green); }
.badge-fail { background: rgba(239,68,68,.18); color: var(--red); }

/* ---------- Keyword list ---------- */
.keyword-list { list-style: none; margin: .8rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.keyword-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--chip-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .35rem .35rem .35rem .75rem;
  font-size: .88rem;
}
.keyword-chip button {
  border: none;
  background: var(--red);
  color: #fff;
  width: 22px; height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: .9rem;
  line-height: 1;
  display: grid; place-items: center;
}

/* ---------- PIN status ---------- */
.pin-status { margin-bottom: 1rem; font-weight: 600; font-size: .92rem; }
.pin-set { color: var(--green); }
.pin-unset { color: var(--amber); }

/* ---------- Lock screen ---------- */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 900;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(245,158,11,0.12), transparent 60%),
    linear-gradient(160deg, var(--slate-900), #060b18);
  color: #e2e8f0;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  animation: fadeIn .35s var(--ease);
}
.lock-screen[hidden] { display: none; }
.lock-inner { text-align: center; max-width: 420px; width: 100%; }
.lock-eyebrow {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .78rem;
  color: var(--amber);
  margin: 0 0 .2rem;
  font-weight: 700;
}
.lock-title { font-size: 1.5rem; margin: 0 0 1.2rem; font-weight: 700; }

.ring-wrap { position: relative; width: 220px; height: 220px; margin: 0 auto 1.2rem; }
.ring { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(148,163,184,.25); stroke-width: 12; }
.ring-fg {
  fill: none;
  stroke: var(--amber);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 628.318;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke .4s var(--ease);
}
.ring-fg.is-paused { stroke: var(--red); }
.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.countdown { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.lock-substate { font-size: .82rem; color: #94a3b8; text-transform: uppercase; letter-spacing: .1em; }

.lock-meta { display: flex; justify-content: center; gap: 2.5rem; margin-bottom: 1rem; }
.meta-item { display: flex; flex-direction: column; }
.meta-num { font-size: 1.6rem; font-weight: 800; color: var(--amber); }
.meta-label { font-size: .74rem; color: #94a3b8; text-transform: uppercase; letter-spacing: .08em; }

.lock-msg { font-size: 1rem; min-height: 1.4em; margin: 0 0 1.4rem; color: #cbd5e1; }
.lock-actions { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; }
.lock-actions .btn { flex: 1 1 140px; max-width: 200px; }
.lock-foot { margin: 1rem 0 0; color: #64748b; }

/* ---------- Modals ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(2, 6, 23, 0.7);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 1.2rem;
  animation: fadeIn .25s var(--ease);
}
.modal[hidden] { display: none; }
.modal-box {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow);
}
.modal-box h3 { margin: 0 0 .5rem; font-size: 1.15rem; }
.modal-box input { margin-top: .8rem; text-align: center; font-size: 1.4rem; letter-spacing: .3em; }
.modal-actions { display: flex; gap: .6rem; margin-top: 1.1rem; }
.modal-actions .btn { flex: 1; }
.wi-modal-msg { margin: 0; font-size: 1rem; line-height: 1.5; }

.result-body { margin-top: .6rem; }
.result-line { display: flex; justify-content: space-between; padding: .5rem 0; border-bottom: 1px dashed var(--border); }
.result-line:last-child { border-bottom: none; }
.result-line .v { font-weight: 800; }
.result-verdict { text-align: center; font-size: 1.05rem; font-weight: 700; margin: .4rem 0 1rem; padding: .7rem; border-radius: var(--radius-sm); }
.verdict-ok { background: rgba(34,197,94,.15); color: var(--green); }
.verdict-partial { background: rgba(245,158,11,.15); color: var(--amber); }

/* ---------- Footer ---------- */
.app-footer { max-width: var(--maxw); margin: 0 auto; padding: 0 1rem 1.5rem; text-align: center; }

/* ---------- Animations ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .ring-fg { transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 420px) {
  .ring-wrap { width: 190px; height: 190px; }
  .countdown { font-size: 2.2rem; }
  .lock-meta { gap: 1.6rem; }
  .stats-grid { gap: .4rem; }
  .stat-num { font-size: 1.2rem; }
}
@media (min-width: 700px) {
  .brand h1 { font-size: 1.5rem; }
}
