/* ---------- The Crisis Dial: a 1950s tube radio ---------- */
.dial-sec {
  background-color: var(--teal-night);
  background-image:
    radial-gradient(circle at 18% 30%, rgba(92,200,192,0.28), transparent 42%),
    radial-gradient(circle at 85% 80%, rgba(242,112,92,0.18), transparent 40%),
    radial-gradient(circle at 30% 40%, rgba(255,255,255,0.5) 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 70% 20%, rgba(255,233,166,0.5) 0 1px, transparent 1.6px);
  background-size: auto, auto, 110px 110px, 83px 83px;
  position: relative;
  color: var(--cream);
  overflow: hidden;
}
.dial-sec .wrap { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 56px; align-items: center; }

/* two-tone turquoise-and-cream plastic cabinet with chrome trim, the Home of Tomorrow model */
.radio {
  position: relative; width: 100%; max-width: 440px; margin: 0 auto;
  padding: 18px 22px 22px; border-radius: 60px 60px 26px 26px;
  background:
    linear-gradient(100deg, rgba(255,255,255,0.32), transparent 28%, rgba(0,0,0,0.12) 75%),
    linear-gradient(180deg, #6FD3CB 0%, var(--aqua) 55%, #3FA9A2 100%);
  box-shadow: inset 0 3px 0 rgba(255,255,255,0.45), inset 0 -8px 0 rgba(0,0,0,0.16), 0 0 0 5px #E8ECEF, 0 0 0 8px var(--night), 0 26px 50px rgba(0,0,0,0.5);
}
.radio::before { /* chrome speaker slots on the cream panel */
  content: ""; position: absolute; left: 22px; right: 22px; bottom: 16px; height: 120px; border-radius: 18px; pointer-events: none;
  background: repeating-linear-gradient(180deg, transparent 0 9px, rgba(18,61,71,0.18) 9px 12px), var(--cream);
  box-shadow: inset 0 0 0 3px #E8ECEF, inset 0 0 0 5px rgba(18,61,71,0.4);
}
.radio > * { position: relative; }
.radio::after { /* chrome boomerang feet */
  content: ""; position: absolute; left: 12%; right: 12%; bottom: -16px; height: 16px;
  background: linear-gradient(90deg, #C9D0D5 0 34px, transparent 34px calc(100% - 34px), #C9D0D5 calc(100% - 34px));
  border-radius: 0 0 16px 16px;
}
.radio-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.radio-brand { font-family: var(--script); font-size: 2.1rem; line-height: 1; color: var(--cream); text-shadow: 2px 2px 0 var(--coral-deep), 4px 4px 0 var(--night); white-space: nowrap; }
.radio-model { font-family: var(--label); font-weight: 400; font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--teal-night); text-align: right; max-width: 11em; line-height: 1.5; }

/* chrome bezel + glass */
.dial-bezel {
  position: relative; aspect-ratio: 1; border-radius: 50%; padding: 12px;
  background: conic-gradient(from 210deg, #F4F4F0, #9A9A94, #FFFFFF, #7D7D78, #E7E7E0, #9A9A94, #F4F4F0);
  box-shadow: 0 0 0 3px var(--night), inset 0 0 0 2px rgba(0,0,0,0.35), 0 10px 22px rgba(0,0,0,0.45);
}
.dial-bezel::after { /* glass reflection */
  content: ""; position: absolute; inset: 12px; border-radius: 50%; pointer-events: none;
  background: linear-gradient(150deg, rgba(255,255,255,0.38), rgba(255,255,255,0) 38%), radial-gradient(circle at 50% 50%, transparent 62%, rgba(0,0,0,0.25) 100%);
}
.dial-face { display: block; width: 100%; height: 100%; border-radius: 50%; cursor: pointer; overflow: visible; -webkit-tap-highlight-color: transparent; }
.seg-label { font-family: "Cinzel", Georgia, serif; font-weight: 700; font-size: 15px; letter-spacing: 0.5px; fill: #FFF6DF; paint-order: stroke; stroke: rgba(40,20,10,0.45); stroke-width: 2.5px; stroke-linejoin: round; pointer-events: none; }
.seg-lit { fill: #FFE48A; opacity: 0; transition: opacity .12s ease; }
.seg.lit .seg-lit { opacity: 0.45; }
.is-done .seg.lit .seg-lit { animation: segpulse 0.9s ease-in-out infinite alternate; }
@keyframes segpulse { from { opacity: 0.25; } to { opacity: 0.7; } }
.tick { stroke: #6B3F22; stroke-width: 1.5; }
.tick-major { stroke: var(--night); stroke-width: 3; }
.freq { font-family: var(--title); font-weight: 700; font-size: 15px; fill: #7E1F24; }
.ring { fill: none; stroke: var(--night); stroke-width: 3; }
.callsign { font-family: var(--title); font-weight: 900; font-size: 26px; fill: var(--navy); letter-spacing: 1px; }
.kc { font-family: "Cinzel", Georgia, serif; font-weight: 700; font-size: 11px; letter-spacing: 3px; fill: #6B3F22; }
.glow { fill: url(#dg-glow); opacity: 0; transition: opacity .6s ease; pointer-events: none; }
.is-spinning .glow { opacity: 0.85; }
.is-done .glow { opacity: 0.3; }
.needle { filter: drop-shadow(2px 4px 2px rgba(0,0,0,0.35)); }

/* controls: lamp, knob, sound */
.radio-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-top: 16px; }
.lamp { display: inline-flex; align-items: center; gap: 8px; font-family: var(--label); font-weight: 400; font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--teal-night); }
.lamp i { width: 16px; height: 16px; border-radius: 50%; background: #5A1A14; box-shadow: inset 0 -2px 3px rgba(0,0,0,0.5), 0 0 0 2px var(--night); transition: background .3s ease, box-shadow .3s ease; }
.is-spinning .lamp, .is-done .lamp { color: var(--cherry); }
.is-spinning .lamp i, .is-done .lamp i { background: #FF5A3C; box-shadow: 0 0 0 2px var(--night), 0 0 14px 4px rgba(255,90,60,0.75); }
.knob {
  width: 92px; height: 92px; border-radius: 50%; border: 0; cursor: pointer; padding: 0; position: relative;
  background: radial-gradient(circle at 38% 32%, #FFFFFF 0 18%, transparent 19%),
              repeating-conic-gradient(#9AA3AA 0 6deg, #E8ECEF 6deg 12deg);
  box-shadow: 0 0 0 4px var(--coral), 0 0 0 7px var(--night), 0 8px 0 7px rgba(0,0,0,0.3);
  transition: transform .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.knob span {
  position: absolute; inset: 14px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 40% 35%, #FF9A88, var(--coral) 55%, var(--coral-deep));
  color: var(--cream); font-family: var(--label); font-weight: 400; font-size: 0.9rem; letter-spacing: 0.1em; text-transform: uppercase;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.5), inset 0 -3px 4px rgba(0,0,0,0.3);
}
.knob:hover { transform: rotate(-20deg); }
.knob:active { transform: rotate(-50deg) scale(0.96); }
.is-spinning .knob { animation: knobturn 0.5s linear infinite; }
@keyframes knobturn { to { transform: rotate(360deg); } }
.knob:disabled, .dial-copy .btn:disabled { cursor: progress; }
.sound-btn {
  justify-self: end; background: var(--cream); color: var(--teal-night); cursor: pointer;
  font-family: var(--label); font-weight: 400; font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase;
  border: 2px solid var(--teal-night); border-radius: 999px; padding: 7px 10px;
}
.sound-btn[aria-pressed="false"] { opacity: 0.6; text-decoration: line-through; }

/* sparks when the dial lands */
.spark { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px; pointer-events: none; z-index: 3;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: spark 1.2s cubic-bezier(.2,.7,.3,1) forwards; }
@keyframes spark { 0% { transform: translate(0,0) scale(0.4) rotate(0); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(var(--x), var(--y)) scale(1.5) rotate(var(--r)); opacity: 0; } }

/* idle invitation: the needle sways a little until the first spin */
@media (prefers-reduced-motion: no-preference) {
  .dial-sec:not(.is-spinning):not(.is-done) .needle { animation: sway 2.6s ease-in-out infinite; transform-box: view-box; transform-origin: 50% 50%; }
  @keyframes sway { 0%,100% { rotate: -8deg; } 50% { rotate: 8deg; } }
}

/* copy + result card */
.dial-copy { display: grid; gap: 16px; min-width: 0; }
.dial-copy h2 { font-size: clamp(2rem, 4.2vw, 3rem); color: var(--cream); text-shadow: 3px 3px 0 var(--coral-deep); }
.dial-copy .label { color: var(--mustard); }
.dial-out {
  background: var(--cream); color: var(--ink); padding: 18px 22px; border-radius: 24px 24px 24px 6px; display: grid; gap: 6px;
  min-height: 112px; border-left: 0; position: relative;
  box-shadow: 0 0 0 3px var(--mustard), 8px 10px 0 3px var(--coral);
}
.dial-out b { font-family: var(--title); font-weight: 900; font-size: 1.3rem; }
.dial-out.waiting { place-items: center start; }
.wait-line { font-family: var(--title); font-style: italic; font-size: 1.3rem; animation: blink 0.9s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.55; } }

.dial-out.reveal { grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: 24px; align-items: center; padding: 22px; border-left-color: var(--oxblood); animation: pop .45s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.reveal-cover { position: relative; perspective: 900px; }
.reveal-cover a { display: block; position: relative; z-index: 1; }
.reveal-cover img { width: 100%; box-shadow: 0 14px 26px rgba(43,31,23,0.45); border: 3px solid var(--night); animation: flipin .8s cubic-bezier(.2,1.2,.4,1) both; }
@keyframes flipin { from { transform: rotateY(85deg) scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }
.rays {
  position: absolute; left: 50%; top: 50%; width: 170%; aspect-ratio: 1; translate: -50% -50%; z-index: 0; border-radius: 50%;
  background: repeating-conic-gradient(rgba(217,162,40,0.55) 0 10deg, transparent 10deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%); mask: radial-gradient(circle, #000 30%, transparent 70%);
  animation: rays 14s linear infinite;
}
@keyframes rays { to { rotate: 360deg; } }
.reveal-stamp {
  position: absolute; z-index: 2; right: -14px; bottom: 10%; rotate: -10deg;
  background: var(--oxblood); color: var(--cream); padding: 6px 12px; border: 2px dashed var(--cream); outline: 3px solid var(--oxblood);
  font-family: var(--label); font-weight: 400; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap;
  animation: stamp .5s .5s cubic-bezier(.2,1.6,.4,1) both;
}
@keyframes stamp { from { scale: 2.4; opacity: 0; } to { scale: 1; opacity: 1; } }
.reveal-text { display: grid; gap: 8px; min-width: 0; }
.reveal-kicker { font-family: var(--label); font-weight: 400; font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--teal-deep); }
.reveal-crisis { font-size: clamp(1.25rem, 2.4vw, 1.6rem) !important; line-height: 1.2; color: var(--oxblood-deep); }
.reveal-calm { font-style: italic; color: var(--ink-soft); }
.reveal-title { font-family: var(--title); font-weight: 900; font-size: clamp(1.4rem, 2.8vw, 2rem); line-height: 1.1; color: var(--navy); text-decoration: none; }
.reveal-title:hover { text-decoration: underline; }
.reveal-text .row { margin-top: 8px; }
.is-done .dial-copy > .row { display: none; }

@media (max-width: 900px) {
  .dial-sec .wrap { grid-template-columns: 1fr; gap: 40px; }
}
@media (max-width: 600px) {
  .radio { padding: 14px 14px 18px; border-radius: 26px 26px 14px 14px; }
  .radio-brand { font-size: 1.6rem; }
  .radio-model { font-size: 0.52rem; }
  .knob { width: 78px; height: 78px; }
  .knob span { inset: 12px; font-size: 0.75rem; }
  .dial-out.reveal { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 26px 18px; }
  .reveal-cover { width: min(230px, 70%); margin-bottom: 8px; }
  .reveal-text .row { justify-content: center; }
}
