/* Apple-level refinement for the lighthouse controls. */
html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
}

body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

button,
input,
textarea,
select {
  font-size: 16px;
}

.lighting-card,
.beacon-card {
  min-height: 0;
  background:
    radial-gradient(circle at 88% 0%, rgba(255,255,255,.075), transparent 32%),
    linear-gradient(145deg, rgba(255,255,255,.078), rgba(255,255,255,.026));
}

.lighting-card {
  gap: 20px;
}

.lighting-copy {
  position: relative;
  z-index: 1;
}

.lighting-panel {
  display: grid;
  grid-template-columns: minmax(210px, .82fr) minmax(0, 1.18fr);
  gap: 16px;
  align-items: stretch;
  margin-top: auto;
  position: relative;
  z-index: 1;
}

.lighting-switches {
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 30px;
  background: rgba(0,0,0,.12);
}

.lighting-channel {
  min-height: 74px;
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.07), rgba(255,255,255,.024)),
    rgba(0,0,0,.08);
}

.lighting-channel > strong {
  margin-left: auto;
  color: var(--soft);
  font-size: 11px;
  font-weight: 820;
  letter-spacing: .02em;
  transition: color .16s ease;
}

.lighting-channel.on > strong {
  color: #dcffed;
}

.lighting-power {
  width: 100%;
  min-height: 172px;
}

.beacon-card {
  gap: 18px;
}

.beacon-panel {
  display: grid;
  grid-template-columns: minmax(210px, .82fr) minmax(0, 1.18fr);
  gap: 16px;
  align-items: stretch;
  margin-top: auto;
  position: relative;
  z-index: 1;
}

.beacon-power {
  min-height: 172px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 22px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 30px;
  color: var(--muted);
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,.11), transparent 44%),
    linear-gradient(145deg, rgba(255,255,255,.072), rgba(255,255,255,.024));
  cursor: pointer;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.045), 0 18px 50px rgba(0,0,0,.2);
  transition: transform .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.beacon-power:hover {
  transform: translateY(-1px);
  border-color: rgba(126,240,183,.28);
}

.beacon-power b,
.advanced-summary b {
  display: block;
  font-size: 17px;
  letter-spacing: -.025em;
}

.beacon-power small,
.advanced-summary small {
  display: block;
  margin-top: 5px;
  color: var(--soft);
  font-size: 11px;
  line-height: 1.35;
}

.beacon-power-orb {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 24px;
  background: rgba(255,255,255,.055);
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.beacon-power-orb svg {
  width: 31px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
}

.beacon-power.on {
  color: #dcffed;
  border-color: rgba(126,240,183,.36);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 0 48px rgba(126,240,183,.09);
}

.beacon-power.on .beacon-power-orb {
  color: #112016;
  background: linear-gradient(135deg, #dffff0, var(--green));
  box-shadow: 0 0 36px rgba(126,240,183,.2);
}

.beacon-controls {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 30px;
  background: rgba(0,0,0,.12);
  transition: opacity .2s ease, filter .2s ease;
}

.beacon-panel.is-off .beacon-controls {
  opacity: .42;
  filter: saturate(.7);
}

.beacon-control-group {
  display: grid;
  gap: 10px;
}

.beacon-speed-slider {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
  background: rgba(255,255,255,.055);
}

.beacon-speed-slider button {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 820;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, opacity .16s ease;
}

.beacon-speed-slider button.active {
  color: #15120b;
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  box-shadow: 0 8px 22px rgba(0,0,0,.18);
}

.beacon-speed-slider button:disabled,
.reverse-toggle:disabled {
  cursor: not-allowed;
}

.reverse-toggle {
  min-height: 68px;
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.07), rgba(255,255,255,.024)),
    rgba(0,0,0,.08);
}

.reverse-toggle.on i,
.lighting-channel.on i {
  background: rgba(126,240,183,.42);
}

.reverse-toggle.on i::after,
.lighting-channel.on i::after {
  transform: translateX(18px);
  background: #effff7;
}

.advanced-card {
  min-height: 0;
  display: block;
  padding: 0;
  overflow: hidden;
}

.advanced-card::before {
  display: none;
}

.advanced-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  cursor: pointer;
  list-style: none;
}

.advanced-summary::-webkit-details-marker {
  display: none;
}

.advanced-summary::after {
  content: "⌄";
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 999px;
  color: var(--soft);
  background: rgba(255,255,255,.045);
  transition: transform .18s ease;
}

.advanced-card[open] .advanced-summary::after {
  transform: rotate(180deg);
}

.advanced-summary em {
  margin-left: auto;
  color: var(--soft);
  font-size: 11px;
  font-style: normal;
  font-weight: 760;
  white-space: nowrap;
}

.advanced-body {
  padding: 0 22px 22px;
}

.advanced-card textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: none;
  padding: 14px 15px;
  color: var(--text);
  background: rgba(0,0,0,.22);
  line-height: 1.45;
}

.advanced-card textarea:focus {
  border-color: rgba(242,200,111,.42);
}

.toggle-inline {
  min-height: 52px;
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(0,0,0,.14);
}

.toggle-inline input {
  width: 22px !important;
  min-height: 22px !important;
  accent-color: var(--gold);
}

footer {
  justify-content: flex-end;
}

@supports (-webkit-touch-callout: none) {
  body {
    min-height: -webkit-fill-available;
  }
}

@media (max-width: 880px) {
  .lighting-panel,
  .beacon-panel {
    grid-template-columns: 1fr;
  }

  .beacon-power,
  .lighting-power {
    min-height: 138px;
  }
}

@media (max-width: 700px) {
  .shell {
    width: 100%;
    padding: max(10px, env(safe-area-inset-top)) max(11px, env(safe-area-inset-right)) max(46px, env(safe-area-inset-bottom)) max(11px, env(safe-area-inset-left));
  }

  .topbar,
  .hero,
  .section-heading,
  .control-grid,
  .control-card,
  .message-shell {
    width: 100%;
    max-width: 100%;
  }

  .topbar {
    gap: 10px;
  }

  .brand {
    min-width: 0;
  }

  .brand > span:last-child {
    min-width: 0;
  }

  .brand strong,
  .brand small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hero {
    padding: 26px 20px;
  }

  .hero h1 {
    font-size: clamp(38px, 12vw, 48px);
    line-height: .95;
  }

  .hero p {
    font-size: 15px;
  }

  .hero-signal-link {
    width: 100%;
  }

  .hero-orbit {
    width: min(225px, 78vw);
  }

  .section-heading {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .section-heading .button {
    width: 100%;
  }

  .lighting-card,
  .beacon-card {
    border-radius: 28px;
  }

  .control-card {
    min-height: auto;
    padding: 20px;
    gap: 16px;
  }

  .lighting-switches,
  .beacon-controls {
    padding: 14px;
    border-radius: 24px;
  }

  .lighting-channel,
  .reverse-toggle {
    min-height: 68px;
  }

  .lighting-channel {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 12px;
  }

  .lighting-channel > strong {
    display: none;
  }

  .beacon-speed-slider button {
    min-height: 46px;
  }

  .spectrum-layout {
    min-width: 0;
  }

  .color-row {
    flex-wrap: wrap;
  }

  .split-actions {
    grid-template-columns: 1fr;
  }

  .advanced-summary {
    align-items: flex-start;
  }

  .advanced-summary em {
    display: none;
  }

  footer {
    align-items: flex-end;
  }
}

@media (max-width: 390px) {
  .shell {
    padding-left: 8px;
    padding-right: 8px;
  }

  .control-card,
  .hero {
    border-radius: 24px;
  }

  .beacon-power-orb {
    width: 62px;
    height: 62px;
    border-radius: 22px;
  }

  .lighting-switches,
  .beacon-controls {
    padding: 12px;
  }
}
