/* Ostsee-Chronik — mystisch-märchenhafter Look */
@import url('https://fonts.googleapis.com/css2?family=Grenze+Gotisch:wght@400;500;600;700&family=Alegreya:ital,wght@0,400;0,500;0,700;1,400&display=swap');

:root {
  --night-deep: #0a0e21;
  --night-mid: #141a36;
  --night-teal: #0f2233;
  --panel: rgba(24, 28, 56, 0.78);
  --panel-solid: #181c38;
  --hairline: rgba(217, 164, 65, 0.32);
  --hairline-soft: rgba(217, 164, 65, 0.16);
  --gold: #d9a441;
  --gold-bright: #f0c46a;
  --parchment: #f0e6d2;
  --text-dim: #a59cc4;
  --fee: #d9a7f0;
  --bier: #f0b35a;
  --kobold: #8fd07a;
  --danger: #e07a6a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: 'Alegreya', serif;
  color: var(--parchment);
  background:
    radial-gradient(120% 60% at 50% 110%, var(--night-teal) 0%, transparent 60%),
    linear-gradient(180deg, var(--night-deep) 0%, var(--night-mid) 70%, var(--night-deep) 100%);
  background-attachment: fixed;
}

.ok-display {
  font-family: 'Grenze Gotisch', serif;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ---------- App shell ---------- */
.ok-app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.ok-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 18px 96px;
  gap: 16px;
  animation: ok-fade-in 0.35s ease both;
}

@keyframes ok-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Ambient ---------- */
.ok-stars, .ok-fireflies {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.ok-star {
  position: absolute;
  width: 2px; height: 2px;
  border-radius: 50%;
  background: #cdd6ff;
  opacity: 0.5;
  animation: ok-twinkle 4s ease-in-out infinite;
}
@keyframes ok-twinkle {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.7; }
}
.ok-firefly {
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 8px 2px rgba(240, 196, 106, 0.5);
  animation: ok-drift 11s ease-in-out infinite alternate, ok-twinkle 3.4s ease-in-out infinite;
}
@keyframes ok-drift {
  from { transform: translate(0, 0); }
  to { transform: translate(36px, -52px); }
}
@media (prefers-reduced-motion: reduce) {
  .ok-star, .ok-firefly { animation: none; }
}

.ok-content { position: relative; z-index: 1; }

/* ---------- Ornament ---------- */
.ok-ornament {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gold);
  font-size: 14px;
  opacity: 0.85;
}
.ok-ornament::before, .ok-ornament::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--hairline));
}
.ok-ornament::after {
  background: linear-gradient(90deg, var(--hairline), transparent);
}

/* ---------- Cards ---------- */
.ok-card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 16px;
  position: relative;
  backdrop-filter: blur(4px);
}
.ok-card--corners::before, .ok-card--corners::after {
  content: '✦';
  position: absolute;
  top: 6px;
  font-size: 10px;
  color: var(--gold);
  opacity: 0.7;
}
.ok-card--corners::before { left: 10px; }
.ok-card--corners::after { right: 10px; }

/* ---------- Buttons ---------- */
.ok-btn {
  font-family: 'Alegreya', serif;
  font-size: 17px;
  font-weight: 500;
  color: var(--parchment);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 13px 18px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.ok-btn:hover { background: rgba(217, 164, 65, 0.08); border-color: var(--gold); }
.ok-btn:active { transform: scale(0.98); }

.ok-btn--primary {
  font-family: 'Grenze Gotisch', serif;
  font-size: 21px;
  letter-spacing: 0.02em;
  color: #1b1408;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border: 1px solid var(--gold-bright);
  box-shadow: 0 2px 16px rgba(217, 164, 65, 0.25);
}
.ok-btn--primary:hover { background: linear-gradient(180deg, #f6cf7e, var(--gold-bright)); }
.ok-btn--primary:disabled {
  opacity: 0.4;
  cursor: default;
  box-shadow: none;
}
.ok-btn--ghost {
  border-color: transparent;
  color: var(--text-dim);
}

/* ---------- Name tiles (voting) ---------- */
.ok-name-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ok-name-tile {
  font-family: 'Grenze Gotisch', serif;
  font-size: 20px;
  font-weight: 500;
  color: var(--parchment);
  background: var(--panel);
  border: 1px solid var(--hairline-soft);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  min-height: 52px;
}
.ok-name-tile:hover { border-color: var(--gold); }
.ok-name-tile--sel {
  background: linear-gradient(180deg, rgba(240, 196, 106, 0.22), rgba(217, 164, 65, 0.12));
  border-color: var(--gold-bright);
  box-shadow: 0 0 18px rgba(240, 196, 106, 0.18);
  color: var(--gold-bright);
}
.ok-name-tile--dim { opacity: 0.32; cursor: default; }
.ok-name-tile--dim:hover { border-color: var(--hairline-soft); }

/* ---------- PIN ---------- */
.ok-pin-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.ok-pin-digit {
  width: 52px;
  height: 62px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Grenze Gotisch', serif;
  font-size: 30px;
  color: var(--gold-bright);
}
.ok-pin-digit--active {
  border-color: var(--gold-bright);
  box-shadow: 0 0 14px rgba(240, 196, 106, 0.2);
}
.ok-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.ok-key {
  font-family: 'Grenze Gotisch', serif;
  font-size: 23px;
  color: var(--parchment);
  background: var(--panel);
  border: 1px solid var(--hairline-soft);
  border-radius: 10px;
  padding: 12px 0;
  cursor: pointer;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.ok-key:active { background: rgba(217, 164, 65, 0.15); }

/* ---------- Bars ---------- */
.ok-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
}
.ok-bar-name { width: 72px; flex: none; }
.ok-bar-track {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.ok-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  transition: width 0.5s ease;
}
.ok-bar-count { width: 20px; flex: none; text-align: right; color: var(--text-dim); font-size: 15px; }

/* ---------- Tab bar ---------- */
.ok-tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  display: flex;
  background: rgba(13, 16, 36, 0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--hairline-soft);
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.ok-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 4px 12px;
  font-family: 'Grenze Gotisch', serif;
  font-size: 15px;
  color: var(--text-dim);
  cursor: pointer;
  border: none;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
}
.ok-tab--active { color: var(--gold-bright); }
.ok-tab-icon { font-size: 19px; line-height: 1; }

/* ---------- Wizard ---------- */
.ok-wizard {
  position: fixed;
  inset: 0;
  z-index: 30;
  background:
    radial-gradient(120% 60% at 50% 110%, var(--night-teal) 0%, transparent 60%),
    linear-gradient(180deg, var(--night-deep) 0%, var(--night-mid) 70%, var(--night-deep) 100%);
  overflow-y: auto;
}
.ok-wizard-inner {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 18px 18px 24px;
  gap: 14px;
  animation: ok-fade-in 0.3s ease both;
}
.ok-progress-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.ok-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  background: transparent;
}
.ok-dot--done { background: var(--gold); }
.ok-dot--active { background: var(--gold-bright); box-shadow: 0 0 8px rgba(240,196,106,.5); }

.ok-cat-emoji {
  font-size: 56px;
  text-align: center;
  line-height: 1;
  filter: drop-shadow(0 0 18px rgba(240, 196, 106, 0.35));
}

/* ---------- Podium / winners ---------- */
.ok-winner-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 15px;
  background: rgba(217, 164, 65, 0.08);
}

/* ---------- Lists ---------- */
.ok-rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--hairline-soft);
  border-radius: 12px;
  background: var(--panel);
}
.ok-rank-pos {
  font-family: 'Grenze Gotisch', serif;
  font-size: 21px;
  color: var(--gold);
  width: 26px;
  flex: none;
  text-align: center;
}

/* ---------- Misc ---------- */
.ok-h1 {
  font-family: 'Grenze Gotisch', serif;
  font-weight: 600;
  font-size: 34px;
  line-height: 1.05;
  margin: 0;
  text-wrap: pretty;
}
.ok-h2 {
  font-family: 'Grenze Gotisch', serif;
  font-weight: 500;
  font-size: 23px;
  margin: 0;
}
.ok-dim { color: var(--text-dim); }
.ok-small { font-size: 15px; }
.ok-center { text-align: center; }

.ok-input {
  font-family: 'Alegreya', serif;
  font-size: 17px;
  color: var(--parchment);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--hairline-soft);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
}
.ok-input:focus { outline: none; border-color: var(--gold); }

.ok-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 18, 0.6);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.ok-sheet {
  width: 100%;
  max-width: 430px;
  background: var(--panel-solid);
  border: 1px solid var(--hairline);
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  padding: 18px 18px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: ok-sheet-up 0.25s ease both;
}
@keyframes ok-sheet-up {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes ok-sparkle-pop {
  0% { transform: scale(0.4); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.ok-pop { animation: ok-sparkle-pop 0.45s ease both; }

/* ---------- Feinschliff ---------- */
@keyframes ok-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
.ok-shake { animation: ok-shake 0.4s ease; }

.ok-moon {
  font-size: 22px;
  filter: drop-shadow(0 0 10px rgba(205, 214, 255, 0.45));
}

/* Krönungs-Zeremonie */
.ok-ceremony-card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 18px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  animation: ok-crown-reveal 0.8s cubic-bezier(0.22, 1.2, 0.36, 1) both;
  position: relative;
  overflow: hidden;
}
.ok-ceremony-card::before {
  content: '';
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at 50% 30%, rgba(240, 196, 106, 0.16), transparent 55%);
  pointer-events: none;
}
@keyframes ok-crown-reveal {
  0% { opacity: 0; transform: translateY(26px) scale(0.92); }
  60% { opacity: 1; transform: translateY(-4px) scale(1.03); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.ok-ceremony-winner {
  font-family: 'Grenze Gotisch', serif;
  font-size: 32px;
  font-weight: 600;
  color: var(--gold-bright);
  text-shadow: 0 0 24px rgba(240, 196, 106, 0.4);
  line-height: 1.1;
}
.ok-ceremony-rays {
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 8px;
  opacity: 0.8;
}
@media (prefers-reduced-motion: reduce) {
  .ok-ceremony-card { animation: none; opacity: 1; }
  .ok-shake { animation: none; }
}
