#tutorial {
  background: var(--white);
  justify-content: flex-start;
  padding: 0;
  cursor: pointer;
  gap: 0;
}

/* ── Operator gear (top-right) — round timer adjuster ── */
.tut-gear {
  position: absolute;
  top: clamp(12px, 2.5vw, 22px);
  right: clamp(12px, 2.5vw, 22px);
  width: clamp(32px, 6.4vw, 44px);
  height: clamp(32px, 6.4vw, 44px);
  padding: clamp(6px, 1.5vw, 10px);
  background: transparent;
  border: none;
  color: var(--black);
  opacity: 0.5;
  cursor: pointer;
  z-index: 20;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.tut-gear:hover  { opacity: 0.9; }
.tut-gear:active { transform: rotate(45deg); }
.tut-gear svg    { width: 100%; height: 100%; display: block; }

/* ── Settings sheet — overlays the tutorial when gear is tapped ── */
.tut-settings {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  cursor: default;
  padding: 20px;
}
.tut-settings[hidden] { display: none !important; }

.tut-settings-card {
  background: var(--white);
  width: 100%;
  max-width: 380px;
  padding: clamp(20px, 5vw, 28px);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.45);
}

.settings-title {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: clamp(18px, 4.5vw, 22px);
  color: var(--black);
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}

.settings-row {
  display: grid;
  grid-template-columns: 78px 1fr 52px;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  font-family: 'Inter', sans-serif;
}
.settings-label {
  font-weight: 700;
  font-size: clamp(13px, 3.4vw, 15px);
  color: var(--black);
}
.settings-row input[type="range"] {
  width: 100%;
  accent-color: var(--yellow);
}
.settings-val {
  text-align: right;
  font-weight: 700;
  font-size: clamp(13px, 3.4vw, 15px);
  font-variant-numeric: tabular-nums;
  color: var(--black);
}

.settings-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.settings-reset,
.settings-close {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: clamp(13px, 3.4vw, 15px);
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.settings-reset {
  background: transparent;
  color: var(--black);
  border: 1px solid rgba(0,0,0,0.15);
}
.settings-close {
  background: var(--yellow);
  color: var(--black);
  border: none;
}

/* ── Header ── */
.tut-header {
  margin-top: 17%;
  text-align: center;
  width: min(72%, 460px);   /* matches the card grid */
}

.tut-title {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: clamp(40px, 11vw, 72px);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--black);
  white-space: nowrap;
}

.tut-sub {
  margin-top: clamp(6px, 1.2vw, 12px);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: clamp(13px, 4vw, 28px);
  letter-spacing: -0.02em;
  color: var(--black);
  text-align: center;
}

/* ── Card grid (2×2) — sits 26px below the description ── */
.tut-stage {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: clamp(8px, 2.2vw, 16px);
  width: min(72%, 460px);
  aspect-ratio: 1 / 1;
}

.tc-wrap {
  width: 100%;
  height: 100%;
  perspective: 900px;
  position: relative;
}

.tc-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 4px;
  will-change: transform;
}

.tc-inner.flip { transform: rotateY(180deg); }

.tc-front,
.tc-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
  border: 4px solid transparent;
  box-sizing: border-box;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.tc-back {
  transform: rotateY(180deg);
}

.tc-back svg {
  width: 48%;
  height: 48%;
}

/* All icons render yellow */
.tc-back svg,
.tc-back svg * {
  fill: var(--yellow) !important;
  color: var(--yellow);
}

/* Matched: yellow border outline */
.tc-wrap.tc-matched .tc-back {
  border-color: var(--yellow);
  box-shadow: 0 0 0 2px var(--yellow);
}

.tc-wrap.tc-matched .tc-inner {
  animation: tutMatchPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes tutMatchPop {
  0%   { transform: rotateY(180deg) scale(1); }
  45%  { transform: rotateY(180deg) scale(1.08); }
  100% { transform: rotateY(180deg) scale(1); }
}

/* ── Brand ── */
.tut-brand {
  position: absolute;
  left: 50%;
  bottom: clamp(70px, 11vh, 130px);
  transform: translateX(-50%);
  width: clamp(110px, 28vw, 180px);
  height: auto;
  display: block;
  user-select: none;
  pointer-events: none;
}

/* ── Intro animations on screen activate ── */
#tutorial.active .tut-header { animation: tutHeaderIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
#tutorial.active .tut-stage  { animation: tutStageIn 0.55s 0.18s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
#tutorial.active .tut-brand  { animation: tutBrandIn 0.5s 0.5s cubic-bezier(0.4, 0, 0.2, 1) both; }

@keyframes tutHeaderIn {
  from { transform: translateY(-12px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

@keyframes tutStageIn {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

@keyframes tutBrandIn {
  from { transform: translateX(-50%) translateY(8px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);   opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  #tutorial.active .tut-header,
  #tutorial.active .tut-stage,
  #tutorial.active .tut-brand { animation: none; }
}

/* ── Kiosk 1080×1920 ── */
@media (orientation: portrait) and (min-width: 1000px) and (min-height: 1700px) {
  .tut-header { margin-top: 305px; width: min(70%, 720px); }
  .tut-title  { font-size: clamp(120px, 11vw, 180px); }
  .tut-sub    { font-size: 40.32px; font-weight: 600; margin-top: 18px; }
  .tut-stage  { margin-top: 56px; width: min(70%, 720px); gap: 22px; }
  .tc-front, .tc-back { border-radius: 4px; border-width: 6px; }
  .tc-inner   { border-radius: 4px; }
  .tut-brand  { width: clamp(220px, 22vw, 320px); bottom: 221px; }
}
