:root {
  color-scheme: dark;
  --bg: #050505;
  --glass: rgba(6, 8, 10, 0.9);
  --panel: rgba(18, 20, 22, 0.78);
  --panel-strong: rgba(25, 28, 31, 0.92);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f8fafc;
  --soft: #d8dee8;
  --muted: #9aa5b1;
  --red: #ff4f5e;
  --red-soft: rgba(255, 79, 94, 0.16);
  --blue: #58c8ff;
  --blue-soft: rgba(88, 200, 255, 0.16);
  --white: #f4f1e8;
  --white-soft: rgba(244, 241, 232, 0.14);
  --green: #61e9a1;
  --amber: #ffd166;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background:
    radial-gradient(circle at 50% 0%, rgba(97, 233, 161, 0.12), transparent 30%),
    #050505;
  color: var(--text);
}

button {
  border: 0;
  font: inherit;
}

.simulator {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 0;
}

.viewport {
  position: relative;
  width: 600px;
  height: 600px;
  max-width: 100vw;
  max-height: 100vh;
  display: grid;
  grid-template-rows: 70px 48px minmax(0, 1fr);
  gap: 8px;
  padding: 14px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 34%),
    var(--glass);
  touch-action: none;
}

.topbar {
  position: relative;
  display: grid;
  grid-template-columns: 68px 1fr 68px;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.topbar::before {
  content: "";
}

.topbar > div {
  grid-column: 2;
  min-width: 0;
  text-align: center;
}

.studio-logo {
  position: absolute;
  left: 0;
  top: 50%;
  width: 96px;
  height: 22px;
  object-fit: contain;
  object-position: left center;
  opacity: 0.78;
  transform: translateY(-50%);
}

.eyebrow,
.flow-label,
.step-count,
.item-needed {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

h1 {
  margin: 5px 0 0;
  color: var(--text);
  font-size: 31px;
  font-weight: 950;
  line-height: 1;
  letter-spacing: 0;
}

.lang-toggle {
  grid-column: 3;
  width: 68px;
  height: 52px;
  border-radius: 8px;
  background: rgba(97, 233, 161, 0.16);
  color: var(--green);
  font-size: 18px;
  font-weight: 950;
}

.disclaimer {
  min-height: 48px;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 6px 10px;
  border: 1px solid rgba(255, 209, 102, 0.28);
  border-radius: 8px;
  background: rgba(255, 209, 102, 0.1);
  color: #ffe2a3;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.16;
}

.screen {
  min-height: 0;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.category-grid {
  height: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.category {
  min-width: 0;
  min-height: 0;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
}

.category-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.category-icon svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 6;
}

.category-code {
  width: fit-content;
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 950;
  line-height: 1;
}

.category-name {
  font-size: 24px;
  font-weight: 950;
  line-height: 1.02;
}

.category.red {
  border-color: rgba(255, 79, 94, 0.45);
}

.category.red .category-code {
  background: var(--red-soft);
  color: var(--red);
}

.category.red .category-icon {
  color: var(--red);
}

.category.blue {
  border-color: rgba(88, 200, 255, 0.45);
}

.category.blue .category-code {
  background: var(--blue-soft);
  color: var(--blue);
}

.category.blue .category-icon {
  color: var(--blue);
}

.category.white {
  border-color: rgba(244, 241, 232, 0.38);
}

.category.white .category-code {
  background: var(--white-soft);
  color: var(--white);
}

.category.white .category-icon {
  color: var(--white);
}

.category.green {
  border-color: rgba(154, 165, 177, 0.38);
}

.category.green .category-code {
  background: rgba(97, 233, 161, 0.14);
  color: var(--green);
}

.category.green .category-icon {
  color: var(--green);
}

.flow {
  min-height: 0;
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr) 54px;
  gap: 8px;
  overflow: hidden;
}

.step-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.flow-label {
  color: var(--green);
}

.step-count {
  margin-top: 5px;
}

.step-pips {
  display: flex;
  gap: 5px;
  margin-top: 6px;
}

.step-pips span {
  width: 21px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.step-pips span.is-active {
  background: var(--green);
}

.audio-state {
  min-width: 92px;
  padding: 9px 7px;
  border: 1px solid rgba(97, 233, 161, 0.25);
  border-radius: 8px;
  background: rgba(97, 233, 161, 0.1);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.step-card {
  min-height: 0;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  overflow: hidden;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.step-card.is-long .instruction {
  font-size: 24px;
}

.step-card.is-extra-long .instruction {
  font-size: 21px;
  line-height: 1.05;
}

.step-card.is-fit-compact .step-copy {
  gap: 6px;
}

.step-card.is-fit-compact .item-code {
  padding: 6px 8px;
  font-size: 18px;
}

.step-card.is-fit-compact .item-needed {
  font-size: 13px;
}

.step-card.is-fit-compact .instruction {
  font-size: 19px;
  line-height: 1.04;
}

.step-card.is-fit-tight .instruction {
  font-size: 17px;
  line-height: 1.03;
}

.pictogram {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--green);
}

.pictogram svg {
  width: 68px;
  height: 68px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 6;
}

.step-copy {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-content: center;
  gap: 8px;
  overflow: hidden;
}

.item-code {
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(97, 233, 161, 0.14);
  color: var(--green);
  font-size: 20px;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.item-code.red-code {
  background: var(--red-soft);
  color: var(--red);
}

.item-code.blue-code {
  background: var(--blue-soft);
  color: var(--blue);
}

.item-code.white-code {
  background: var(--white-soft);
  color: var(--white);
}

.item-code.gray-code {
  background: rgba(154, 165, 177, 0.14);
  color: #cbd5e1;
}

.item-code.green-code {
  background: rgba(97, 233, 161, 0.14);
  color: var(--green);
}

.item-needed {
  color: var(--soft);
  font-size: 14px;
}

.instruction {
  min-height: 0;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 27px;
  font-weight: 950;
  line-height: 1.06;
  overflow-wrap: break-word;
}

.controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.control {
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--soft);
  font-size: 13px;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.control.primary {
  border-color: rgba(97, 233, 161, 0.45);
  background: rgba(97, 233, 161, 0.16);
  color: var(--green);
}

.control.danger {
  border-color: rgba(255, 79, 94, 0.38);
  background: rgba(255, 79, 94, 0.12);
  color: var(--red);
}

.control:disabled {
  opacity: 0.38;
}

button:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

button:active {
  transform: translateY(1px);
}

@media (max-width: 599px), (max-height: 599px) {
  .viewport {
    width: 100vw;
    height: 100vh;
    grid-template-rows: 64px 44px minmax(0, 1fr);
    gap: 6px;
    padding: 10px;
  }

  h1 {
    font-size: 25px;
  }

  .studio-logo {
    width: 76px;
    height: 18px;
  }

  .disclaimer {
    min-height: 44px;
    padding: 5px 8px;
    font-size: 12px;
  }

  .category-name {
    font-size: 20px;
  }

  .category-icon {
    width: 38px;
    height: 38px;
  }

  .category-icon svg {
    width: 28px;
    height: 28px;
  }

  .step-card {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 9px;
    padding: 10px;
  }

  .pictogram svg {
    width: 56px;
    height: 56px;
  }

  .instruction {
    font-size: 23px;
  }

  .step-card.is-long .instruction {
    font-size: 21px;
  }

  .step-card.is-extra-long .instruction {
    font-size: 19px;
  }

  .step-card.is-fit-compact .instruction {
    font-size: 17px;
  }

  .step-card.is-fit-tight .instruction {
    font-size: 15px;
  }

  .control {
    font-size: 12px;
  }
}
