/* AnkerPro -- maritim, dunkel, lesbar bei Sonne */

/* HTML5 hidden-Attribut darf nicht von display:flex/grid uebersteuert werden */
[hidden] { display: none !important; }

:root {
  --bg: #07111c;
  --bg-deep: #050b13;
  --surface: #11202e;
  --surface-2: #182d3f;
  --line: #1f3346;
  --line-strong: #2a4660;
  --ink: #eaf1f8;
  --ink-2: #a3b4c6;
  --ink-3: #6b7e91;
  --brass: #f0b56b;
  --brass-deep: #c98e3e;
  --brass-glow: rgba(240, 181, 107, 0.18);
  --good: #6ee49b;
  --warn: #ff8b6b;
  --bad: #ff5e5e;
  --wind: #4cc4ff;
  --shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 20px 60px -20px rgba(0,0,0,0.7);
  --radius: 14px;
  --radius-lg: 22px;
  --r-pad: max(env(safe-area-inset-right), 16px);
  --l-pad: max(env(safe-area-inset-left), 16px);
  --t-pad: max(env(safe-area-inset-top), 12px);
  --b-pad: max(env(safe-area-inset-bottom), 14px);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-feature-settings: 'cv11','ss01','ss03','tnum';
}

@supports (font-variation-settings: normal) {
  :root { font-family: 'Inter var', system-ui, -apple-system, sans-serif; }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(ellipse at top, #0d1c2c 0%, var(--bg-deep) 60%) fixed;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: contain;
  -webkit-font-smoothing: antialiased;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--t-pad) var(--r-pad) 10px var(--l-pad);
  background: linear-gradient(180deg, rgba(7,17,28,0.92), rgba(7,17,28,0.6) 70%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 32px; height: 32px; color: var(--brass); }
.brand-name {
  font-size: 17px; font-weight: 600; letter-spacing: 0.02em;
  font-feature-settings: 'ss01';
}
.brand-tag {
  font-size: 11px; color: var(--ink-3); text-transform: uppercase;
  letter-spacing: 0.16em;
}
.brand-tag::before {
  content: '·'; margin-right: 6px; color: var(--good);
  font-weight: 900;
  text-shadow: 0 0 8px currentColor;
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); display: grid; place-items: center;
  cursor: pointer;
}
.icon-btn:active { transform: scale(0.96); }

/* ---------- screens / layout ---------- */
main { padding: 8px var(--r-pad) calc(var(--b-pad) + 100px) var(--l-pad); }
.screen { display: flex; flex-direction: column; gap: 16px; }

.hero { padding: 14px 4px 4px; }
.eyebrow {
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--brass); margin-bottom: 10px;
}
h1 {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 300; font-size: clamp(28px, 8vw, 38px);
  margin: 0 0 12px; letter-spacing: -0.02em; line-height: 1.05;
}
h1 br + * {} /* nope */
.lead { color: var(--ink-2); margin: 0; max-width: 30em; }
.footnote { color: var(--ink-3); font-size: 12px; padding: 0 4px; }

/* ---------- card ---------- */
.card {
  background: linear-gradient(180deg, var(--surface) 0%, #0e1c2a 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; }
.row.two > * { flex: 1; }
.end-actions { padding: 8px 4px; }

/* ---------- form ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field .label, legend.label {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-3); padding: 0 2px;
}
.field .label em { color: var(--ink-3); font-style: normal; opacity: 0.7; }
input, select, textarea {
  font: inherit; color: var(--ink);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 14px;
  outline: none;
  width: 100%;
  transition: border-color 0.15s ease, background 0.15s ease;
  -webkit-appearance: none; appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brass); background: rgba(240,181,107,0.04);
}
textarea { resize: none; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 18px) 22px, calc(100% - 12px) 22px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.suffix-input { position: relative; }
.suffix-input input { padding-right: 56px; }
.suffix-input span {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--ink-3); font-size: 14px;
}

/* segmented */
.seg { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 4px;
  background: rgba(0,0,0,0.25); border-radius: 14px; border: 1px solid var(--line); }
.seg label { display: block; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: block; text-align: center; padding: 11px 0;
  border-radius: 10px; font-size: 14px; color: var(--ink-2);
  transition: all 0.15s ease;
}
.seg input:checked + span {
  background: linear-gradient(180deg, var(--brass), var(--brass-deep));
  color: #1a0f00; font-weight: 600; box-shadow: 0 6px 16px -8px var(--brass);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 18px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink); font: inherit; font-weight: 500;
  cursor: pointer; transition: transform 0.05s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.985); }
.btn.primary {
  background: linear-gradient(180deg, var(--brass) 0%, var(--brass-deep) 100%);
  color: #1a0f00; border-color: transparent; font-weight: 600;
  box-shadow: 0 12px 30px -14px var(--brass), inset 0 1px 0 rgba(255,255,255,0.3);
}
.btn.ghost { background: transparent; }
.btn.big { padding: 16px 18px; font-size: 16px; }
.btn.mini { padding: 8px 12px; font-size: 13px; }

/* ---------- phase bar ---------- */
.phase-bar {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px; gap: 4px;
}
.phase {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 11px; padding: 8px 6px; border-radius: 999px;
  color: var(--ink-3); letter-spacing: 0.04em;
  transition: all 0.2s ease;
}
.phase .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-3);
}
.phase.active {
  background: var(--surface-2); color: var(--ink);
}
.phase.active .dot {
  background: var(--brass); box-shadow: 0 0 10px var(--brass);
}
.phase.done .dot { background: var(--good); }

/* ---------- plot ---------- */
.plot-wrap { padding: 14px; }
.plot-title {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0 4px 10px;
}
.plot-title span:first-child { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-3); }
.plot-meta { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.plot-canvas {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  background:
    radial-gradient(circle at center, rgba(76,196,255,0.05) 0%, transparent 60%),
    var(--bg-deep);
  border: 1px solid var(--line);
  overflow: hidden;
}
canvas#plot { width: 100%; height: 100%; display: block; }
.plot-overlay {
  position: absolute; inset: 0; pointer-events: none;
  display: grid; place-items: center;
}
.big-score {
  text-align: center;
  background: rgba(7,17,28,0.55);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 999px;
  padding: 10px 22px;
  min-width: 120px;
}
.score-num {
  display: block; font-size: 38px; font-weight: 200;
  font-variant-numeric: tabular-nums; letter-spacing: -0.04em;
  line-height: 1; color: var(--ink);
}
.score-label {
  display: block; font-size: 10px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--ink-3); margin-top: 4px;
}
.plot-legend {
  display: flex; gap: 14px; flex-wrap: wrap;
  padding: 12px 4px 0;
  font-size: 11px; color: var(--ink-3);
}
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
}
.lg-track::before { background: var(--brass); }
.lg-now::before { background: var(--ink); box-shadow: 0 0 8px var(--ink); }
.lg-wind::before { background: var(--wind); }

/* ---------- metric grid ---------- */
.metric-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.metric {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px;
}
.m-label {
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-3);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.m-edit {
  background: transparent; border: 1px solid var(--line);
  color: var(--ink-2); font: inherit;
  font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; cursor: pointer;
}
.m-edit:active { transform: scale(0.95); }
.m-val {
  font-size: 26px; font-weight: 300; margin-top: 6px;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em; color: var(--ink);
}
.m-sub { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.m-sub-current { color: var(--wind); font-size: 11px; margin-top: 4px; line-height: 1.3; }

/* ---------- coach card ---------- */
.coach {
  background: linear-gradient(180deg, #1a2e3f 0%, #0e1c2a 100%);
  border: 1px solid var(--brass-deep);
  position: relative;
  overflow: hidden;
}
.coach::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--brass), transparent);
  animation: shimmer 4s ease-in-out infinite;
}
@keyframes shimmer { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
.coach-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px;
}
.coach-eyebrow {
  color: var(--brass); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
}
.coach-step { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.coach-title {
  font-size: 22px; font-weight: 400; margin: 0 0 8px;
  letter-spacing: -0.01em; line-height: 1.2;
}
.coach-text { color: var(--ink-2); margin: 0 0 12px; line-height: 1.55; }
.coach-why {
  background: rgba(0,0,0,0.25); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; font-size: 14px; color: var(--ink-2);
  margin-bottom: 14px;
}
.coach-why summary {
  cursor: pointer; color: var(--brass); font-size: 12px;
  letter-spacing: 0.1em; text-transform: uppercase;
  list-style: none;
}
.coach-why summary::-webkit-details-marker { display: none; }
.coach-why summary::after {
  content: '↓'; margin-left: 8px; opacity: 0.6;
}
.coach-why[open] summary::after { content: '↑'; }
.coach-why p { margin: 10px 0 0; }
.coach-actions { display: flex; gap: 10px; }
.coach-actions .btn { flex: 1; }

/* ---------- status strip ---------- */
.status-strip {
  position: fixed; left: 12px; right: 12px; bottom: max(env(safe-area-inset-bottom), 14px);
  background: rgba(7,17,28,0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 18px; padding: 12px 14px;
  display: grid; grid-template-columns: 1fr auto;
  gap: 12px; align-items: center;
  box-shadow: 0 12px 40px -12px rgba(0,0,0,0.7);
  z-index: 20;
}
.status-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--ink-2);
}
.status-pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--good);
  box-shadow: 0 0 0 0 var(--good);
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(110,228,155,0.5); }
  70% { box-shadow: 0 0 0 10px rgba(110,228,155,0); }
  100% { box-shadow: 0 0 0 0 rgba(110,228,155,0); }
}
.status-progress {
  grid-column: 1 / -1;
  height: 3px; background: var(--line); border-radius: 2px; overflow: hidden;
  order: 3;
}
.status-bar {
  height: 100%; width: 0%; background: var(--brass);
  transition: width 0.3s ease;
}

/* ---------- round log (inline im Live-Screen) ---------- */
.round-log { padding: 14px 16px; }
.round-log-title {
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 6px;
}
.round-log-row {
  display: grid; grid-template-columns: 22px 1fr auto auto;
  gap: 10px; padding: 9px 0;
  border-top: 1px solid var(--line);
  align-items: center; font-size: 13px;
}
.round-log-row:first-of-type { border-top: none; }
.round-log-num {
  font-variant-numeric: tabular-nums; color: var(--ink-3);
  font-size: 11px; letter-spacing: 0.1em;
}
.round-log-what {
  color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.round-log-mark { color: var(--ink-3); font-size: 11px; margin-left: 4px; }
.round-log-score {
  font-variant-numeric: tabular-nums; font-weight: 500;
  font-size: 15px;
}
.round-log-delta {
  font-size: 11px; padding: 3px 8px; border-radius: 6px;
  font-variant-numeric: tabular-nums; min-width: 38px; text-align: center;
}
.round-log-delta.good { color: var(--good); background: rgba(110,228,155,0.12); }
.round-log-delta.bad { color: var(--warn); background: rgba(255,139,107,0.12); }
.round-log-delta.neutral { color: var(--ink-3); background: var(--surface-2); }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 14px 20px; border-radius: 14px; font-size: 14px;
  z-index: 100; max-width: min(90%, 500px);
  white-space: pre-line; line-height: 1.45;
  box-shadow: 0 14px 40px -10px rgba(0,0,0,0.6);
}

/* ---------- sheet ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet-card {
  width: 100%; max-width: 540px;
  background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(env(safe-area-inset-bottom) + 18px);
  border: 1px solid var(--line); border-bottom: none;
  animation: slideUp 0.25s cubic-bezier(.2,.7,.2,1);
}
@keyframes slideUp { from { transform: translateY(40px); } to { transform: translateY(0); } }
.sheet-handle {
  width: 44px; height: 4px; background: var(--line-strong);
  border-radius: 2px; margin: 0 auto 14px;
}
.sheet-card h3 {
  margin: 0 0 14px; font-weight: 500; font-size: 18px;
}
.row-btn {
  display: block; width: 100%; text-align: left;
  background: transparent; color: var(--ink); border: none; border-top: 1px solid var(--line);
  padding: 16px 4px; font: inherit; cursor: pointer;
}
.row-btn.close { color: var(--ink-3); }

/* ---------- history ---------- */
#history-list .item {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px;
  align-items: center;
}
#history-list .item .time {
  font-size: 11px; color: var(--ink-3); letter-spacing: 0.1em;
}
#history-list .item .what { font-size: 14px; }
#history-list .item .delta {
  font-size: 13px; font-variant-numeric: tabular-nums;
  padding: 4px 8px; border-radius: 8px;
}
#history-list .item .delta.good { background: rgba(110,228,155,0.12); color: var(--good); }
#history-list .item .delta.bad { background: rgba(255,94,94,0.12); color: var(--bad); }
#history-list .item .delta.neutral { background: rgba(255,255,255,0.05); color: var(--ink-2); }

/* ---------- responsive ---------- */
@media (min-width: 640px) {
  main { max-width: 540px; margin: 0 auto; }
  .seg { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
