/* Claude Status -- dunkel als Basis, hell nur als Ausnahme.
   Farbe ist hier Bedeutung: Bernstein heisst wartet, Rot heisst Fehler.
   Deshalb bekommt nichts anderes im Layout eine Akzentfarbe. */

:root {
  --bg:        #0b0d10;
  --card:      #15181d;
  --card-line: #232833;
  --fg:        #e6e9ef;
  --fg-dim:    #8b93a3;
  --fg-faint:  #5d6575;

  --cooking:          #4C8DFF;
  --needs_input:      #FFB020;
  --needs_permission: #FF7A45;
  --background:       #2BB8A6;
  --done:             #35C46A;
  --error:            #FF4D4F;
  --ended:            #6B7280;
}

* { box-sizing: border-box; }

/* Muss ganz oben stehen und !important tragen: das hidden-Attribut wird
   sonst von jeder Klassenregel mit eigenem display ueberstimmt -- genau
   daran lag es, dass der Spielmodus beim Laden ueber allem lag. */
[hidden] { display: none !important; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* black-translucent laesst den Inhalt unter die Statusleiste laufen */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ------------------------------------------------------------- Kopfbereich */

.head { margin-bottom: 6px; }

.mascot { line-height: 0; background: var(--bg); }
.mascot-canvas { display: block; width: 100%; image-rendering: pixelated; }

.head-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 0;
}

h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  margin: 0;
  flex: 1;
}

.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--fg-faint);
  flex: none;
  transition: background .3s;
}
.dot.live      { background: var(--done); }
.dot.connecting{ background: var(--needs_input); }

.attention {
  background: none;
  border: 0;
  color: var(--needs_input);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 3px 0;
  cursor: pointer;
}

.mascot { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.play-cue {
  text-align: right;
  padding: 4px 16px 0;
  font-size: 11px;
  color: var(--fg-faint);
  letter-spacing: .02em;
}

/* ------------------------------------------------------------- Spielmodus */

.play {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;   /* Spielfeld sitzt mittig, nicht oben */
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.play-bar {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 14px);
  left: 16px; right: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.play-score { font-size: 15px; color: var(--fg-dim); }
.play-score b {
  font-size: 26px;
  color: var(--fg);
  font-variant-numeric: tabular-nums;   /* Ziffern springen sonst beim Zählen */
}
.play-speed {
  font-size: 13px; font-weight: 700; color: var(--cooking);
  font-variant-numeric: tabular-nums;
}
.play-best { flex: 1; font-size: 12px; color: var(--fg-faint); }
.play-exit {
  background: var(--card);
  border: 1px solid var(--card-line);
  color: var(--fg);
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 16px;
  border-radius: 9px;
  cursor: pointer;
}
.play-exit:active { background: var(--card-line); }

.play-stage { width: 100%; }
.play-stage .mascot-canvas { display: block; width: 100%; image-rendering: pixelated; }

.play-hint {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom) + 26px);
  left: 0; right: 0;
  text-align: center;
  font-size: 12px;
  color: var(--fg-faint);
  margin: 0;
  transition: opacity .4s;
}
.play-hint.weg { opacity: 0; }

/* ------------------------------------------------------------- Tipp */

/* Bewusst keine Flaeche: sobald der Tipp eine bekaeme, waere er eine Karte
   und konkurrierte mit den Statuskarten um dieselbe visuelle Kategorie. */
.tip {
  margin: 14px 16px 20px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.055);
  max-width: 62ch;
}
.tip__label {
  display: block;
  font-size: 11px;
  line-height: 1;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: rgba(255,255,255,.34);
  margin-bottom: 6px;
}
.tip__text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(255,255,255,.70);
}

/* ------------------------------------------------------------- Karten */

.cards { padding: 0 16px 8px; display: flex; flex-direction: column; gap: 10px; }

.card {
  position: relative;
  background: var(--card);
  border-radius: 12px;
  padding: 13px 14px 13px 18px;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--accent);
}
.card.dim { opacity: .55; }

.card-top { display: flex; align-items: baseline; gap: 10px; }

.project {
  font-weight: 600;
  font-size: 15px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Der Zustand steht immer als Text da. Farbe allein codiert ihn nie --
   das gilt fuer Barrierefreiheit wie fuer Sonnenlicht auf dem Handy. */
.badge {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}

.since { font-size: 12px; color: var(--fg-dim); margin-top: 3px; }

.task {
  font-size: 13px;
  margin-top: 7px;
  color: var(--fg);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.text {
  font-size: 13px;
  margin-top: 4px;
  color: var(--fg-dim);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Bei einer wartenden Freigabe ist die Frage das Entscheidende, nicht der Auftrag */
.card.urgent .text { color: var(--fg); font-weight: 500; }
.card.urgent .task { color: var(--fg-dim); font-weight: 400; }

.pulse::after {
  content: '';
  position: absolute; right: 14px; bottom: 14px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: .25 } 50% { opacity: 1 } }

.meta { font-size: 11px; color: var(--fg-faint); margin-top: 8px; }

/* Sprung in die Claude-App. Bewusst zurueckhaltend: die Karte informiert,
   der Knopf ist die Ausnahme fuer den Fall, dass man eingreifen will. */
.open-remote {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-dim);
  text-decoration: none;
  border: 1px solid var(--card-line);
  border-radius: 7px;
  padding: 5px 11px;
  -webkit-tap-highlight-color: transparent;
}
.open-remote::after { content: ' ↗'; opacity: .6; }
.no-remote { margin-top: 9px; font-size: 11px; color: var(--fg-faint); }
.open-remote:active { background: var(--card-line); }
/* Nur wo wirklich jemand wartet, darf der Weg dorthin auffallen --
   auf jeder Karte waere die Hervorhebung wertlos */
.card.waits .open-remote {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent);
}

/* ------------------------------------------------------------- Rest */

.banner {
  background: #2a2118;
  color: #ffd8a8;
  font-size: 13px;
  padding: 9px 16px;
  text-align: center;
}

.empty { color: var(--fg-dim); text-align: center; padding: 40px 16px; font-size: 14px; }

.login { padding: 30px 16px; max-width: 380px; margin: 0 auto; }
.login label { display: block; font-size: 12px; color: var(--fg-dim); margin-bottom: 6px; }
.login input {
  width: 100%; padding: 11px 12px; font: inherit;
  background: var(--card); color: var(--fg);
  border: 1px solid var(--card-line); border-radius: 9px;
}
.login button {
  margin-top: 10px; width: 100%; padding: 11px;
  font: inherit; font-weight: 600;
  background: #2c3442; color: var(--fg);
  border: 0; border-radius: 9px; cursor: pointer;
}
.login-err { display: block; margin-top: 9px; color: var(--error); font-size: 13px; }

.foot { padding: 6px 16px 26px; display: flex; gap: 14px; justify-content: flex-end; }
.ghost {
  background: none; border: 0; color: var(--fg-faint);
  font: inherit; font-size: 11px; cursor: pointer; padding: 4px 0;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7f9; --card: #fff; --card-line: #e3e6eb;
    --fg: #14161a; --fg-dim: #5d6575; --fg-faint: #8b93a3;
  }
  .tip__label { color: rgba(0,0,0,.42); }
  .tip__text  { color: rgba(0,0,0,.68); }
  .tip { border-top-color: rgba(0,0,0,.08); }
  .card { box-shadow: 0 1px 2px rgba(0,0,0,.06); }
  .banner { background: #fff4e5; color: #7a4a10; }
}

@media (prefers-reduced-motion: reduce) {
  .pulse::after { animation: none; opacity: .8; }
}
