/* Le Poste : un seul écran. Ciel qui change de teinte selon la station, poste qui flotte au-dessus d'une mer en facettes, puis les commandes. */
@property --top  { syntax: "<color>"; inherits: true; initial-value: #0a2550; }
@property --mid  { syntax: "<color>"; inherits: true; initial-value: #1b5aa6; }
@property --glow { syntax: "<color>"; inherits: true; initial-value: #49a6ee; }
:root {
  --top: #0a2550; --mid: #1b5aa6; --glow: #49a6ee;
  --fg: #ffffff;
  --sage: #c4d4ae;
  --orange: #f0782a;
  --orange-deep: #b4531a;
  --soft: rgba(255,255,255,.14);
  --display: "Hammersmith One", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
  transition: --top 1.2s ease, --mid 1.2s ease, --glow 1.2s ease;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--top); color: var(--fg); font-family: var(--body); font-size: 15px; overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
* { box-sizing: border-box; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }

.sky {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(120% 60% at 50% 42%, color-mix(in srgb, var(--glow) 70%, transparent) 0%, transparent 60%),
    linear-gradient(180deg, var(--top) 0%, var(--mid) 62%, var(--top) 100%);
}

.app {
  height: 100%; max-width: 440px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 12px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

header { display: flex; align-items: center; justify-content: space-between; flex: none; min-height: 34px; }
header h1 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 22px; letter-spacing: .06em; text-transform: uppercase; }

/* Scène */
.scene { position: relative; flex: 1; min-height: 170px; overflow: hidden; margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); }
.cloud { position: absolute; width: 60px; height: 22px; border-radius: 20px; background: rgba(255,255,255,.16); animation: drift linear infinite; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: inherit; border-radius: 50%; }
.cloud::before { width: 30px; height: 30px; left: 10px; top: -14px; }
.cloud::after  { width: 22px; height: 22px; left: 30px; top: -9px; }
.c1 { top: 12%; animation-duration: 38s; animation-delay: -6s; }
.c2 { top: 34%; transform: scale(1.5); animation-duration: 55s; animation-delay: -30s; opacity: .7; }
.c3 { top: 6%;  transform: scale(.8); animation-duration: 46s; animation-delay: -20s; opacity: .8; }
@keyframes drift { from { left: -90px; } to { left: 110%; } }

.radio-wrap { position: absolute; left: 50%; bottom: 64px; width: min(210px, 56vw); transform: translateX(-50%); }
.radio { width: 100%; display: block; transform-origin: 50% 80%; }
.is-on .radio { animation: bob 3.2s ease-in-out infinite; }
.hop .radio { animation: hop .55s cubic-bezier(.3,1.6,.5,1), bob 3.2s ease-in-out .55s infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-10px) rotate(2deg); } }
@keyframes hop { 0% { transform: translateY(0) scale(1); } 40% { transform: translateY(-26px) scale(1.06, .95); } 100% { transform: translateY(0) scale(1); } }
.shadow { position: absolute; left: 50%; bottom: 48px; width: 130px; height: 14px; margin-left: -65px; border-radius: 50%; background: rgba(0,0,0,.25); filter: blur(4px); }
.is-on .shadow { animation: shade 3.2s ease-in-out infinite; }
@keyframes shade { 0%,100% { transform: scaleX(1); } 50% { transform: scaleX(.82); opacity: .7; } }
.w { fill: none; stroke: #fff; stroke-width: 4; stroke-linecap: round; opacity: 0; }
.is-playing .w { animation: wave 1.8s ease-out infinite; }
.w2 { animation-delay: .35s !important; } .w3 { animation-delay: .7s !important; }
@keyframes wave { 0% { opacity: 0; transform: translateX(8px); } 30% { opacity: .85; } 100% { opacity: 0; transform: translateX(-14px); } }
#needleR { transition: transform .6s cubic-bezier(.3,1.5,.5,1); }

.sea { position: absolute; left: 0; bottom: 0; width: 200%; height: 70px; animation: roll 22s linear infinite; }
.sea.back { bottom: 14px; height: 60px; animation-duration: 34s; opacity: .55; }
@keyframes roll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* Infos et lecture */
.info { display: flex; align-items: center; gap: 14px; flex: none; }
.info > div { min-width: 0; flex: 1; }
.live { display: inline-flex; align-items: center; gap: 7px; font-family: var(--display); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--sage); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sage); }
.is-playing .dot { background: var(--orange); box-shadow: 0 0 8px var(--orange); }
.is-wait .dot { background: var(--orange); animation: blink 1s steps(2, start) infinite; }
.is-offline .dot { background: #ff8f80; }
@keyframes blink { to { visibility: hidden; } }
.info h2 { margin: 2px 0 0; font-family: var(--display); font-weight: 400; font-size: 27px; line-height: 1.1; text-wrap: balance; text-shadow: 0 2px 12px rgba(0,0,0,.25); }
.info p { margin: 2px 0 0; color: var(--sage); font-size: 13.5px; }
.play {
  width: 72px; height: 72px; flex: none; border-radius: 50%; border: 0;
  background: radial-gradient(circle at 35% 30%, #ff9d55, var(--orange) 60%);
  color: #2a1406; display: grid; place-items: center;
  box-shadow: 0 6px 0 var(--orange-deep), 0 14px 22px rgba(0,0,0,.3);
  transition: transform .1s, box-shadow .1s;
}
.play:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--orange-deep), 0 6px 12px rgba(0,0,0,.3); }
.play svg { width: 28px; height: 28px; fill: currentColor; }

/* Stations */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: none; }
.stn {
  min-height: 56px; padding: 6px 8px; border: 0; border-radius: 18px;
  background: var(--soft);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 4px 0 rgba(0,0,0,.2), 0 8px 14px rgba(0,0,0,.12);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  transition: background .25s, color .25s, transform .1s, box-shadow .1s;
}
.stn:active { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 0 rgba(0,0,0,.2); }
.stn b { font-family: var(--display); font-weight: 400; font-size: 14.5px; letter-spacing: .05em; text-transform: uppercase; }
.stn small { font-size: 11.5px; color: var(--sage); }
@media (hover: hover) { .stn:hover { background: rgba(255,255,255,.22); } }
.stn.on {
  background: radial-gradient(120% 90% at 30% 20%, #cddba8, #93a86e 70%); color: #26311a;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 4px 0 #56663f, 0 10px 18px rgba(0,0,0,.22);
}
.stn.on small { color: #45532f; }

footer { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex: none; }
.chip { border: 0; background: var(--soft); border-radius: 999px; padding: 8px 15px; box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 3px 0 rgba(0,0,0,.2); font-family: var(--display); font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; }
.chip:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 0 rgba(0,0,0,.2); }
.chip b { font-weight: 400; color: var(--orange); font-variant-numeric: tabular-nums; }
.hint { font-size: 12px; color: var(--sage); text-align: right; }

/* Fenêtre « installer » */
.overlay { position: fixed; inset: 0; background: rgba(5,10,25,.55); display: flex; align-items: flex-end; justify-content: center; z-index: 20; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.sheet { width: 100%; max-width: 420px; background: color-mix(in srgb, var(--top) 85%, #000); border-radius: 22px; padding: 20px 18px 16px; box-shadow: 0 -4px 30px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.15); }
.sheet h3 { margin: 0 0 10px; font-family: var(--display); font-weight: 400; font-size: 19px; text-wrap: balance; }
.sheet ol { margin: 0 0 14px; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; line-height: 1.4; }
.sheet ol b { color: var(--orange); font-weight: 700; }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  .radio, .shadow, .cloud, .sea, .w { animation: none !important; }
  .cloud { left: 20%; } .c2 { left: 70%; } .c3 { left: 45%; }
  :root { transition: none; }
}
