/* DRAGONRIDERS XLII: HUD-Doktrin: Navigation oben links (hinter den
   Arcade-Buttons), Werte oben rechts, unten frei fuer Touch. */

:root {
  --amber: #ffb347;
  --amber2: #ff8c2e;
  --teal: #57d9c2;
  --txt: #f3ede2;
  --dim: #b7ac98;
  --glas: rgba(16, 14, 22, 0.72);
  --glas2: rgba(30, 24, 38, 0.82);
  --rand: rgba(255, 179, 71, 0.35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #0a0e18;
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  color: var(--txt);
  -webkit-user-select: none; user-select: none;
  touch-action: none;
}

#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }

/* ============================= Logo ============================= */
.logo {
  font-size: clamp(34px, 7vw, 64px);
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--txt);
  text-shadow: 0 2px 0 #3a2410, 0 6px 24px rgba(255, 140, 46, 0.45);
}
.logo .riders { color: var(--amber); }
.logo .xlii {
  display: inline-block;
  font-size: 0.55em;
  vertical-align: 0.28em;
  padding: 0.05em 0.3em;
  margin-left: 0.15em;
  color: #1a1206;
  background: linear-gradient(180deg, var(--amber), var(--amber2));
  border-radius: 0.15em;
  box-shadow: 0 3px 14px rgba(255, 140, 46, 0.5);
  letter-spacing: 0.12em;
}

/* ============================= Laden / Titel ============================= */
#loading {
  position: fixed; inset: 0; z-index: 900;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
  background: radial-gradient(ellipse at 50% 30%, #1d2440 0%, #0a0e18 70%);
}
#loading p { color: var(--dim); letter-spacing: 0.2em; text-transform: uppercase; font-size: 12px; }

.overlay {
  position: fixed; inset: 0; z-index: 800;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 8, 14, 0.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.overlay-soft {
  position: fixed; inset: 0; z-index: 700;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.overlay-soft .modal { pointer-events: auto; }

.title-inner { text-align: center; padding: 24px; max-width: 640px; }
.tagline { margin: 14px 0 26px; color: var(--dim); font-size: 17px; letter-spacing: 0.04em; }

.cta {
  font: inherit; font-weight: 800; font-size: 20px;
  letter-spacing: 0.14em;
  color: #1a1206;
  background: linear-gradient(180deg, var(--amber), var(--amber2));
  border: 0; border-radius: 10px;
  padding: 14px 44px;
  cursor: pointer;
  box-shadow: 0 6px 26px rgba(255, 140, 46, 0.45);
  transition: transform 0.15s;
}
.cta:hover { transform: scale(1.05); }
.cta:active { transform: scale(0.97); }

.ghost {
  font: inherit; font-size: 15px;
  color: var(--txt);
  background: transparent;
  border: 1px solid var(--rand); border-radius: 10px;
  padding: 12px 24px;
  cursor: pointer;
}
.ghost:hover { background: var(--glas2); }

.ctrl-hint { margin-top: 30px; font-size: 13px; color: var(--txt); line-height: 1.7; }
.ctrl-hint .dim, .dim { color: var(--dim); }
.ctrl-hint b { color: var(--amber); }

.modal {
  background: var(--glas2);
  border: 1px solid var(--rand);
  border-radius: 14px;
  padding: 26px 30px;
  min-width: 280px; max-width: 92vw;
  text-align: center;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 14px 60px rgba(0, 0, 0, 0.6);
}
.modal h2 { margin-bottom: 12px; letter-spacing: 0.04em; }
.modal-row { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.re-line {
  display: flex; justify-content: space-between; gap: 26px;
  padding: 6px 0; border-bottom: 1px solid rgba(255, 179, 71, 0.12);
  font-size: 15px;
}
.re-line b { color: var(--amber); }

/* ============================= Orb-Menue ============================= */
#hud { position: fixed; inset: 0; z-index: 500; pointer-events: none; }
#hud button { pointer-events: auto; }
#hud .panel { pointer-events: auto; }

/* Zwei-Orb-Doktrin: der Arcade-Orb des SDK sitzt GANZ links oben
   (left:12px, endet bei ca. 58px). Unser Game-Orb folgt direkt
   daneben ab left:70px, gleiche Hoehe. */
#orb {
  position: fixed; left: 70px; top: 12px; z-index: 520;
  width: 42px; height: 42px; border-radius: 50%;
  cursor: pointer; padding: 0;
  border: 1px solid var(--rand);
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 235, 200, 0.5), transparent 45%),
    radial-gradient(circle at 60% 72%, rgba(255, 140, 46, 0.6), transparent 60%),
    rgba(30, 24, 38, 0.8);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5), 0 0 0 4px rgba(255, 140, 46, 0.08);
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.2, 1);
}
#orb:hover { transform: scale(1.08); }
body.orbauf #orb { transform: rotate(45deg) scale(1.05); box-shadow: 0 4px 22px rgba(0, 0, 0, 0.6), 0 0 0 7px rgba(255, 140, 46, 0.16); }
.orb-kern {
  position: absolute; inset: 10px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--amber), transparent 70%);
  opacity: 0.9; animation: orbAtmen 4s ease-in-out infinite;
}
.orb-ring {
  position: absolute; inset: 3px; border-radius: 50%;
  border: 1px dashed rgba(255, 179, 71, 0.6);
  animation: orbDreh 20s linear infinite;
}
@keyframes orbAtmen { 0%, 100% { transform: scale(0.85); opacity: 0.6; } 50% { transform: scale(1.08); opacity: 1; } }
@keyframes orbDreh { to { transform: rotate(360deg); } }

#orbmenu { position: fixed; left: 70px; top: 62px; z-index: 515; display: flex; flex-direction: column; gap: 8px; }
.orbblatt {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--rand);
  background: var(--glas2);
  color: var(--txt); font-size: 18px;
  cursor: pointer; position: relative;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: translateY(-14px) scale(0.4); pointer-events: none !important;
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.25, 1.2), opacity 0.2s;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
body.orbauf .orbblatt { opacity: 1; transform: none; pointer-events: auto !important; }
.orbblatt:nth-child(2) { transition-delay: 0.03s; }
.orbblatt:nth-child(3) { transition-delay: 0.06s; }
.orbblatt:nth-child(4) { transition-delay: 0.09s; }
.orbblatt:hover { border-color: var(--amber); }
.orbblatt em {
  position: absolute; left: 50px; white-space: nowrap;
  font-style: normal; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  background: var(--glas); border: 1px solid var(--rand);
  padding: 3px 9px; border-radius: 10px;
  opacity: 0; transform: translateX(-6px);
  transition: opacity 0.15s, transform 0.15s;
  pointer-events: none;
}
.orbblatt:hover em { opacity: 1; transform: none; }

/* ============================= Panels ============================= */
.panel {
  position: fixed; left: 12px; top: 62px; bottom: 130px; z-index: 510;
  width: min(360px, calc(100vw - 24px));
  background: var(--glas);
  border: 1px solid var(--rand); border-radius: 14px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: flex; flex-direction: column;
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.55);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid rgba(255, 179, 71, 0.15);
}
.panel-head h2 { font-size: 15px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); }
.panel-close {
  background: none; border: 0; color: var(--dim); font-size: 22px; cursor: pointer; line-height: 1;
}
.panel-close:hover { color: var(--txt); }
.panel-body { overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }

.dragon-card, .course-card, .opt-row {
  font: inherit; text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 179, 71, 0.18);
  border-radius: 10px;
  color: var(--txt);
  padding: 10px 12px;
  cursor: pointer;
  display: block; width: 100%;
}
.dragon-card:hover, .course-card:hover, .opt-row:hover { border-color: var(--amber); background: rgba(255, 179, 71, 0.08); }
.dragon-card.active { border-color: var(--amber); box-shadow: 0 0 0 2px rgba(255, 179, 71, 0.3); }
.dragon-card .swatch { float: right; width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.4); }
.dc-name, .cc-name { display: block; font-weight: 800; font-size: 15px; letter-spacing: 0.03em; }
.dc-name em, .cc-name em { font-style: normal; font-weight: 400; color: var(--dim); font-size: 12px; margin-left: 6px; }
.dc-blurb, .cc-desc { display: block; font-size: 12px; color: var(--dim); margin: 4px 0 8px; line-height: 1.45; }
.stat { display: flex; align-items: center; gap: 8px; font-size: 10px; color: var(--dim); margin-top: 3px; }
.stat span { width: 74px; text-transform: uppercase; letter-spacing: 0.08em; }
.stat .bar { flex: 1; height: 5px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; }
.stat .bar div { height: 100%; background: linear-gradient(90deg, var(--teal), var(--amber)); border-radius: 3px; }
.opt-row b { color: var(--amber); font-weight: 700; }

/* ============================= Werte oben rechts ============================= */
#topright {
  position: fixed; top: 10px; right: 12px; z-index: 505;
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px;
  text-align: right;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}
#player-name {
  font-size: 12px; color: var(--teal); font-weight: 700;
  background: var(--glas); border: 1px solid rgba(87, 217, 194, 0.3);
  border-radius: 9px; padding: 3px 10px; margin-bottom: 3px;
}
.statline { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.statline .lbl { color: var(--dim); font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; }
.statline b { font-size: 17px; font-variant-numeric: tabular-nums; min-width: 74px; }
#stat-score { color: var(--amber); font-size: 21px !important; }
#stamina {
  width: 130px; height: 7px; margin-top: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px; overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.4);
}
#stamina-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #57d9c2, #9be15d); transition: width 0.15s linear; border-radius: 4px; }
#stamina-fill.low { background: linear-gradient(90deg, #e05c3a, #ffb347); }
#stat-mode { font-size: 11px; color: var(--dim); letter-spacing: 0.06em; margin-top: 2px; }
#ring-info { font-size: 14px; color: var(--amber); font-weight: 800; font-variant-numeric: tabular-nums; }
#version-tag { font-size: 10px; color: rgba(183, 172, 152, 0.6); margin-top: 4px; }

/* ============================= Pfeil zum Ring ============================= */
#ring-arrow {
  position: fixed; top: 12vh; left: 50%; transform: translateX(-50%);
  z-index: 504; display: flex; flex-direction: column; align-items: center; gap: 2px;
  pointer-events: none;
}
#ring-arrow .ra-rot { display: block; font-size: 30px; color: var(--amber); text-shadow: 0 0 12px rgba(255, 140, 46, 0.8); transform-origin: 50% 50%; }
#ring-arrow .ra-dist { font-size: 11px; color: var(--txt); text-shadow: 0 1px 3px #000; }

/* ============================= Hinweis + Toasts ============================= */
#hint {
  position: fixed; bottom: 22vh; left: 50%; transform: translateX(-50%);
  z-index: 504; max-width: 88vw; text-align: center;
  font-size: 14px; color: var(--txt);
  background: var(--glas); border: 1px solid rgba(255, 179, 71, 0.2);
  padding: 7px 16px; border-radius: 20px;
  pointer-events: none;
}
#toasts {
  position: fixed; top: 18vh; left: 50%; transform: translateX(-50%);
  z-index: 506; display: flex; flex-direction: column; align-items: center; gap: 6px;
  pointer-events: none;
}
.toast {
  font-size: 15px; font-weight: 700; color: var(--amber);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
  animation: toastRein 0.25s ease-out;
  transition: opacity 0.5s, transform 0.5s;
}
.toast.big { font-size: 21px; color: var(--txt); }
.toast.out { opacity: 0; transform: translateY(-16px); }
@keyframes toastRein { from { opacity: 0; transform: translateY(10px) scale(0.9); } }

/* ============================= Touch ============================= */
#touch-ui { position: fixed; inset: 0; z-index: 503; pointer-events: none; }
#stick {
  position: fixed; left: 18px; bottom: 22px;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.18);
  pointer-events: auto;
  touch-action: none;
}
#stick .knob {
  position: absolute; left: 50%; top: 50%;
  width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 235, 200, 0.5), rgba(255, 140, 46, 0.35));
  border: 1px solid var(--rand);
}
#rightbtns {
  position: fixed; right: 16px; bottom: 22px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
}
#rightbtns button {
  pointer-events: auto; touch-action: none;
  font: inherit; font-weight: 800; font-size: 13px; letter-spacing: 0.08em;
  color: var(--txt);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  background: var(--glas2); border: 1px solid var(--rand);
  border-radius: 50%;
}
#rightbtns button span { font-size: 9px; letter-spacing: 0.12em; color: var(--dim); }
#btn-flap { width: 92px; height: 92px; font-size: 26px !important; }
#btn-dive { width: 72px; height: 72px; font-size: 20px !important; }
#btn-roar { width: 52px; height: 52px; font-size: 20px !important; }
#rightbtns button.held { background: rgba(255, 140, 46, 0.35); border-color: var(--amber); }

#btn-mount {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  z-index: 507;
  font: inherit; font-weight: 800; font-size: 16px; letter-spacing: 0.06em;
  color: #1a1206;
  background: linear-gradient(180deg, var(--amber), var(--amber2));
  border: 0; border-radius: 24px;
  padding: 12px 28px;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(255, 140, 46, 0.5);
}

@media (max-width: 640px) {
  /* Schmaler Schirm: beide Orbs bleiben nebeneinander (zusammen nur
     ~128px breit), das Menue faehrt als Reihe aus. */
  #orbmenu { flex-direction: row; }
  .orbblatt em { display: none; }
  .panel { top: 168px; bottom: 170px; }
  .statline b { font-size: 15px; min-width: 60px; }
  #stat-score { font-size: 18px !important; }
}
