:root {
  color-scheme: light;
  --bg: #eef3f8;
  --ink: #162033;
  --muted: #667085;
  --line: #d2dbe7;
  --panel: #ffffff;
  --panel-soft: #f7fafc;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --blue: #2563eb;
  --amber: #d97706;
  --red: #dc2626;
  --shadow: 0 18px 45px rgba(22, 32, 51, .13);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #f9fbfd 0%, #eef3f8 52%, #e8eef5 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100svh;
  width: min(100%, 980px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
}

.hidden {
  display: none !important;
}

.home-view,
.complete-view {
  min-height: calc(100svh - 36px);
  display: grid;
  align-content: center;
  gap: 18px;
}

.home-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.home-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-icon {
  width: 66px;
  height: 66px;
  flex: 0 0 66px;
  display: block;
  border-radius: 16px;
  box-shadow: 0 12px 24px rgba(22, 32, 51, .12);
}

.admin-link,
.secondary-button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 850;
  cursor: pointer;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1;
  letter-spacing: 0;
}

h1 {
  font-size: 44px;
}

h2 {
  font-size: 34px;
}

.deck-count {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--accent-dark);
  font-size: 24px;
  font-weight: 900;
}

.config-panel,
.complete-panel {
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

fieldset {
  border: 0;
  margin: 0 0 16px;
  padding: 0;
}

legend {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

fieldset label {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-weight: 750;
}

input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.segmented label {
  justify-content: center;
  min-height: 44px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.start-button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-size: 17px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 16px 30px rgba(15, 118, 110, .24);
}

.play-icon {
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid #fff;
}

.session-view {
  min-height: calc(100svh - 36px);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
}

.session-topbar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
}

.icon-button,
.sound-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.sound-button:disabled {
  background: #f1f4f8;
  color: #a3adbb;
  cursor: default;
  opacity: .82;
}

.icon-button svg,
.sound-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.progress {
  min-height: 36px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 850;
}

.bit-card {
  position: relative;
  min-height: min(760px, calc(100svh - 104px));
  background: #fff;
  border: 1px solid #e1e7ef;
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  outline: none;
  cursor: pointer;
}

.bit-card:focus-visible {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .25), var(--shadow);
}

.sound-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
}

.image-stage {
  min-height: 360px;
  display: grid;
  place-items: center;
  padding: 24px;
}

.image-stage img {
  width: min(100%, 620px);
  max-height: 56svh;
  object-fit: contain;
  display: block;
}

.placeholder-mark {
  width: min(62vw, 300px);
  aspect-ratio: 1;
  border: 2px dashed #d4dce8;
  border-radius: 8px;
  background: #fbfcfe;
}

.word-strip {
  border-top: 1px solid #e5eaf1;
  background: #fff;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.word {
  min-height: 68px;
  padding: 10px 20px;
  display: grid;
  grid-template-columns: 44px minmax(0, 520px) 44px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-top: 1px solid #edf0f5;
  text-align: center;
}

.word:first-child {
  border-top: 0;
}

.flag {
  width: 28px;
  height: 18px;
  border-radius: 3px;
  border: 1px solid rgba(22, 32, 51, .16);
  box-shadow: 0 1px 2px rgba(22, 32, 51, .12);
}

.flag-ca {
  background: repeating-linear-gradient(180deg, #f9d447 0 3px, #c7272d 3px 5px);
}

.flag-es {
  background: linear-gradient(180deg, #c9232d 0 25%, #f3c441 25% 75%, #c9232d 75%);
}

.flag-en {
  background: #012169 url("/assets/flags/uk.svg") center / cover no-repeat;
}

.word strong {
  width: min(100%, 520px);
  color: var(--ink);
  font-size: 28px;
  line-height: 1.02;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  text-align: center;
}

.admin-shell {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.admin-header,
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.admin-metrics {
  margin: 18px 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.admin-metrics div,
.admin-form,
.admin-list,
.json-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow);
}

.admin-metrics div {
  min-height: 82px;
  padding: 12px;
  display: grid;
  align-content: center;
  gap: 4px;
}

.admin-metrics strong {
  font-size: 26px;
  line-height: 1;
}

.admin-metrics span,
.card-meta,
.form-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.admin-form,
.admin-list,
.json-panel {
  padding: 16px;
}

.admin-form {
  display: grid;
  gap: 12px;
}

.admin-form h2,
.admin-list h2,
.json-panel h2 {
  font-size: 24px;
}

.admin-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
}

.admin-form input,
.admin-form select,
.admin-form textarea,
.list-head input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

.admin-form textarea {
  resize: vertical;
  line-height: 1.35;
}

.asset-guidance,
.current-assets {
  margin: 0;
  padding: 12px;
  border: 1px solid #dfe6ef;
  border-radius: 8px;
  background: #f7fafc;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.asset-guidance strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.asset-guidance p {
  margin: 6px 0 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.cards-list {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.admin-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid #e4eaf2;
  border-radius: 8px;
  background: #fff;
}

.admin-card img {
  width: 82px;
  aspect-ratio: 1;
  object-fit: contain;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  background: #fff;
}

.card-title {
  font-weight: 900;
  overflow-wrap: anywhere;
}

.admin-card p {
  margin: 7px 0 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.card-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-asset-link {
  color: #0f7ee8;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.json-panel {
  margin-top: 14px;
}

.json-panel pre {
  max-height: 520px;
  overflow: auto;
  margin: 14px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: #101827;
  color: #edf6ff;
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 620px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  h1 {
    font-size: 38px;
  }

  .home-header {
    align-items: center;
  }

  .brand-heading {
    gap: 10px;
  }

  .brand-icon {
    width: 54px;
    height: 54px;
    flex-basis: 54px;
    border-radius: 14px;
  }

  .home-actions {
    flex-direction: column;
    align-items: end;
  }

  .deck-count {
    width: 54px;
    height: 54px;
    font-size: 21px;
  }

  .segmented {
    grid-template-columns: 1fr;
  }

  .bit-card {
    min-height: calc(100svh - 96px);
  }

  .image-stage {
    min-height: 300px;
    padding: 18px;
  }

  .word {
    min-height: 62px;
    padding: 9px 14px;
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    gap: 8px;
  }

  .word strong {
    font-size: 23px;
  }

  .admin-metrics,
  .admin-layout,
  .form-grid,
  .form-actions {
    grid-template-columns: 1fr;
  }

  .admin-header,
  .list-head {
    align-items: start;
  }

  .admin-card {
    grid-template-columns: 70px minmax(0, 1fr);
  }

  .admin-card img {
    width: 70px;
  }
}
