@font-face { font-family: "Kenney Future"; src: url("ui-redesign/fonts/kenney-future.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Kenney Bold"; src: url("ui-redesign/fonts/kenney-bold.ttf") format("truetype"); font-display: swap; }

:root {
  color-scheme: dark;
  --ink: #0d1d2a;
  --panel: rgba(14, 31, 45, 0.88);
  --line: rgba(232, 244, 230, 0.26);
  --cream: #f7efd2;
  --gold: #ffd66c;
  --mint: #9ee1c0;
  --coral: #ef7a65;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #0a1822; }
body { color: var(--cream); font-family: "Kenney Future", "Trebuchet MS", sans-serif; touch-action: none; user-select: none; }
button, a { font: inherit; }
button { color: inherit; }

#skybound-app, #skybound-canvas { position: fixed; inset: 0; width: 100%; height: 100%; }
#skybound-canvas { display: block; background: linear-gradient(#7899b7, #f5cda8); }

.sb-hud {
  position: fixed; z-index: 4; top: max(12px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); right: max(14px, env(safe-area-inset-right));
  height: 54px; display: grid; grid-template-columns: 54px 1fr 54px; align-items: start; pointer-events: none;
}
.sb-icon-button { width: 50px; height: 50px; border: 1px solid var(--line); border-radius: 16px; display: grid; place-items: center; color: var(--cream); background: var(--panel); text-decoration: none; box-shadow: 0 8px 22px rgba(0,0,0,.22); pointer-events: auto; }
.sb-icon-button.home { font-size: 28px; line-height: 1; }
.sb-icon-button.pause { justify-self: end; font-family: "Kenney Bold"; letter-spacing: 3px; }
.sb-brand { justify-self: center; display: grid; justify-items: center; padding: 7px 18px 6px; border-radius: 15px; background: linear-gradient(180deg, rgba(13,29,42,.83), rgba(13,29,42,.58)); border: 1px solid rgba(255,255,255,.08); text-shadow: 0 2px 8px #0b1b29; }
.sb-brand strong { letter-spacing: .18em; font: 19px "Kenney Bold"; }
.eyebrow { color: var(--gold); font: 9px "Kenney Bold"; letter-spacing: .18em; }

.sb-stats { position: fixed; z-index: 3; top: max(78px, calc(env(safe-area-inset-top) + 70px)); left: 50%; transform: translateX(-50%); display: flex; gap: 3px; padding: 4px; border: 1px solid rgba(255,255,255,.1); background: rgba(11,25,36,.72); border-radius: 14px; backdrop-filter: blur(10px); }
.sb-stats div { min-width: 88px; padding: 6px 13px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; border-right: 1px solid rgba(255,255,255,.1); }
.sb-stats div:last-child { border: 0; }
.sb-stats span { color: #b8c8c3; font: 8px "Kenney Bold"; letter-spacing: .12em; }
.sb-stats strong { color: var(--cream); font: 14px "Kenney Bold"; }

.sb-controls-hint { position: fixed; z-index: 2; bottom: max(15px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; gap: 22px; padding: 8px 15px; color: rgba(247,239,210,.7); border-radius: 11px; background: rgba(9,21,31,.52); font-size: 8px; letter-spacing: .12em; }
.sb-toast { position: fixed; z-index: 8; top: 23%; left: 50%; transform: translate(-50%, -8px); padding: 12px 20px; border-radius: 18px; background: rgba(12,27,40,.92); border: 1px solid var(--gold); color: var(--gold); opacity: 0; transition: .2s ease; pointer-events: none; text-align: center; box-shadow: 0 12px 35px rgba(0,0,0,.3); }
.sb-toast.show { opacity: 1; transform: translate(-50%, 0); }

.sb-cover { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 22px; background: radial-gradient(circle at 50% 45%, rgba(59,91,107,.84), rgba(8,20,29,.98)); text-align: center; }
.sb-cover.hidden { display: none; }
.sb-cover h1 { margin: 20px 0 5px; font: 24px "Kenney Bold"; letter-spacing: .06em; }
.sb-cover p { color: #bfd0ca; max-width: 460px; line-height: 1.55; }
.sb-loading-mark { width: 120px; display: flex; justify-content: center; align-items: end; gap: 8px; }
.sb-loading-mark i { display: block; width: 18px; border-radius: 10px; background: var(--gold); animation: sb-pulse 1s ease-in-out infinite; }
.sb-loading-mark i:nth-child(1) { height: 24px; }
.sb-loading-mark i:nth-child(2) { height: 46px; animation-delay: .12s; }
.sb-loading-mark i:nth-child(3) { height: 31px; animation-delay: .24s; }
@keyframes sb-pulse { 0%,100% { transform: translateY(0); opacity: .45; } 50% { transform: translateY(-8px); opacity: 1; } }

.sb-dialog { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(4,13,20,.72); color: inherit; }
.sb-dialog[open] { display: grid; place-items: center; }
.sb-dialog::backdrop { background: rgba(4,13,20,.65); backdrop-filter: blur(5px); }
.sb-panel { width: min(410px, calc(100vw - 32px)); display: grid; gap: 12px; padding: 28px; border: 1px solid rgba(255,255,255,.18); border-radius: 25px; background: linear-gradient(150deg, #183548, #102635); box-shadow: 0 25px 70px rgba(0,0,0,.48); text-align: left; }
.sb-panel.compact { max-width: 450px; text-align: center; }
.sb-panel h2 { margin: 0 0 5px; font: 25px "Kenney Bold"; }
.sb-panel p { margin: 0 0 8px; color: #bed0ca; line-height: 1.55; }
.sb-panel button, .sb-primary, .sb-text-button { min-height: 48px; padding: 12px 17px; border: 1px solid rgba(255,255,255,.16); border-radius: 14px; background: #203e50; color: var(--cream); text-align: center; text-decoration: none; cursor: pointer; }
.sb-panel .sb-primary { background: var(--gold); color: #182430; border-color: #ffedaa; font-family: "Kenney Bold"; }
.sb-panel .sb-text-button { display: grid; place-items: center; background: transparent; }
.sb-pause-progress { display: grid; grid-template-columns: 1fr auto; gap: 9px 20px; margin: 5px 0 8px; padding: 14px; border-radius: 14px; background: rgba(3,15,23,.35); color: #b9cbc5; }
.sb-pause-progress strong { color: var(--gold); }
.sb-control-mode { display: flex; justify-content: space-between; gap: 16px; padding: 10px 14px; border-radius: 12px; background: rgba(3,15,23,.35); color: #b9cbc5; }
.sb-control-mode strong { color: var(--mint); text-align: right; }
.sb-rotate-hint { display: none; }

@media (pointer: coarse) {
  .sb-controls-hint span:first-child { display: none; }
  .sb-controls-hint span:last-child { font-size: 0; }
  .sb-controls-hint span:last-child::after { content: "TILT TO ROLL / TAP TO JUMP"; font-size: 8px; }
}
@media (orientation: portrait) and (max-width: 600px) {
  .sb-brand .eyebrow { display: none; }
  .sb-brand { padding-top: 12px; }
  .sb-brand strong { font-size: 15px; }
  .sb-stats { top: max(72px, calc(env(safe-area-inset-top) + 65px)); width: calc(100% - 70px); }
  .sb-stats div { flex: 1; min-width: 0; padding-inline: 8px; }
  .sb-stats span { display: none; }
  .sb-stats strong { margin: auto; }
  .sb-rotate-hint { display: block; position: fixed; z-index: 2; right: 8px; top: 48%; writing-mode: vertical-rl; color: rgba(255,255,255,.45); font-size: 7px; letter-spacing: .1em; }
}
@media (max-height: 520px) {
  .sb-hud { top: 7px; }
  .sb-stats { top: 67px; }
  .sb-controls-hint { bottom: 7px; }
  .sb-panel { padding: 20px; }
}

/* HUD refinements: pause stays centered while the course identity sits beside Home. */
.sb-brand { justify-self: start; margin-left: 10px; }
.sb-icon-button.pause { position: fixed; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 5; }
.sb-level-progress { position: fixed; z-index: 3; top: max(127px, calc(env(safe-area-inset-top) + 119px)); left: 50%; width: min(272px, calc(100vw - 100px)); height: 5px; transform: translateX(-50%); overflow: hidden; border-radius: 9px; background: rgba(8,22,31,.62); }
.sb-level-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--mint), var(--gold)); transition: width .3s ease; }
.sb-settings { border: 1px solid rgba(255,255,255,.13); border-radius: 14px; background: rgba(4,16,24,.26); }
.sb-settings summary { padding: 13px 15px; cursor: pointer; }
.sb-settings[open] { padding-bottom: 12px; }
.sb-settings label { display: grid; grid-template-columns: 1fr minmax(110px, 1.2fr); align-items: center; gap: 12px; padding: 7px 14px; color: #bed0ca; font-size: 9px; }
.sb-settings label.check { display: flex; }
.sb-settings input[type="checkbox"] { width: 18px; height: 18px; }
.sb-settings select { min-height: 36px; padding: 5px 8px; border: 1px solid rgba(255,255,255,.2); border-radius: 9px; color: var(--cream); background: #193343; }
.sb-dialog .sb-panel { max-height: calc(100svh - 30px); overflow-y: auto; }
@media (orientation: portrait) and (max-width: 600px) {
  .sb-brand { display: none; }
  .sb-level-progress { top: max(119px, calc(env(safe-area-inset-top) + 112px)); }
}
@media (max-height: 520px) {
  .sb-icon-button.pause { top: 7px; }
  .sb-level-progress { top: 116px; }
}
body.touch-fallback .sb-controls-hint span:last-child::after { content: "DRAG TO ROLL / TAP TO JUMP"; }
