:root {
  --cream: #f4f0e7;
  --ink: #191a17;
  --muted: #aaa99f;
  --panel: rgba(50, 48, 38, .78);
  --line: rgba(255,255,255,.10);
  --aqua: #4bd6c7;
  --green: #86c96d;
  --gold: #f6b83d;
  --blue: #52a7ff;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: #090a08;
  color: #f8f8f4;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

.app-shell {
  width: min(100%, 920px);
  min-height: 100vh;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(circle at 80% 12%, rgba(130,104,46,.18), transparent 25%),
    linear-gradient(180deg, #1c1c16, #13140f 70%, #0d0e0b);
  box-shadow: 0 0 70px rgba(0,0,0,.65);
}

.hero {
  position: relative;
  min-height: 610px;
  padding: 34px 34px 92px;
  overflow: hidden;
}
.hero-image {
  position: absolute;
  inset: 0;
  background: var(--cabana-bg) center 43% / cover no-repeat;
  transform: scale(1.015);
}
.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8,10,7,.87) 0%, rgba(8,10,7,.44) 43%, rgba(8,10,7,.05) 70%),
    linear-gradient(180deg, rgba(3,4,3,.16), rgba(12,13,10,.02) 46%, #1a1b15 100%);
}
.hero-top, .welcome, .wifi-status { position: relative; z-index: 1; }
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: white; text-decoration: none; letter-spacing: .13em; }
.brand-mark {
  width: 48px; height: 48px; display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,.5); border-radius: 18px 18px 20px 20px;
  color: #c4d36f; font-size: 29px; transform: rotate(-3deg);
}
.brand strong { display: block; font-family: Georgia, serif; font-size: 17px; font-weight: 600; }
.brand small { display: block; margin-top: 4px; font-size: 9px; letter-spacing: .32em; color: #e8e8df; }
.weather { display: flex; align-items: center; gap: 9px; text-align: left; color: #f6f5eb; }
.weather-icon { font-size: 29px; }
.weather strong, .weather small { display: block; }
.weather strong { font-size: 14px; }
.weather small { font-size: 10px; color: #d2d1c8; }
.clock { padding-left: 15px; margin-left: 8px; border-left: 1px solid rgba(255,255,255,.35); }

.welcome { width: min(360px, 55%); margin-top: 102px; text-shadow: 0 2px 14px rgba(0,0,0,.65); }
.eyebrow { color: #c5d279 !important; letter-spacing: .18em; font-size: 11px !important; font-weight: 700; }
.welcome h1 { margin: 8px 0 12px; font-size: clamp(30px, 5vw, 43px); line-height: 1.05; }
.welcome h2 { margin: 0 0 8px; font-size: 18px; }
.welcome p { margin: 0; max-width: 300px; color: #e0e1da; font-size: 14px; line-height: 1.55; }
.continue-button {
  width: min(100%, 300px);
  min-height: 56px;
  margin-top: 20px;
  padding: 14px 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 3px solid rgba(255,255,255,.92);
  border-radius: 14px;
  background: #2f9f50;
  color: white;
  box-shadow: 0 10px 30px rgba(5,76,27,.42);
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: .035em;
  text-transform: uppercase;
  text-shadow: none;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.continue-button:hover {
  background: #38b55d;
  box-shadow: 0 12px 32px rgba(0,0,0,.34);
  transform: translateY(-2px);
}
.continue-button:active { transform: translateY(0); }
.continue-button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.continue-button.is-starting { cursor: progress; }
.continue-button.is-active {
  border-color: rgba(255,255,255,.92);
  background: #247c3d;
  color: white;
}
.continue-button:disabled { opacity: .92; }
.continue-arrow { font-size: 1.35em; line-height: 1; transition: transform .18s ease; }
.continue-button:hover .continue-arrow { transform: translateX(3px); }
.stop-button {
  width: min(100%, 300px);
  min-height: 62px;
  margin-top: 12px;
  padding: 14px 20px;
  border: 3px solid rgba(255,255,255,.92);
  border-radius: 14px;
  background: #d92727;
  color: white;
  box-shadow: 0 10px 30px rgba(103,0,0,.45);
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: .035em;
  text-shadow: none;
  cursor: pointer;
}
.stop-button:hover { background: #ee3030; transform: translateY(-1px); }
.stop-button:active { transform: scale(.98); }
.stop-button:focus-visible { outline: 3px solid white; outline-offset: 3px; }
#aviso-audio {
  display: block;
  width: min(100%, 300px);
  margin-top: 10px;
  color: #e4e4dc;
  font-weight: 700;
  text-shadow: 0 2px 9px rgba(0,0,0,.8);
}
.voice-status {
  width: min(100%, 300px);
  margin-top: 12px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 10px;
  background: rgba(12,14,11,.62);
  color: #f1f1e9;
  font-size: 11px;
  line-height: 1.35;
  text-shadow: none;
  backdrop-filter: blur(8px);
}
.voice-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: #aaa99f;
  box-shadow: 0 0 0 4px rgba(170,169,159,.12);
}
.voice-status[data-state="listening"] .voice-dot {
  background: var(--aqua);
  box-shadow: 0 0 0 5px rgba(75,214,199,.18);
  animation: voice-pulse 1.2s infinite;
}
.voice-status[data-state="playing"] .voice-dot { background: var(--green); }
.voice-status[data-state="searching"] .voice-dot,
.voice-status[data-state="waiting"] .voice-dot { background: var(--gold); }
.voice-status[data-state="heard"] .voice-dot { background: var(--blue); }
@keyframes voice-pulse {
  50% { transform: scale(1.28); box-shadow: 0 0 0 8px rgba(75,214,199,.08); }
}
.wifi-status {
  position: absolute; right: 27px; bottom: 102px;
  display: flex; align-items: center; gap: 9px;
  padding: 15px 17px; min-width: 142px;
  border: 1px solid rgba(255,255,255,.14); border-radius: 14px;
  background: rgba(24,27,23,.72); backdrop-filter: blur(10px);
}
.wifi-symbol { color: var(--aqua); font-size: 30px; transform: rotate(90deg); }
.wifi-status small, .wifi-status strong, .wifi-status em { display: block; font-style: normal; }
.wifi-status small { font-size: 12px; }
.wifi-status strong { margin: 3px 0; font-size: 11px; font-weight: 500; }
.wifi-status em { color: #77cf7d; font-size: 11px; }

main { position: relative; z-index: 2; padding: 0 25px 28px; }
.device-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 13px;
  margin-top: -79px;
}
.device-card {
  min-height: 166px; padding: 18px 8px 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,.72); border-radius: 15px;
  background: var(--cream); color: var(--ink); cursor: pointer;
  box-shadow: 0 13px 22px rgba(0,0,0,.18); transition: transform .18s ease, background .18s ease;
}
.device-card:hover { transform: translateY(-3px); }
.device-card:active { transform: scale(.98); }
.device-card.active { background: #fff; box-shadow: 0 0 0 3px rgba(75,214,199,.35), 0 13px 22px rgba(0,0,0,.22); }
.device-card.lights.is-on {
  background: #3ca85c;
  color: white;
  border-color: #bff2cb;
  box-shadow: 0 0 0 3px rgba(74,201,105,.34), 0 13px 25px rgba(5,67,24,.35);
}
.device-card.lights.is-on small { color: #ecfff0; }
.device-card.lights.is-on .icon-bubble { background: rgba(255,255,255,.22); color: white; }
.device-card.tv.is-sending { opacity: .72; cursor: progress; }
.device-card.tv.is-on-tv {
  background: #2f9f50;
  color: white;
  border-color: #bff2cb;
}
.device-card.tv.is-on-tv small { color: #edfff2; }
.device-card strong { margin-top: 10px; font-size: 15px; }
.device-card small { margin-top: 7px; color: #686963; font-size: 11px; }
.icon-bubble { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; font-size: 28px; }
.music .icon-bubble { background: #e5dcfa; color: #684dde; }
.lights .icon-bubble { background: #f8e7bd; color: #de9a18; }
.temp .icon-bubble { background: #f9dcd5; color: #e45c44; }
.tv .icon-bubble { background: #caeeea; color: #168c87; }
.door .icon-bubble { background: #dbe8fa; color: #3e72c9; }

.youtube-panel {
  min-height: 250px;
  margin-top: 20px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) minmax(190px, .65fr);
  gap: 17px;
  align-items: center;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px;
  background: rgba(30,31,25,.94);
}
.youtube-panel[hidden] { display: none; }
#youtube-player, #youtube-player iframe {
  width: 100%;
  min-width: 200px;
  min-height: 225px;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 10px;
}
.youtube-caption { padding: 10px; }
.youtube-caption strong, .youtube-caption small { display: block; }
.youtube-caption strong { font-size: 18px; line-height: 1.35; }
.youtube-caption small { margin-top: 10px; color: #bbb9ae; line-height: 1.5; }

.status-panel {
  display: grid; grid-template-columns: repeat(4, 1fr);
  margin-top: 20px; padding: 19px 13px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); backdrop-filter: blur(8px);
}
.metric { min-height: 83px; padding: 4px 15px; display: flex; gap: 12px; align-items: center; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric-icon { font-size: 25px; }
.violet { color: #8189dc; } .blue { color: var(--blue); } .gold { color: var(--gold); }
.green-shield { width: 35px; height: 41px; display: grid; place-items: center; border: 2px solid var(--green); border-radius: 48% 48% 58% 58%; color: var(--green); }
.metric small, .metric strong, .metric em { display: block; font-style: normal; }
.metric small { white-space: nowrap; color: #d3d2ca; font-size: 10px; }
.metric strong { margin: 7px 0 6px; font-size: 24px; line-height: 1; font-weight: 500; }
.metric strong b { font-size: .62em; font-weight: 500; }
.metric em { font-size: 10px; }
.green { color: var(--green); } .blue-text { color: #66aaff; }

.thanks-card {
  min-height: 212px; margin-top: 20px; display: grid; grid-template-columns: 1.05fr .95fr;
  overflow: hidden; border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(115deg, rgba(61,57,44,.95), rgba(30,31,25,.92));
}
.thanks-card > div:first-child { padding: 28px 31px; }
.thanks-card h2 { margin: 0 0 15px; font-size: 17px; }
.thanks-card h2 span { color: #9ecf67; }
.thanks-card p { margin: 0 0 18px; color: #d9d8d0; font-size: 13px; line-height: 1.55; }
.thanks-card button {
  padding: 12px 18px; border: 0; border-radius: 9px;
  background: #f2d0a0; color: #40362d; cursor: pointer;
}
.thanks-photo {
  background:
    linear-gradient(90deg, rgba(37,37,29,.55), transparent 42%),
    var(--cabana-bg, url("../img/cabana-1.jpeg")) center 57% / cover no-repeat;
}
.quick-access { margin-top: 20px; }
.quick-access h2 { margin: 0 0 12px; font-size: 14px; }
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.quick-grid button {
  min-height: 55px; padding: 9px 12px; display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 1px solid rgba(255,255,255,.3); border-radius: 8px; background: #efede6; color: #41423d; cursor: pointer;
}
.quick-grid span { font-size: 20px; color: #6a6d68; }
.quick-grid .info { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #5595d4; color: white; font-size: 14px; font-weight: 700; }
.quick-grid .danger { width: 23px; height: 21px; color: white; background: #c7443f; clip-path: polygon(50% 0,100% 100%,0 100%); padding-top: 3px; font-size: 13px; font-weight: 800; }

.bottom-nav {
  display: grid; grid-template-columns: repeat(4, 1fr); padding: 13px 20px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(38,38,31,.85);
}
.bottom-nav button { padding: 6px; border: 0; background: none; color: #aaa99f; cursor: pointer; }
.bottom-nav button span { display: block; margin-bottom: 3px; font-size: 24px; }
.bottom-nav .selected { color: var(--aqua); }
footer { padding: 25px 18px 31px; text-align: center; color: #77776f; font-size: 10px; }
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 20; transform: translate(-50%, 20px);
  padding: 12px 18px; border: 1px solid rgba(255,255,255,.15); border-radius: 999px;
  background: rgba(12,14,12,.92); color: white; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .hero { min-height: 585px; padding: 24px 20px 90px; }
  .hero-top { align-items: flex-start; }
  .brand-mark { width: 40px; height: 40px; font-size: 23px; }
  .brand strong { font-size: 13px; }
  .weather { gap: 5px; }
  .weather-icon { font-size: 21px; }
  .weather strong { font-size: 11px; }
  .weather small { font-size: 8px; }
  .clock { padding-left: 8px; margin-left: 3px; }
  .welcome { width: 67%; margin-top: 115px; }
  .welcome h1 { font-size: 31px; }
  .welcome h2 { font-size: 15px; }
  .welcome p { font-size: 12px; }
  .continue-button { max-width: 280px; min-height: 54px; margin-top: 16px; }
  .stop-button { max-width: 280px; min-height: 58px; }
  .wifi-status { right: 16px; bottom: 99px; min-width: 125px; padding: 11px 12px; }
  main { padding: 0 14px 22px; }
  .device-grid { grid-template-columns: repeat(5, minmax(112px, 1fr)); gap: 9px; margin-top: -70px; overflow-x: auto; padding: 2px 2px 14px; scroll-snap-type: x mandatory; }
  .device-card { min-height: 145px; scroll-snap-align: start; }
  .youtube-panel { grid-template-columns: 1fr; }
  .status-panel { grid-template-columns: repeat(2, 1fr); padding: 7px; }
  .metric { border-right: 0; border-bottom: 1px solid var(--line); padding: 13px 10px; }
  .metric:nth-child(odd) { border-right: 1px solid var(--line); }
  .metric:nth-last-child(-n+2) { border-bottom: 0; }
  .metric small { white-space: normal; }
  .thanks-card { grid-template-columns: 1fr; }
  .thanks-card > div:first-child { padding: 24px; }
  .thanks-photo { min-height: 155px; background-position: center 49%; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .bottom-nav { position: sticky; bottom: 0; z-index: 10; padding: 9px 8px max(9px, env(safe-area-inset-bottom)); backdrop-filter: blur(13px); }
  .bottom-nav button { font-size: 11px; }
  .bottom-nav button span { font-size: 20px; }
}

@media (max-width: 430px) {
  .hero-image { background-position: center 41%; }
  .weather .clock { display: none; }
  .welcome { width: 73%; margin-top: 125px; }
  .continue-button { width: 100%; padding-inline: 18px; font-size: .98rem; }
  .stop-button { width: 100%; font-size: .96rem; }
  .wifi-status { bottom: 95px; }
  .status-panel { grid-template-columns: 1fr; }
  .metric, .metric:nth-child(odd) { border-right: 0; border-bottom: 1px solid var(--line); }
  .metric:last-child { border-bottom: 0; }
  .quick-grid button { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
