/* Make-a-Sketch — app-specific styles */
.sketch-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 10%, rgba(140,107,255,.22), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(47,230,201,.16), transparent 25%),
    var(--t2t-stage-bg);
  color: var(--t2t-stage-text-soft);
  overflow-x: hidden;
}

.sketch-stage {
  width: min(1180px, 94vw);
  margin: 0 auto;
  padding: 0 0 var(--t2t-space-4);
}

.sketch-hero {
  display: flex;
  flex-direction: column;
  gap: var(--t2t-space-2);
}

.sketch-toolbar,
.controls-heading,
.mapping-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--t2t-space-3);
}

.sketch-toolbar h2,
.controls-heading h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.sketch-kicker {
  margin: 0 0 5px;
  color: var(--t2t-teal);
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .12em;
}

.sketch-hint,
.mapping-heading p {
  margin: 6px 0 0;
  color: var(--t2t-stage-text-soft);
  font-weight: 600;
}

.pen-status {
  min-width: 128px;
  padding: 11px 16px;
  border: 2px solid rgba(255,255,255,.14);
  border-radius: 16px;
  background: rgba(255,255,255,.06);
  text-align: center;
}

.pen-status span {
  display: block;
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .1em;
  color: var(--t2t-stage-text-soft);
}

.pen-status strong {
  display: block;
  margin-top: 2px;
  color: #fff;
  font-size: 1rem;
}

.canvas-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 360px;
  overflow: hidden;
  border: 3px solid rgba(255,255,255,.14);
  border-radius: 26px;
  background: #fffdf9;
  box-shadow: 0 14px 0 rgba(0,0,0,.22), 0 18px 40px rgba(0,0,0,.2);
  touch-action: none;
}

.canvas-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(36,22,64,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36,22,64,.045) 1px, transparent 1px);
  background-size: 28px 28px;
}

#sketchCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  user-select: none;
}

.canvas-badge {
  position: absolute;
  left: 16px;
  top: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,253,249,.94);
  color: var(--t2t-ink);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .05em;
  box-shadow: 0 4px 12px rgba(36,22,64,.12);
  pointer-events: none;
}

.canvas-badge__dot {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 50%;
  background: #241640;
  border: 2px solid rgba(36,22,64,.25);
}

.canvas-cursor {
  position: absolute;
  border: 2px solid #241640;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: none;
}

.quick-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--t2t-space-2);
}

.direction-guide {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--t2t-stage-text-soft);
}

.direction-guide span {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255,255,255,.14);
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  color: #fff;
  font-weight: 900;
}

.direction-guide small {
  margin-left: 8px;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .06em;
}

.input-indicator {
  min-height: 1.3em;
  margin: 0;
  text-align: center;
  color: var(--t2t-stage-text-soft);
  font-size: .85rem;
  font-weight: 700;
}

/* Controls are a focused modal rather than a second white page section. */
.sketch-controls {
  position: fixed;
  z-index: 30;
  left: 50%;
  top: 50%;
  width: min(900px, calc(100vw - 40px));
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  transform: translate(-50%, -50%);
  padding: clamp(22px, 3vw, 34px);
  border: 3px solid rgba(255,255,255,.14);
  border-radius: 28px;
  background: linear-gradient(145deg, #2e1b52, #160d28);
  color: #fff;
  box-shadow:
    0 0 0 100vmax rgba(10,6,20,.76),
    0 24px 70px rgba(0,0,0,.42),
    0 10px 0 rgba(0,0,0,.25);
}

.sketch-controls[hidden] {
  display: none;
}

.controls-heading {
  align-items: flex-start;
}

.controls-heading h2 {
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.controls-heading .btn {
  flex: 0 0 auto;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.control-field {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 2px solid rgba(255,255,255,.10);
  border-radius: 16px;
  background: rgba(255,255,255,.055);
  color: var(--t2t-stage-text-soft);
  font-size: .82rem;
  font-weight: 900;
}

.control-field select {
  width: 100%;
  min-height: 46px;
  padding: 10px 42px 10px 13px;
  border: 2px solid rgba(255,255,255,.18);
  border-radius: 12px;
  background: #1b1030;
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.control-field select:focus-visible {
  outline: 3px solid var(--t2t-teal);
  outline-offset: 2px;
}

.mapping-section {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,.12);
}

.mapping-heading {
  align-items: flex-start;
}

.mapping-heading h3 {
  color: #fff;
  font-size: 1.05rem;
}

.mapping-heading p {
  max-width: 650px;
  font-size: .85rem;
}

.text-button {
  appearance: none;
  flex: 0 0 auto;
  border: 2px solid rgba(255,255,255,.22);
  border-radius: 999px;
  padding: 9px 14px;
  background: rgba(255,255,255,.06);
  color: #fff;
  font: inherit;
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
}

.text-button:hover {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.34);
}

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.mapping-card {
  padding: 13px 14px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  background: rgba(255,255,255,.045);
}

.mapping-card span,
.mapping-card strong {
  display: block;
}

.mapping-card span {
  color: var(--t2t-stage-text-soft);
  font-size: .72rem;
  font-weight: 700;
}

.mapping-card strong {
  margin-top: 5px;
  color: #fff;
  font-size: .86rem;
}

.btn--small {
  padding: 10px 18px;
  font-size: .9rem;
}

@media (max-width: 720px) {
  .canvas-shell { min-height: 300px; }
  .sketch-toolbar { align-items: flex-start; }
  .pen-status { min-width: 112px; }
  .control-grid,
  .mapping-grid { grid-template-columns: 1fr; }
  .mapping-heading { flex-direction: column; }
}

@media (max-width: 560px) {
  .app-header { padding-inline: 14px; }
  .sketch-stage { width: min(94vw, 1180px); }
  .canvas-shell { min-height: 260px; border-radius: 20px; }
  .quick-controls { align-items: flex-start; flex-direction: column; }
  .direction-guide small { display: none; }
  .sketch-controls {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    padding: 20px;
    border-radius: 22px;
  }
  .controls-heading { flex-direction: row; }
  .controls-heading .btn { padding-inline: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .sketch-controls { scroll-behavior: auto; }
}

/* Fullscreen layout: fit the entire drawing workspace inside the viewport. */
html:fullscreen {
  overflow: hidden;
}

html:fullscreen body.sketch-page {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

html:fullscreen .sketch-stage {
  width: min(1180px, 94vw);
  height: calc(100vh - 72px);
  min-height: 0;
  box-sizing: border-box;
  padding: 10px 0 14px;
  overflow: hidden;
}

html:fullscreen .sketch-hero {
  height: 100%;
  min-height: 0;
}

html:fullscreen .sketch-toolbar {
  flex: 0 0 auto;
}

html:fullscreen .canvas-shell {
  flex: 1 1 auto;
  min-height: 0;
  aspect-ratio: auto;
}

html:fullscreen .quick-controls {
  flex: 0 0 auto;
}

html:fullscreen .input-indicator {
  flex: 0 0 auto;
}

@media (max-height: 650px) {
  html:fullscreen .sketch-stage {
    height: calc(100vh - 62px);
    padding-top: 6px;
    padding-bottom: 8px;
  }

  html:fullscreen .sketch-toolbar h2 {
    font-size: 1.25rem;
  }

  html:fullscreen .sketch-hint {
    margin-top: 2px;
    font-size: .78rem;
  }

  html:fullscreen .quick-controls {
    min-height: 34px;
  }

  html:fullscreen .input-indicator {
    font-size: .75rem;
  }
}
