:root {
  --bg-studio: #E4E0D8;
  --surface-desk: #F4F2EE;
  --surface-porcelain: #FFFFFF;
  --ink-slate: #1E293B;
  --ink-muted: #64748B;
  --hairline: #E2E6EC;
  --teal-primary: #17786D;
  --teal-soft: #E6F3F1;
  --gold-warm: #E59A24;
  --gold-soft: #FDF5E6;
  --coral-accent: #DF5A46;
  --coral-soft: #FCECE9;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Fast taps on the answers must not zoom the page (double-tap zoom); pinching still works. */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-studio);
  background-image: radial-gradient(rgba(30, 41, 59, 0.08) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--ink-slate);
  min-height: 100vh;
  min-height: 100dvh;          /* the height that is really visible on a phone (address bar shown) */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px;
  -webkit-font-smoothing: antialiased;
}

.device-frame {
  width: 100%;
  max-width: 416px;
  height: 844px;
  max-height: 96vh;
  max-height: 96dvh;
  background: var(--surface-desk);
  border-radius: 36px;
  box-shadow:
    0 24px 60px rgba(30, 41, 59, 0.14),
    0 4px 16px rgba(30, 41, 59, 0.06),
    inset 0 0 0 1px rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.porcelain-card {
  background: var(--surface-porcelain);
  border-radius: 20px;
  box-shadow:
    0 4px 16px rgba(30, 41, 59, 0.045),
    0 1px 2px rgba(30, 41, 59, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(226, 230, 236, 0.85);
}

.spring-btn {
  font-family: inherit;
  transition:
    transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.22s ease,
    background-color 0.18s ease,
    border-color 0.18s ease;
  cursor: pointer;
}
.spring-btn:hover:not(:disabled) {
  transform: translateY(-1.5px);
  box-shadow: 0 6px 16px rgba(30, 41, 59, 0.07), 0 2px 4px rgba(30, 41, 59, 0.04);
}
.spring-btn:active:not(:disabled) {
  transform: scale(0.975) translateY(0.5px);
  box-shadow: 0 2px 6px rgba(30, 41, 59, 0.04);
}
.spring-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 10px;
}

.chart-option {
  width: 100%;
  min-height: 46px;
  background: #FAFBFD;
  border: 1px solid var(--hairline);
  border-radius: 13px;
  padding: 9px 10px 9px 13px;
  font-size: 14.5px;
  font-weight: 650;
  color: var(--ink-slate);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  text-align: left;
  box-shadow: 0 1px 2px rgba(30, 41, 59, 0.03);
}
.chart-option:hover:not(:disabled) { background: #FFFFFF; border-color: #CBD5E1; }

.chart-option-bullet {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1.5px solid #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-muted);
  flex-shrink: 0;
}

@keyframes springConfirm {
  0% { transform: scale(1); }
  40% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
@keyframes gentleShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

.chart-option.state-correct {
  animation: springConfirm 0.36s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: var(--teal-soft);
  border-color: var(--teal-primary);
  color: var(--teal-primary);
  opacity: 1;
}
.chart-option.state-correct .chart-option-bullet {
  background: var(--teal-primary);
  border-color: var(--teal-primary);
  color: #FFFFFF;
}
.chart-option.state-wrong {
  animation: gentleShake 0.34s ease;
  background: var(--coral-soft);
  border-color: var(--coral-accent);
  color: var(--coral-accent);
  opacity: 1;
}

@keyframes blitzGlow {
  0%, 100% { box-shadow: 0 4px 14px rgba(223, 90, 70, 0.35), 0 0 0 0 rgba(223, 90, 70, 0.4); }
  50% { box-shadow: 0 4px 18px rgba(223, 90, 70, 0.45), 0 0 0 6px rgba(223, 90, 70, 0); }
}
@keyframes blitzPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.09); }
  100% { transform: scale(1); }
}
.blitz-pop { animation: blitzPop 0.32s ease-out; }
.blitz-charging {
  background: var(--coral-soft) !important;
  color: var(--coral-accent) !important;
  box-shadow: none !important;
  cursor: default;
}
.blitz-ready { animation: blitzGlow 1.1s infinite ease-in-out; }
/* The running Adrenalinstoß drains like the chips of the Pieper: the bright filling shrinks on a darker ground. */
.blitz-running {
  animation: blitzGlow 1.1s infinite ease-in-out;
  background: #A93A29 !important;
}
.blitz-running #adrFill { background: linear-gradient(135deg, #F07A66 0%, #E5634F 100%) !important; transition: width 0.12s linear !important; }

.gold-token {
  background: linear-gradient(145deg, #F7BC4D 0%, #E59A24 60%, #CC8214 100%);
  box-shadow:
    0 3px 8px rgba(229, 154, 36, 0.32),
    inset 0 1.5px 1px rgba(255, 255, 255, 0.6),
    inset 0 -1.5px 2px rgba(161, 98, 7, 0.35);
}

.top-bar {
  background: rgba(255, 255, 255, 0.92);
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 20;
  flex-shrink: 0;
}

.view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.view::-webkit-scrollbar { width: 0; background: transparent; }
.hidden { display: none !important; }

.pill {
  background: var(--teal-soft);
  color: var(--teal-primary);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.meter {
  width: 100%;
  height: 7px;
  background: #DFE4EC;
  border-radius: 999px;
  margin-top: 5px;
  overflow: hidden;
}
.meter > div {
  height: 100%;
  background: linear-gradient(90deg, #1E8E81 0%, #17786D 100%);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.meter.stars > div { background: linear-gradient(90deg, #F2B544 0%, #E59A24 100%); }
.meter.ranked { position: relative; }
.meter.ranked::before, .meter.ranked::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 2px; background: var(--surface-desk); z-index: 1;
}
.meter.ranked::before { left: 33.33%; }
.meter.ranked::after { left: 66.67%; }
.goal { display: inline-flex; align-items: center; gap: 3px; }

.bottom-nav {
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--hairline);
  padding: 8px 16px 10px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  flex-shrink: 0;
  z-index: 20;
}
.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  border-radius: 14px;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  gap: 3px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.nav-tab.active { background: var(--teal-soft); color: var(--teal-primary); }
.nav-tab:active { transform: scale(0.95); }

/* Upgrades */
.upg-row { padding: 11px 12px; display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
@keyframes upgPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.025); }
  100% { transform: scale(1); }
}
.upg-pop { animation: upgPop 0.3s ease-out; }
.upg-row.locked { background: transparent; border: 1.5px dashed #C9D1DC; box-shadow: none; }
.upg-icon {
  width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0;
  background: var(--teal-soft); color: var(--teal-primary);
  display: flex; align-items: center; justify-content: center;
}
.upg-row.locked .upg-icon { background: #E9EDF2; color: var(--ink-muted); }
.upg-name { font-size: 13.5px; font-weight: 800; }
.upg-row.locked .upg-name { color: var(--ink-muted); }
.upg-level {
  font-size: 10.5px; font-weight: 700; color: var(--teal-primary); background: var(--teal-soft);
  padding: 2px 7px; border-radius: 999px; white-space: nowrap;
}
.upg-level:empty { display: none; }
.upg-effect { font-size: 11.5px; font-weight: 500; line-height: 15px; color: var(--ink-muted); margin-top: 2px; }
.upg-value { font-size: 12px; font-weight: 600; line-height: 16px; color: var(--teal-primary); margin-top: 1px; }
.upg-value b { color: var(--ink-slate); font-weight: 800; }
.upg-value:empty { display: none; }
.upg-row.locked .upg-value, .upg-row.locked .upg-value b { color: var(--ink-muted); }
.upg-buy {
  flex-shrink: 0; min-width: 84px; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  background: var(--gold-soft); border: 1px solid #F3DFB5; border-radius: 999px; padding: 8px 11px 8px 8px;
  font-size: 12.5px; font-weight: 800; color: #9A630D;
}
.upg-lock { flex-shrink: 0; min-width: 84px; text-align: center; font-size: 11.5px; font-weight: 800; line-height: 15px; color: var(--ink-muted); }
.upg-lock small { display: block; font-size: 10.5px; font-weight: 600; }

/* Sammlung */
.term-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.term-card { padding: 10px 12px; border-radius: 16px; }
.term-card.locked {
  background: transparent;
  border: 1.5px dashed #C3CBD6;
  box-shadow: none;
  color: var(--ink-muted);
}
.term-la { font-size: 14px; font-weight: 800; }
.term-de { font-size: 11.5px; font-weight: 500; color: var(--ink-muted); margin-top: 1px; }
.term-stars { display: flex; gap: 2px; margin-top: 6px; }
.chart-option > span:first-child { min-width: 0; overflow-wrap: anywhere; hyphens: auto; }

/* ---- additions for the game ---- */
.adr-btn {
  background: linear-gradient(135deg, #EB6854 0%, #DF5A46 100%); color: #FFFFFF; border: none; border-radius: 999px;
  padding: 9px 15px; min-width: 158px; justify-content: center; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; gap: 6px; box-shadow: 0 4px 12px rgba(223, 90, 70, 0.28);
  position: relative; overflow: hidden;
}
.intro-box {
  margin-top: 10px; min-height: 99px; border-radius: 13px; background: var(--teal-soft);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-align: center; padding: 8px 12px;
}
.intro-term { font-size: 21px; font-weight: 800; color: var(--teal-primary); letter-spacing: -0.01em; }
.intro-de { font-size: 15px; font-weight: 700; color: var(--ink-slate); }
.intro-gr { font-size: 12px; font-weight: 600; color: var(--ink-muted); }
.intro-gr b { color: var(--ink-slate); font-weight: 800; }
.intro-gr:empty { display: none; }

/* Emergency question: red frame, badge and a bar that runs out */
.new-badge.em-badge { background: var(--coral-accent); color: #FFFFFF; }
#chartCard.emergency { box-shadow: 0 0 0 2px var(--coral-accent), 0 8px 22px rgba(223, 90, 70, 0.22); }
.new-badge.ko-badge { background: #5B7FA6; color: #FFFFFF; }
#chartCard.konsil { box-shadow: 0 0 0 2px #5B7FA6, 0 8px 22px rgba(91, 127, 166, 0.22); }
.new-badge.ra-badge { background: #8A6FB0; color: #FFFFFF; }
#chartCard.rare { box-shadow: 0 0 0 2px #8A6FB0, 0 8px 22px rgba(138, 111, 176, 0.24); }
.new-badge.le-badge { background: #C98B22; color: #FFFFFF; }
#chartCard.lehre { box-shadow: 0 0 0 2px #C98B22, 0 8px 22px rgba(201, 139, 34, 0.24); }
.em-timer { position: absolute; left: 14px; right: 14px; bottom: 5px; height: 4px; border-radius: 999px; background: var(--coral-soft); overflow: hidden; }
.em-timer > div { height: 100%; width: 100%; border-radius: 999px; background: var(--coral-accent); }
.new-badge {
  background: var(--gold-soft); color: #9A630D; font-size: 10px; font-weight: 800; letter-spacing: 0.05em;
  padding: 2px 7px; border-radius: 999px; margin-left: 6px;
}
.term-gram { font-size: 10.5px; font-weight: 600; color: var(--ink-muted); font-style: italic; }
.link-btn {
  background: none; border: none; font-family: inherit; font-size: 11.5px; font-weight: 700; color: var(--ink-muted);
  text-decoration: underline; cursor: pointer; padding: 6px 4px; align-self: flex-start;
}


/* On a phone the game fills the whole screen. */
/* Phones: the game fills exactly the visible screen. The page behind it cannot be scrolled or dragged, so there
   is no blank strip above or below it. */
@media (max-width: 480px) {
  html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  body { padding: 0; min-height: 0; display: block; }
  .device-frame { position: fixed; top: 0; left: 0; max-width: none; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; box-shadow: none; }
  .bottom-nav { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
}

/* Saved game panel */
.save-code {
  width: 100%; margin-top: 9px; padding: 8px 10px; resize: none; border: 1px solid var(--hairline); border-radius: 11px;
  background: #FAFBFD; color: var(--ink-slate); font-family: ui-monospace, Consolas, monospace; font-size: 11px; line-height: 15px;
  word-break: break-all; user-select: text; -webkit-user-select: text;
}
.save-code:focus { outline: 2px solid var(--teal-soft); border-color: var(--teal-primary); }
.save-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 8px; }
.save-btn {
  background: var(--teal-soft); color: var(--teal-primary); border: none; border-radius: 11px;
  padding: 9px 8px; font-size: 12.5px; font-weight: 800;
}

/* A short message that slides in above the bottom tabs (for example the Nachtdienst income). */
.toast {
  position: absolute; left: 14px; right: 14px; bottom: 78px; z-index: 30; pointer-events: none;
  background: #1E293B; color: #FFFFFF; border-radius: 14px; padding: 11px 14px; font-size: 12.5px; font-weight: 600; text-align: center;
  box-shadow: 0 8px 24px rgba(30, 41, 59, 0.25); opacity: 0; transform: translateY(10px); transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.high { bottom: auto; top: 168px; }
.toast b { color: #F7BC4D; }

/* Klinik view: pages side by side */
.tower-scroll {
  position: absolute; inset: 0; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.tower-scroll::-webkit-scrollbar { display: none; }
.tower-wide { position: relative; width: 100%; height: 100%; }
#towerSnaps > div { position: absolute; top: 0; height: 1px; scroll-snap-align: start; pointer-events: none; }
/* Skyline strip under the title of the Klinik view */
.skyline { margin-top: 6px; display: flex; align-items: flex-end; justify-content: space-between; }
.skyline svg { display: block; overflow: visible; }
.skyline [data-page] { cursor: pointer; }
.skyline .sky-next { animation: sky-pulse 1.3s ease-in-out infinite; }
@keyframes sky-pulse { 50% { opacity: 0.35; } }
.skyline-hint { font-size: 10.5px; font-weight: 700; color: var(--ink-muted); padding-bottom: 7px; }

/* Spielanleitung */
/* the button that opens it: one slim line in the look of the Spielstand buttons */
.help-row { width: 100%; flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 13px; text-align: left; cursor: pointer; font-size: 13px; }
.help-sheet {
  position: absolute; inset: 0; z-index: 40; display: flex; flex-direction: column;
  background: var(--surface-desk); border-radius: inherit; animation: help-in 0.22s ease-out;
}
@keyframes help-in { from { opacity: 0; transform: translateY(14px); } }
.help-head { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 10px 18px; }
.help-close {
  width: 34px; height: 34px; border: none; border-radius: 999px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; background: var(--surface-porcelain); color: var(--ink-slate);
  box-shadow: 0 2px 8px rgba(30, 41, 59, 0.08);
}
.help-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0 14px 20px; display: flex; flex-direction: column; gap: 9px; scrollbar-width: none; }
.help-body::-webkit-scrollbar { width: 0; background: transparent; }
.help-group { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--teal-primary); margin: 9px 4px -2px; }
.help-card { padding: 11px 12px; display: flex; align-items: flex-start; gap: 11px; flex-shrink: 0; }
.help-card.locked { background: transparent; border: 1.5px dashed #C9D1DC; box-shadow: none; }
.help-card.locked .upg-icon { background: #E9EDF2; color: var(--ink-muted); }
.help-card .upg-icon { font-size: 15px; font-weight: 800; }
.help-title { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13.5px; font-weight: 800; }
.help-text { font-size: 12px; font-weight: 500; line-height: 17px; color: #3B4A5E; margin-top: 2px; }
.help-text b { font-weight: 800; color: var(--ink-slate); }
.help-tag { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; white-space: nowrap; background: #E9EDF2; color: var(--ink-muted); }
.help-tag.done { background: var(--teal-soft); color: var(--teal-primary); }
.help-ranks { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.help-ranks span { font-size: 10.5px; font-weight: 800; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }

/* Narrow phones: the Adrenalin button gives way, so that large coin numbers stay readable next to it */
@media (max-width: 400px) { .adr-btn { min-width: 138px; padding: 9px 11px; } }
@media (max-width: 345px) { .adr-btn { min-width: 120px; padding: 8px 9px; font-size: 12px; } #coinDisplay { font-size: 18px !important; } }

/* Pieper: the cases that are waiting, as chips on the top edge of the picture (department and Klinik view).
   The tinted filling of a chip runs down with the time that is left to take the case. */
.pager { position: absolute; left: 9px; right: 9px; top: 9px; z-index: 5; display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none; }
.pg {
  position: relative; overflow: hidden; pointer-events: auto; cursor: pointer; border: none; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 4px; border-radius: 999px;
  background: #FFFFFF; color: var(--ink-slate); font-size: 11.5px; font-weight: 800; white-space: nowrap;
  box-shadow: 0 3px 10px rgba(30, 41, 59, 0.2);
}
.pg:active { transform: scale(0.96); }
.pg.new { animation: pg-in 0.38s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes pg-in { from { opacity: 0; transform: scale(0.6) translateY(-8px); } }
.pg-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--t); transition: width 0.12s linear; }
.pg-icon { position: relative; width: 21px; height: 21px; border-radius: 50%; background: var(--c); color: #FFFFFF; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pg-icon svg { animation: pg-ring 1.4s ease-in-out infinite; transform-origin: 50% 55%; }   /* the same ringing phone for every case */
@keyframes pg-ring { 0%, 55%, 100% { transform: rotate(0); } 8% { transform: rotate(-17deg); } 17% { transform: rotate(15deg); } 26% { transform: rotate(-12deg); } 35% { transform: rotate(9deg); } 45% { transform: rotate(-5deg); } }
.pg-text { position: relative; }
.pg-text small { font-size: 10px; font-weight: 600; color: var(--ink-muted); }
/* in the other tabs a dot on the Klinik tab says that a case is waiting */
.nav-tab { position: relative; }
.nav-tab.has-case::after { content: ''; position: absolute; top: 5px; left: calc(50% + 7px); width: 8px; height: 8px; border-radius: 50%; background: var(--coral-accent); box-shadow: 0 0 0 2px #FFFFFF; }

/* The version below the Spielanleitung (js/version.js), e.g. "Version 2026-12-02 · f20f148" */
.app-version { flex-shrink: 0; padding: 8px 18px calc(12px + env(safe-area-inset-bottom, 0px)); font-size: 10.5px; font-weight: 600; color: var(--ink-muted); text-align: center; border-top: 1px solid var(--hairline); }
