/* Tide Sailor - title, HUD, touch sliders and the end panel over the canvas (frame.css sets the page and the back link) */
html, body { touch-action: none; }
body { background: #0c2a36; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
body > canvas { position: fixed; inset: 0; width: 100%; height: 100%; }
body.ts-attract { cursor: pointer; }

/* title over the attract mode */
.ts-title { position: fixed; inset: 0; z-index: 12; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 8vh 20px calc(7vh + env(safe-area-inset-bottom)); box-sizing: border-box; text-align: center; pointer-events: none; transition: opacity 0.5s; background: linear-gradient(rgb(14 30 52 / 0.34), rgb(14 30 52 / 0) 34%, rgb(14 30 52 / 0) 74%, rgb(14 30 52 / 0.38)); }
.ts-title.ts-hide { opacity: 0; }
.ts-title-top { display: flex; flex-direction: column; align-items: center; }
.ts-title-name { margin: 0; font-size: clamp(44px, 9vw, 108px); line-height: 1; font-weight: 800; letter-spacing: -0.035em; color: #fff; text-shadow: 0 2px 34px rgb(16 36 64 / 0.5), 0 1px 3px rgb(16 36 64 / 0.4); }
.ts-title-tag { margin: 16px 0 0; font-size: clamp(12px, 1.5vw, 15px); line-height: 20px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: rgb(255 255 255 / 0.92); text-shadow: 0 1px 10px rgb(16 36 64 / 0.75); }
.ts-title-go { margin: 0; padding: 10px 22px; border-radius: 9999px; background: rgb(10 24 40 / 0.5); border: 1px solid rgb(255 255 255 / 0.22); font-size: clamp(14px, 2.2vw, 18px); line-height: 24px; font-weight: 600; color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: ts-breathe 2.4s ease-in-out infinite; }
@keyframes ts-breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.62; } }

/* HUD */
.ts-hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; opacity: 0; transition: opacity 0.5s; }
.ts-hud.ts-show { opacity: 1; }
.ts-top { position: absolute; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 16px; box-sizing: border-box; border-radius: 9999px; background: rgb(8 20 32 / 0.5); border: 1px solid rgb(255 255 255 / 0.12); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); white-space: nowrap; text-shadow: 0 1px 4px rgb(0 0 0 / 0.4); }
.ts-pips { display: flex; gap: 6px; }
.ts-pip { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--c); box-sizing: border-box; opacity: 0.8; transition: background 0.4s, box-shadow 0.4s; }
.ts-pip.ts-lit { background: var(--c); opacity: 1; box-shadow: 0 0 9px var(--c); }
.ts-count { font-size: 13px; line-height: 20px; font-weight: 700; font-variant-numeric: tabular-nums; color: rgb(255 255 255 / 0.75); }
.ts-time { font-size: 16px; line-height: 20px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 54px; }
.ts-gust { font-size: 11px; line-height: 16px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #bfe9ff; opacity: 0.25; transition: opacity 0.3s; }
.ts-gust.ts-show { opacity: 1; }
.ts-compass { position: absolute; top: calc(58px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right)); width: 128px; height: 128px; display: block; }

.ts-trim { position: absolute; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 6px 18px 6px 6px; border-radius: 9999px; background: rgb(8 20 32 / 0.42); border: 1px solid rgb(255 255 255 / 0.1); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.ts-gauge { width: 104px; height: 104px; display: block; }
.ts-trim-text { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 214px; }
.ts-trim-state { font-size: 14px; line-height: 20px; font-weight: 700; text-shadow: 0 1px 6px rgb(0 0 0 / 0.5); white-space: nowrap; }
.ts-speed { font-size: 24px; line-height: 30px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.ts-auto { position: relative; height: 20px; width: 150px; border-radius: 10px; overflow: hidden; background: rgb(255 255 255 / 0.1); }
.ts-auto-fill { position: absolute; inset: 0; background: rgb(191 233 255 / 0.3); transform-origin: 0 50%; }
.ts-auto.ts-ready .ts-auto-fill { background: rgb(95 224 138 / 0.42); }
.ts-auto.ts-on .ts-auto-fill { background: rgb(95 224 138 / 0.85); }
.ts-auto-label { position: relative; display: block; padding: 0 10px; font-size: 11px; line-height: 20px; font-weight: 700; letter-spacing: 0.04em; }

.ts-hint { position: absolute; left: 50%; top: calc(62px + env(safe-area-inset-top)); transform: translateX(-50%); width: max-content; max-width: 90vw; box-sizing: border-box; padding: 10px 18px 12px; border-radius: 14px; background: rgb(8 20 32 / 0.62); opacity: 0; transition: opacity 0.9s; }
.ts-hint.ts-show { opacity: 1; }
.ts-hint-row { margin: 0; display: flex; gap: 12px; font-size: 13px; line-height: 22px; }
.ts-hint-row b { display: inline-block; min-width: 110px; text-align: right; color: #ffe2a0; white-space: pre; }
.ts-hint-goal { margin: 6px 0 0; font-size: 13px; line-height: 18px; font-weight: 700; color: #bfe9ff; text-align: center; }
.ts-toast { position: absolute; left: 50%; top: 22%; transform: translate(-50%, 8px); padding: 6px 16px; border-radius: 9999px; background: rgb(8 20 32 / 0.62); border: 1.5px solid var(--c, #fff); color: #fff; font-size: 16px; line-height: 24px; font-weight: 700; white-space: nowrap; opacity: 0; transition: opacity 0.3s, transform 0.3s; }
.ts-toast.ts-show { opacity: 1; transform: translate(-50%, 0); }

/* mute, top right */
.ts-tools { position: fixed; z-index: 50; top: calc(12px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right)); display: flex; gap: 8px; }
.ts-tool { width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 1px solid rgb(255 255 255 / 0.16); background: rgb(15 15 15 / 0.6); color: #fff; cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.ts-tool:hover { background: rgb(15 15 15 / 0.85); }
.ts-tool:focus-visible, .ts-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.ts-tool svg { display: block; width: 20px; height: 20px; margin: auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ts-tool svg path:first-child { fill: currentColor; }
.ts-mute .ts-off { display: none; }
.ts-mute.ts-muted .ts-off { display: inline; }
.ts-mute.ts-muted .ts-on { display: none; }

/* touch: rudder slider on the left, sail slider on the right (only on touch devices) */
.ts-touch { display: none; position: fixed; inset: 0; z-index: 11; pointer-events: none; }
.ts-touch.ts-show { display: block; }
.ts-slider { position: absolute; pointer-events: auto; touch-action: none; border-radius: 9999px; background: rgb(8 20 32 / 0.45); border: 1px solid rgb(255 255 255 / 0.24); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.ts-rudder { left: calc(18px + env(safe-area-inset-left)); bottom: calc(24px + env(safe-area-inset-bottom)); width: 180px; height: 60px; }
.ts-sheet { right: calc(18px + env(safe-area-inset-right)); bottom: calc(24px + env(safe-area-inset-bottom)); width: 60px; height: 180px; }
.ts-knob { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: rgb(255 255 255 / 0.88); box-shadow: 0 2px 10px rgb(0 0 0 / 0.3); pointer-events: none; }
.ts-held .ts-knob { background: #ffe2a0; }
.ts-slider-label, .ts-slider-end { position: absolute; font-size: 10px; line-height: 14px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: rgb(255 255 255 / 0.75); pointer-events: none; text-shadow: 0 1px 4px rgb(0 0 0 / 0.5); }
.ts-slider-label { left: 0; right: 0; top: -20px; text-align: center; }
.ts-slider-end { left: 0; right: 0; text-align: center; }
.ts-end-out { top: -20px; }
.ts-end-in { bottom: -20px; }
.ts-trimbtn { position: absolute; pointer-events: auto; touch-action: none; right: calc(92px + env(safe-area-inset-right)); bottom: calc(24px + env(safe-area-inset-bottom)); width: 60px; height: 60px; padding: 0; overflow: hidden; border-radius: 50%; border: 1px solid rgb(255 255 255 / 0.24); background: rgb(8 20 32 / 0.45); color: #fff; font: inherit; font-size: 13px; font-weight: 800; }
.ts-trimbtn-fill { position: absolute; inset: 0; background: rgb(191 233 255 / 0.25); transform-origin: 50% 100%; z-index: -1; }
.ts-trimbtn { isolation: isolate; }
.ts-trimbtn.ts-ready .ts-trimbtn-fill { background: rgb(95 224 138 / 0.45); }

/* the end of the round */
.ts-over { position: fixed; inset: 0; z-index: 15; display: flex; align-items: center; justify-content: center; padding: 20px; box-sizing: border-box; background: rgb(4 10 26 / 0.3); opacity: 0; visibility: hidden; transition: opacity 0.6s, visibility 0.6s; }
.ts-over.ts-show { opacity: 1; visibility: visible; }
.ts-card { width: min(400px, 100%); box-sizing: border-box; padding: 26px 28px 24px; border-radius: 22px; background: rgb(10 18 40 / 0.8); border: 1px solid rgb(255 255 255 / 0.14); text-align: center; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transform: translateY(12px); transition: transform 0.6s; }
.ts-over.ts-show .ts-card { transform: none; }
.ts-over-head { margin: 0; font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: #ffd78a; }
.ts-over-title { margin: 8px 0 0; font-size: 22px; line-height: 28px; font-weight: 800; }
.ts-over-time { margin: 12px 0 0; font-size: 54px; line-height: 60px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ts-over-best { margin: 2px 0 20px; font-size: 14px; line-height: 20px; color: rgb(255 255 255 / 0.7); }
.ts-over-best.ts-new { color: #5fe08a; font-weight: 700; }
.ts-btn { height: 46px; padding: 0 30px; border: 0; border-radius: 9999px; background: #ffd78a; color: #2a1a02; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; transition: transform 0.15s, background 0.15s; }
.ts-btn:hover { background: #ffe4aa; transform: translateY(-1px); }
.ts-btn:active { transform: scale(0.97); }
.ts-over-keys { margin: 10px 0 0; font-size: 12px; line-height: 16px; color: rgb(255 255 255 / 0.5); }
.ts-over-keys:empty { display: none; }

@media (max-width: 720px) {
  .ts-compass { width: 96px; height: 96px; }
  .ts-top { top: calc(56px + env(safe-area-inset-top)); gap: 9px; padding: 0 12px; }
  .ts-compass { top: calc(100px + env(safe-area-inset-top)); }
  .ts-trim { padding-right: 14px; gap: 8px; }
  .ts-gauge { width: 84px; height: 84px; }
  .ts-trim-text { min-width: 0; }
  .ts-trim-state { white-space: normal; font-size: 12px; line-height: 16px; max-width: 170px; }
  .ts-speed { font-size: 20px; line-height: 24px; }
  .ts-hint { top: calc(206px + env(safe-area-inset-top)); }
  .ts-hint-row b { min-width: 0; }
  .ts-is-touch .ts-trim { left: calc(18px + env(safe-area-inset-left)); transform: none; bottom: calc(118px + env(safe-area-inset-bottom)); padding-right: 12px; }
  .ts-is-touch .ts-gauge { width: 72px; height: 72px; }
  .ts-is-touch .ts-trim-state { max-width: 150px; }
  .ts-is-touch .ts-auto { width: 140px; }
}
@media (max-height: 460px) {
  .ts-compass { width: 92px; height: 92px; top: calc(54px + env(safe-area-inset-top)); }
  .ts-gauge { width: 80px; height: 80px; }
  .ts-hint { top: calc(56px + env(safe-area-inset-top)); }
  .ts-toast { top: 30%; }
}
