:root {
  color-scheme: dark;
  font-family: "Avenir Next", "Nunito", "Segoe UI", sans-serif;
  --night: #0d1117;
  --night-2: #151b2e;
  --panel: #fff8f0;
  --ink: #18202f;
  --muted: #5a6578;
  --grass: #4caf50;
  --sun: #ffd600;
  --berry: #e91e63;
  --cyan: #00bcd4;
  --lavender: #b39ddb;
  --stop: #ff1744;
  --line: rgba(13, 17, 23, 0.16);
  --shadow: 0 18px 0 rgba(4, 7, 16, 0.36), 0 28px 52px rgba(0, 0, 0, 0.26);
  background: var(--night);
  color: var(--panel);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(115deg, rgba(76, 175, 80, 0.18) 0 14%, transparent 14% 100%),
    linear-gradient(245deg, transparent 0 64%, rgba(0, 188, 212, 0.2) 64% 78%, transparent 78% 100%),
    linear-gradient(180deg, #0d1117 0%, #141a2c 52%, #19223a 100%);
}

button,
input,
select,
textarea,
summary {
  font: inherit;
}

button,
summary {
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.18);
  opacity: 0.72;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 5px solid rgba(255, 214, 0, 0.78);
  outline-offset: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shell {
  width: min(100%, 1160px);
  margin: 0 auto;
  padding: 1rem clamp(0.9rem, 3vw, 1.5rem) 2.5rem;
}

h1 {
  margin: 0 0 0.85rem;
  color: #ffffff;
  font-size: clamp(1.55rem, 3vw, 2.45rem);
  line-height: 1;
  font-weight: 950;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
}

.status {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border: 2px solid rgba(255, 248, 240, 0.24);
  border-radius: 0.75rem;
  background: rgba(13, 17, 23, 0.68);
  color: rgba(255, 248, 240, 0.88);
  font-weight: 800;
  line-height: 1.35;
}

.toddler-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(180px, 0.55fr) minmax(220px, 0.75fr);
  align-items: center;
  gap: 1rem;
  min-height: 250px;
  padding: clamp(1.1rem, 3vw, 1.75rem);
  border: 3px solid rgba(255, 248, 240, 0.18);
  border-radius: 0.5rem;
  background:
    linear-gradient(90deg, rgba(255, 214, 0, 0.2) 0 6px, transparent 6px 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04)),
    #11192a;
  box-shadow: var(--shadow);
}

.hero-copy {
  min-width: 0;
}

.eyebrow {
  width: fit-content;
  margin: 0 0 0.7rem;
  padding: 0.45rem 0.7rem;
  border-radius: 0.45rem;
  background: var(--sun);
  color: #19202d;
  font-size: 0.8rem;
  font-weight: 950;
  text-transform: uppercase;
}

.hero-copy h2 {
  max-width: 9ch;
  margin: 0;
  color: #ffffff;
  font-size: clamp(3rem, 9vw, 5.9rem);
  line-height: 0.92;
  font-weight: 950;
  letter-spacing: 0;
  text-shadow: 0 7px 0 rgba(0, 0, 0, 0.35);
}

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.label-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  margin-top: 0.7rem;
  padding: 0.3rem;
  border: 2px solid rgba(255, 248, 240, 0.24);
  border-radius: 0.6rem;
  background: rgba(13, 17, 23, 0.48);
}

.label-toggle-button {
  min-height: 2.65rem;
  padding: 0.35rem 0.55rem;
  border: 2px solid rgba(255, 248, 240, 0.3);
  border-radius: 0.45rem;
  background: rgba(255, 248, 240, 0.12);
  color: #fff8f0;
  font-size: 0.86rem;
  font-weight: 950;
}

.label-toggle-button span {
  display: block;
}

.label-toggle-button.active {
  background: var(--sun);
  color: #18202f;
}

.status-pill {
  min-height: 2.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.8rem;
  border: 2px solid rgba(255, 248, 240, 0.26);
  border-radius: 0.6rem;
  background: rgba(255, 248, 240, 0.12);
  color: #fff8f0;
  font-weight: 950;
}

.status-pill.is-connected {
  background: var(--grass);
  color: #07120a;
  border-color: rgba(255, 255, 255, 0.38);
}

.status-pill.is-disconnected {
  background: var(--stop);
  color: #ffffff;
}

.dog-mascot {
  position: relative;
  width: min(100%, 210px);
  aspect-ratio: 1;
  margin: 0 auto;
  filter: drop-shadow(0 16px 0 rgba(0, 0, 0, 0.26));
}

.dog-head {
  position: absolute;
  inset: 19% 11% 7%;
  border: 7px solid #18202f;
  border-radius: 44% 44% 34% 34%;
  background: #fff8f0;
  box-shadow: inset 0 -18px 0 rgba(179, 157, 219, 0.32);
}

.dog-ear {
  position: absolute;
  top: 13%;
  width: 34%;
  height: 42%;
  border: 7px solid #18202f;
  background: var(--cyan);
}

.dog-ear-left {
  left: 2%;
  border-radius: 62% 28% 48% 30%;
  transform: rotate(-22deg);
}

.dog-ear-right {
  right: 2%;
  border-radius: 28% 62% 30% 48%;
  transform: rotate(22deg);
  background: var(--berry);
}

.dog-eye {
  position: absolute;
  top: 38%;
  width: 13%;
  aspect-ratio: 1;
  border: 5px solid #18202f;
  border-radius: 50%;
  background: #00bcd4;
}

.dog-eye-left {
  left: 28%;
}

.dog-eye-right {
  right: 28%;
}

.dog-nose {
  position: absolute;
  left: 50%;
  top: 55%;
  width: 18%;
  aspect-ratio: 1.28;
  border: 5px solid #18202f;
  border-radius: 45% 45% 56% 56%;
  background: #18202f;
  transform: translateX(-50%);
}

.dog-smile {
  position: absolute;
  left: 50%;
  bottom: 17%;
  width: 38%;
  height: 20%;
  border-bottom: 6px solid #18202f;
  border-radius: 0 0 999px 999px;
  transform: translateX(-50%);
}

.dog-badge {
  position: absolute;
  right: 8%;
  bottom: 3%;
  width: 23%;
  aspect-ratio: 1;
  border: 6px solid #18202f;
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 44%, #18202f 44% 56%, transparent 56%),
    linear-gradient(0deg, transparent 44%, #18202f 44% 56%, transparent 56%),
    var(--sun);
}

.device-meta {
  display: grid;
  gap: 0.65rem;
  margin: 0;
}

.device-meta div {
  min-width: 0;
  padding: 0.85rem;
  border: 2px solid rgba(255, 248, 240, 0.22);
  border-radius: 0.5rem;
  background: rgba(255, 248, 240, 0.1);
}

.device-meta dt {
  margin-bottom: 0.25rem;
  color: rgba(255, 248, 240, 0.66);
  font-size: 0.76rem;
  font-weight: 950;
  text-transform: uppercase;
}

.device-meta dd {
  margin: 0;
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.panel {
  margin-top: 1rem;
  padding: clamp(1rem, 2.5vw, 1.35rem);
  border: 3px solid #18202f;
  border-radius: 0.5rem;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 12px 0 rgba(4, 7, 16, 0.35);
}

.panel-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-header h2 {
  margin: 0;
  color: #18202f;
  font-size: clamp(1.55rem, 4vw, 2.55rem);
  line-height: 0.98;
  font-weight: 950;
}

.panel-copy {
  max-width: 30ch;
  margin: 0;
  color: var(--muted);
  font-weight: 900;
  line-height: 1.25;
}

.movement-pad {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  grid-auto-rows: minmax(78px, 1fr);
  gap: clamp(0.55rem, 2vw, 0.9rem);
  max-width: 660px;
  margin: 0 auto;
}

.movement-pad > span {
  min-height: 78px;
}

.control-button,
.toybox-button,
.secondary-button,
.playground-actions button,
.raw-python-submit,
.snippet-chip {
  min-height: 3.6rem;
  border: 3px solid #18202f;
  border-radius: 0.5rem;
  color: #18202f;
  font-weight: 950;
  box-shadow: 0 8px 0 rgba(24, 32, 47, 0.9);
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.control-button:active,
.toybox-button:active,
.secondary-button:active,
.playground-actions button:active,
.raw-python-submit:active,
.snippet-chip:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 rgba(24, 32, 47, 0.9);
}

.movement-tile {
  display: grid;
  place-items: center;
  gap: 0.15rem;
  min-height: 86px;
  padding: 0.7rem;
  background: var(--cyan);
  text-align: center;
}

.movement-tile:nth-of-type(2),
.movement-tile:nth-of-type(4) {
  background: var(--lavender);
}

.tile-label {
  font-size: clamp(1.25rem, 4vw, 2.35rem);
  line-height: 1;
}

.button-icon {
  display: block;
  font-size: 2.35rem;
  line-height: 1;
}

.command-label {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.stop-button {
  min-height: 104px;
  background: var(--stop);
  color: #ffffff;
}

.stop-button .tile-label {
  font-size: clamp(1.45rem, 5vw, 2.9rem);
}

.verification {
  color: inherit;
  font-size: 0.73rem;
  font-weight: 950;
  text-transform: uppercase;
  opacity: 0.72;
}

.advanced-grid,
.toybox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
  gap: 0.85rem;
}

.advanced-grid .control-button {
  min-height: 92px;
  padding: 0.85rem;
  background: var(--grass);
  text-align: left;
  overflow-wrap: anywhere;
}

.advanced-grid .control-button:nth-child(2n) {
  background: var(--sun);
}

.advanced-grid .control-button:nth-child(3n) {
  background: var(--lavender);
}

.toybox-button {
  display: grid;
  align-content: center;
  gap: 0.35rem;
  min-height: 92px;
  padding: 0.9rem;
  background: var(--sun);
  text-align: left;
  line-height: 1.05;
}

.toybox-button:nth-child(5n + 1) {
  background: var(--berry);
  color: #ffffff;
}

.toybox-button:nth-child(5n + 2) {
  background: var(--cyan);
}

.toybox-button:nth-child(5n + 3) {
  background: var(--grass);
}

.toybox-button:nth-child(5n + 4) {
  background: var(--lavender);
}

.advanced-panel {
  margin-top: 1.25rem;
  border: 2px solid rgba(255, 248, 240, 0.24);
  border-radius: 0.5rem;
  background: rgba(13, 17, 23, 0.62);
}

.advanced-panel > summary {
  display: flex;
  align-items: center;
  min-height: 4rem;
  padding: 0.85rem 1rem;
  color: rgba(255, 248, 240, 0.86);
  font-size: 1.1rem;
  font-weight: 950;
  cursor: pointer;
}

.advanced-panel > summary::marker {
  color: var(--sun);
}

.advanced-panel .panel {
  margin: 0 0 1rem;
  border-color: rgba(24, 32, 47, 0.75);
  box-shadow: none;
}

.advanced-panel[open] {
  padding: 0 0.85rem 0.85rem;
}

.transport-panel {
  display: grid;
  gap: 1rem;
}

.transport-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.secondary-button,
.playground-actions button,
.raw-python-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  background: #18202f;
  color: #fff8f0;
  text-align: center;
  text-decoration: none;
}

.transport-toggle .active {
  background: var(--grass);
  color: #07120a;
}

.direct-url-label,
.playground-form label,
.raw-python-label {
  color: #18202f;
  font-weight: 950;
}

.direct-url-input,
.playground-form select,
.snippet-name-input,
.raw-python-form textarea {
  width: 100%;
  border: 3px solid #18202f;
  border-radius: 0.5rem;
  background: #ffffff;
  color: #18202f;
  font-weight: 800;
}

.direct-url-input,
.playground-form select,
.snippet-name-input {
  min-height: 3.2rem;
  padding: 0.65rem 0.75rem;
}

.dog-wifi-helper {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border: 3px solid #18202f;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.56);
}

.dog-wifi-heading {
  display: grid;
  gap: 0.2rem;
}

.dog-wifi-heading h3 {
  margin: 0;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.05;
}

.dog-wifi-heading p,
.wifi-settings-note {
  margin: 0;
  color: #303848;
  font-size: 0.95rem;
  font-weight: 750;
  line-height: 1.35;
}

.dog-wifi-fields {
  display: grid;
  gap: 0.5rem;
}

.dog-wifi-fields label {
  color: #18202f;
  font-weight: 950;
}

.dog-wifi-fields .copy-row + label {
  margin-top: 0.35rem;
}

.copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, auto);
  gap: 0.65rem;
  align-items: stretch;
}

.wifi-settings-link {
  width: fit-content;
}

.standalone-download {
  display: grid;
  gap: 0.4rem;
}

.standalone-download-link {
  width: fit-content;
}

.playground-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 0.85rem;
}

.playground-form label {
  display: grid;
  gap: 0.35rem;
}

.playground-actions,
.code-lab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
}

.preset-summary {
  margin-top: 1rem;
  padding: 0.9rem;
  border: 3px solid #18202f;
  border-radius: 0.5rem;
  background: #e9f7ff;
}

.preset-summary h3,
.preset-summary p {
  margin: 0;
}

.preset-summary h3 {
  margin-bottom: 0.35rem;
}

.preset-summary p {
  color: var(--muted);
  font-weight: 850;
  line-height: 1.4;
}

.snippet-groups {
  display: grid;
  gap: 1rem;
}

.snippet-groups h3,
.remote-slot-header h3,
.remote-slot-header p,
.remote-slot-title {
  margin: 0;
}

.snippet-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.snippet-chip {
  padding: 0.6rem 0.9rem;
  background: var(--sun);
}

.raw-python-form {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.raw-python-form textarea {
  min-height: 12rem;
  padding: 0.85rem;
  font: 0.95rem/1.42 "SFMono-Regular", Menlo, monospace;
}

.remote-slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}

.remote-slot-card {
  padding: 1rem;
  border: 3px solid #18202f;
  border-radius: 0.5rem;
  background: #ffffff;
}

.remote-slot-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.remote-slot-header p {
  color: var(--muted);
  font-weight: 900;
  text-transform: capitalize;
}

.remote-slot-title {
  margin-top: 0.55rem;
  font-weight: 950;
}

.remote-slot-actions {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.results {
  margin: 1.15rem 0 0;
  min-height: 4rem;
  padding: 1rem;
  border: 2px solid rgba(255, 248, 240, 0.24);
  border-radius: 0.5rem;
  background: rgba(13, 17, 23, 0.78);
  color: #fff8f0;
  font-weight: 850;
  white-space: pre-wrap;
}

.label-mode-labels .button-icon {
  display: none;
}

.label-mode-pictures .tile-label,
.label-mode-pictures .command-label,
.label-mode-pictures .toybox-label,
.label-mode-pictures .verification,
.label-mode-pictures .play-panel .panel-copy,
.label-mode-pictures .trick-panel .panel-copy,
.label-mode-pictures .mood-panel .panel-copy {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.label-mode-pictures .movement-tile,
.label-mode-pictures .advanced-grid .control-button,
.label-mode-pictures .toybox-button {
  place-items: center;
  text-align: center;
}

.label-mode-pictures .movement-tile .button-icon {
  font-size: clamp(2.1rem, 9vw, 4.25rem);
}

.label-mode-pictures .stop-button .button-icon {
  font-size: clamp(2.35rem, 10vw, 4.6rem);
}

.label-mode-pictures .advanced-grid .button-icon,
.label-mode-pictures .toybox-button .button-icon {
  font-size: clamp(2.1rem, 6vw, 3.1rem);
}

@media (min-width: 860px) {
  .app-surface {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    gap: 1rem;
    align-items: start;
  }

  .toddler-hero,
  .play-panel,
  .advanced-panel {
    grid-column: 1 / -1;
  }

  .trick-panel,
  .mood-panel {
    margin-top: 0;
  }
}

@media (max-width: 880px) {
  .toddler-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-copy h2 {
    max-width: 10ch;
  }

  .device-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 621px) and (max-width: 880px) {
  .label-mode-pictures .toddler-hero {
    grid-template-columns: minmax(0, 1fr) minmax(190px, 240px);
  }

  .label-mode-pictures .hero-copy h2 {
    max-width: 8ch;
    font-size: clamp(3.6rem, 10vw, 4.8rem);
  }

  .label-mode-pictures .device-meta {
    display: none;
  }
}

@media (min-width: 881px) and (max-width: 1100px) {
  .label-mode-pictures .toddler-hero {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 220px);
  }

  .label-mode-pictures .hero-copy h2 {
    max-width: 9ch;
    font-size: clamp(3.4rem, 7vw, 4.4rem);
  }

  .label-mode-pictures .device-meta {
    display: none;
  }
}

@media (max-width: 620px) {
  .shell {
    padding-top: 0.75rem;
  }

  .status {
    font-size: 0.9rem;
  }

  .toddler-hero {
    grid-template-columns: minmax(0, 1fr) minmax(96px, 132px);
    min-height: auto;
    padding: 1rem;
  }

  .hero-copy h2 {
    max-width: 8ch;
    font-size: clamp(2.15rem, 12vw, 3.1rem);
  }

  .status-pills {
    margin-top: 0.7rem;
  }

  .status-pill {
    min-height: 2.25rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.88rem;
  }

  .dog-mascot {
    width: min(31vw, 128px);
  }

  .device-meta {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .device-meta div {
    padding: 0.55rem;
  }

  .device-meta dt {
    font-size: 0.66rem;
  }

  .device-meta dd {
    font-size: 0.82rem;
  }

  .panel-header {
    display: grid;
    gap: 0.35rem;
  }

  .movement-pad {
    grid-template-columns: repeat(3, minmax(72px, 1fr));
    grid-auto-rows: minmax(72px, 1fr);
  }

  .movement-pad > span {
    min-height: 72px;
  }

  .advanced-grid,
  .toybox-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .transport-toggle,
  .playground-actions,
  .code-lab-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .copy-row {
    grid-template-columns: 1fr;
  }

  .wifi-settings-link {
    width: 100%;
  }

  .standalone-download-link {
    width: 100%;
  }
}

@media (max-width: 390px) {
  .movement-pad {
    gap: 0.45rem;
  }

  .movement-tile {
    min-height: 68px;
    padding: 0.4rem;
  }

  .advanced-grid,
  .toybox-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .label-mode-pictures .device-meta {
    display: none;
  }

  .label-mode-pictures .advanced-grid,
  .label-mode-pictures .toybox-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .label-mode-pictures .advanced-grid .control-button,
  .label-mode-pictures .toybox-button {
    min-height: 74px;
    padding: 0.45rem;
  }
}

@media (max-width: 330px) {
  .label-mode-pictures .advanced-grid,
  .label-mode-pictures .toybox-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
