@font-face {
  font-family: "8bit Wonder";
  src: url("assets/fonts/8bit-wonder.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #1c2b3a;
  --paper: #fff8ef;
  --accent: #ff6b6b;
  --navy: #2b4a8b;
  --sky: #87ceeb;
  --violet: #7e57c2;
  --violet-deep: #5e35b1;
  --pixel: "8bit Wonder", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  font-family: Nunito, system-ui, sans-serif;
  background: var(--sky);
  color: var(--ink);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button {
  font-family: inherit;
}

/* ========== HOME ========== */
#home {
  position: fixed;
  inset: 0;
  background: #87ceeb;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  transition: opacity 0.35s, transform 0.35s;
  z-index: 5;
}

#home-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}

.home-fg {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 16px 16px 28px;
  overflow-y: auto;
  background: linear-gradient(
    180deg,
    rgba(135, 206, 235, 0.35) 0%,
    rgba(255, 255, 255, 0.28) 40%,
    rgba(135, 206, 235, 0.45) 100%
  );
}

#home.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.97);
}

.home-header {
  text-align: center;
  margin-bottom: 8px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 8px 0 4px;
}

.brand-logo {
  width: clamp(56px, 14vw, 88px);
  height: clamp(56px, 14vw, 88px);
  object-fit: contain;
  image-rendering: auto;
  border-radius: 16px;
  background: #dff0ff;
  border: 3px solid #111;
  box-shadow: 0 4px 0 #111;
  flex-shrink: 0;
}

.home-header .brand-title {
  margin: 0;
  font-family: var(--pixel);
  font-size: clamp(1.35rem, 5.5vw, 2.15rem);
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: var(--navy);
  text-shadow: 3px 3px 0 #fff, 0 5px 0 rgba(27, 54, 93, 0.25);
}

.home-header .subtitle {
  margin: 0 auto 12px;
  max-width: 36rem;
  color: #1b365d;
  font-family: var(--pixel);
  font-size: clamp(0.45rem, 2.2vw, 0.58rem);
  letter-spacing: 0.04em;
  line-height: 1.55;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.8);
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 8px 0 16px;
}

.char-card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 4px 0 #111;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 3px solid #111;
  transition: transform 0.2s;
}

.char-card:hover {
  transform: translateY(-4px);
}

.char-card.new-slot {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.72);
}

.char-preview {
  width: 100%;
  aspect-ratio: 1;
  max-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
  background: #dfefff;
  border: 2px solid #111;
  margin-bottom: 6px;
}

.char-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.char-name {
  font-family: var(--pixel);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--navy);
  margin: 6px 0 10px;
}

.char-actions {
  display: flex;
  gap: 8px;
  width: 100%;
}

.btn {
  flex: 1;
  padding: 10px 8px;
  border: 3px solid #111;
  border-radius: 10px;
  font-family: var(--pixel);
  font-size: 0.5rem;
  letter-spacing: 0.04em;
  font-weight: normal;
  cursor: pointer;
  color: #fff;
  min-height: 44px;
  box-shadow: 0 3px 0 #111;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #111;
}

.btn-play {
  background: #43a047;
}

.btn-edit {
  background: #fb8c00;
}

.btn-create {
  width: 100%;
  background: #7e57c2;
  padding: 14px;
  font-size: 0.5rem;
}

.new-plus {
  font-family: var(--pixel);
  font-size: 3rem;
  color: var(--violet);
  line-height: 1;
  margin: 24px 0 8px;
  text-shadow: 3px 3px 0 #111;
}

.create-label {
  color: var(--violet) !important;
}

.home-hint {
  text-align: center;
  color: #1b365d;
  font-family: var(--pixel);
  font-size: 0.48rem;
  letter-spacing: 0.04em;
  line-height: 1.55;
  max-width: 28rem;
  margin: 0 auto;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.85);
}

.reading-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 22rem;
  margin: 0 auto 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 3px solid #111;
  border-radius: 14px;
  box-shadow: 0 3px 0 #111;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 2;
}

.reading-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  min-width: 0;
}

.reading-toggle-title {
  font-family: Nunito, system-ui, sans-serif;
  font-weight: 900;
  font-size: 0.95rem;
  color: #1b365d;
}

.reading-toggle-sub {
  font-family: Nunito, system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  color: #5a6f8a;
  line-height: 1.25;
}

.reading-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.reading-toggle-ui {
  flex-shrink: 0;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  border: 3px solid #111;
  background: #c5cdd8;
  position: relative;
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.08);
  transition: background 0.15s ease;
}

.reading-toggle-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #111;
  transition: transform 0.15s ease;
}

.reading-toggle input:checked + .reading-toggle-ui {
  background: #5ecf6a;
}

.reading-toggle input:checked + .reading-toggle-ui::after {
  transform: translateX(22px);
}

.reading-toggle input:focus-visible + .reading-toggle-ui {
  outline: 3px solid #4a90e2;
  outline-offset: 2px;
}

/* ========== EDITOR ========== */
#editor {
  position: fixed;
  inset: 0;
  display: none;
  background: var(--sky);
  z-index: 8;
}

#editor.active {
  display: block;
}

#panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(340px, 100%);
  background: linear-gradient(180deg, #fff 0%, #f5f8ff 100%);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  z-index: 10;
  overflow: hidden;
}

#panelHeader {
  background: linear-gradient(135deg, var(--violet-deep), var(--violet));
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.title-label {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
  font-weight: 800;
}

#nameEditable {
  background: rgba(255, 255, 255, 0.18);
  border: 1px dashed rgba(255, 255, 255, 0.55);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 900;
  padding: 4px 8px;
  border-radius: 8px;
  width: 100%;
  max-width: 200px;
  outline: none;
  font-family: inherit;
}

#nameEditable:focus {
  background: rgba(255, 255, 255, 0.3);
  border-style: solid;
}

#btnBackTop {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}

#panelBody {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  -webkit-overflow-scrolling: touch;
}

.section {
  margin-bottom: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 900;
  color: #4a3b8a;
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.section-title .icon {
  font-size: 1.1rem;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, #d0d8ec, transparent);
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 8px;
  border: 1px solid #e8eef8;
  box-shadow: 0 2px 6px rgba(60, 80, 140, 0.06);
}

.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  position: relative;
  cursor: pointer;
}

.color-row:hover {
  background: #f0f4fb;
}

.color-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1rem;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

.color-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.color-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: #4a5a7a;
}

.color-swatch {
  font-size: 0.7rem;
  color: #98a5b8;
  font-family: ui-monospace, monospace;
}

.color-row input[type="color"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.chip-grid {
  display: grid;
  gap: 8px;
}

.chip-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.chip {
  background: #f4f7fd;
  border: 2px solid #e0e8f5;
  border-radius: 10px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  min-height: 58px;
  text-align: center;
}

.chip:hover {
  background: #eaf2ff;
  border-color: #b8cdee;
}

.chip.active {
  background: linear-gradient(135deg, #e8e0ff, #d8ccff);
  border-color: var(--violet);
  box-shadow: 0 3px 0 var(--violet);
}

.chip .emoji {
  font-size: 1.35rem;
  line-height: 1;
}

.chip .label {
  font-size: 0.65rem;
  font-weight: 800;
  color: #4a5a7a;
  text-transform: uppercase;
}

.chip.active .label {
  color: var(--violet-deep);
}

#panelFooter {
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid #e8eef8;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.action-btn {
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 900;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
}

.btn-random {
  background: linear-gradient(135deg, #ff9800, #ff5722);
  box-shadow: 0 3px 0 #c9451a;
}

.btn-save {
  background: linear-gradient(135deg, #4caf50, #2e7d32);
  box-shadow: 0 3px 0 #1b5e20;
}

#editor canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
}

/* ========== GAME ========== */
#game {
  position: fixed;
  inset: 0;
  display: none;
  background: var(--sky);
  z-index: 6;
  padding: 0;
}

#game.visible {
  display: block;
}

#canvas-wrap {
  position: absolute;
  inset: 0;
  margin: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--sky);
  box-shadow: none;
}

#render {
  width: 100%;
  height: 100%;
  touch-action: none;
}

#render canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.arcade-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.hud-top-left {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.arcade-lives {
  font-family: var(--pixel);
  font-size: clamp(1.1rem, 4.5vw, 1.55rem);
  line-height: 1;
  letter-spacing: 0.12em;
  color: #ff4d6d;
  text-shadow:
    -2px -2px 0 #111,
     2px -2px 0 #111,
    -2px  2px 0 #111,
     2px  2px 0 #111;
}

.arcade-lives .heart-off {
  color: #4a5568;
  opacity: 0.55;
}

.hud-top-right {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  pointer-events: none;
}

.arcade-score {
  font-family: var(--pixel);
  font-size: clamp(2.2rem, 9vw, 3.6rem);
  line-height: 1;
  color: #fff;
  letter-spacing: 0.04em;
  text-shadow:
    -3px -3px 0 #111,
     3px -3px 0 #111,
    -3px  3px 0 #111,
     3px  3px 0 #111,
     0    4px 0 rgba(0, 0, 0, 0.35);
}

.arcade-who {
  font-family: var(--pixel);
  font-size: 0.55rem;
  color: #ffe08a;
  letter-spacing: 0.06em;
  text-shadow:
    -1px -1px 0 #111,
     1px -1px 0 #111,
    -1px  1px 0 #111,
     1px  1px 0 #111;
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-home {
  width: 54px;
  height: 54px;
  border: 4px solid #111;
  border-radius: 14px;
  background: #ffe08a;
  color: #111;
  font-family: var(--pixel);
  font-size: 1.35rem;
  font-weight: normal;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 4px 0 #111;
  display: grid;
  place-items: center;
  padding: 0;
}

.btn-home:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #111;
}

.btn-home-arrow {
  display: block;
  line-height: 1;
  transform: translateX(-1px);
}

.target-letter {
  position: absolute;
  top: max(58px, calc(env(safe-area-inset-top) + 48px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffe08a;
  color: var(--navy);
  border: 3px solid #111;
  border-radius: 14px;
  padding: 8px 16px;
  line-height: 1;
  box-shadow: 0 4px 0 #111;
  pointer-events: none;
  margin: 0;
  font-family: var(--pixel);
}

.target-letter[hidden] {
  display: none !important;
}

.target-letter .target-label {
  font-family: var(--pixel);
  font-size: 0.55rem;
  letter-spacing: 0.04em;
}

.target-letter .target-char {
  /* Nunito: la 8-bit no dibuja bien Q/Ñ y parecen O */
  font-family: Nunito, system-ui, sans-serif;
  font-size: 2rem;
  font-weight: 900;
  min-width: 1.35em;
  height: 1.35em;
  display: inline-grid;
  place-items: center;
  text-align: center;
  color: #fff;
  background: #111;
  border-radius: 10px;
  padding: 0 0.15em;
  line-height: 1;
  text-shadow: none;
  letter-spacing: 0;
}

.prompt {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: max(14px, env(safe-area-inset-bottom));
  margin: 0;
  color: #fff;
  font-family: var(--pixel);
  font-size: clamp(0.55rem, 2.6vw, 0.75rem);
  letter-spacing: 0.04em;
  text-align: center;
  text-shadow:
    -2px -2px 0 #111,
     2px -2px 0 #111,
    -2px  2px 0 #111,
     2px  2px 0 #111;
  pointer-events: none;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 26, 36, 0.75);
  display: grid;
  place-items: center;
  z-index: 30;
  padding: 16px;
}

.overlay[hidden] {
  display: none;
}

.result-card {
  background: var(--paper);
  border: 4px solid #111;
  border-radius: 20px;
  padding: 28px;
  text-align: center;
  min-width: min(320px, 90vw);
  box-shadow: 0 8px 0 #111;
}

.result-card h2 {
  font-family: var(--pixel);
  font-size: clamp(1rem, 4vw, 1.35rem);
  letter-spacing: 0.04em;
  color: var(--navy);
  margin: 0 0 10px;
}

.result-card p {
  font-family: var(--pixel);
  font-size: 0.55rem;
  letter-spacing: 0.04em;
  line-height: 1.5;
  color: #334;
  margin: 0 0 8px;
}

#btn-again,
.btn-secondary {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 14px 20px;
  font-family: var(--pixel);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  font-weight: normal;
  border: 3px solid #111;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 3px 0 #111;
}

#btn-again {
  background: var(--accent);
  color: #fff;
}

.btn-secondary {
  background: #e8eef5;
  color: var(--ink);
}

.ui-modal {
  z-index: 40;
}

.modal-card {
  width: min(360px, 92vw);
}

.modal-msg {
  margin-bottom: 12px !important;
}

.modal-input {
  display: block;
  width: 100%;
  margin: 8px 0 16px;
  padding: 14px 12px;
  border: 3px solid #111;
  border-radius: 12px;
  font-family: var(--pixel);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--navy);
  background: #fff;
  box-shadow: 0 3px 0 #111;
}

.modal-input:focus {
  outline: none;
  background: #fff8e7;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions .btn-secondary,
.modal-actions #ui-modal-ok {
  flex: 1;
  margin-top: 0;
}

#ui-modal-ok {
  background: #43a047;
  color: #fff;
  font-family: var(--pixel);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  font-weight: normal;
  border: 3px solid #111;
  border-radius: 12px;
  padding: 14px 20px;
  cursor: pointer;
  box-shadow: 0 3px 0 #111;
}

.btn-secondary {
  background: #e8eef8;
  color: var(--navy);
}

/* ========== RETO DE LECTURA ========== */
.reading-challenge {
  z-index: 50;
  background: rgba(15, 30, 50, 0.72);
}

.reading-challenge.show {
  animation: readingFade 0.25s ease;
}

@keyframes readingFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.reading-card {
  width: min(420px, 92vw);
  background: #fff8ef;
  border: 4px solid #111;
  border-radius: 22px;
  padding: 20px 18px 22px;
  text-align: center;
  box-shadow: 0 8px 0 #111;
  transform: scale(0.96);
}

.reading-card.pop-in {
  animation: readingPop 0.35s cubic-bezier(0.2, 1.2, 0.4, 1) forwards;
}

.reading-card.success {
  background: #e8f8e4;
  border-color: #2e7d32;
}

@keyframes readingPop {
  from { transform: scale(0.85); opacity: 0.4; }
  to { transform: scale(1); opacity: 1; }
}

.reading-eyebrow {
  margin: 0 0 4px;
  font-family: var(--pixel);
  font-size: 0.5rem;
  letter-spacing: 0.06em;
  color: #5e35b1;
}

.reading-title {
  margin: 0 0 12px;
  font-family: var(--pixel);
  font-size: clamp(0.85rem, 3.5vw, 1.1rem);
  letter-spacing: 0.04em;
  color: var(--navy);
}

.reading-avatar {
  width: min(200px, 52vw);
  height: auto;
  aspect-ratio: 260 / 300;
  object-fit: cover;
  border: 3px solid #111;
  border-radius: 16px;
  background: #87ceeb;
  margin: 0 auto 10px;
  display: block;
  box-shadow: 0 4px 0 #111;
}

.reading-word-full {
  margin: 0 0 8px;
  font-family: Nunito, system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(1.6rem, 7vw, 2.2rem);
  color: #1b365d;
  letter-spacing: 0.02em;
}

.reading-syllables {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 2px;
  margin: 4px 0 12px;
  min-height: 2.6rem;
}

.reading-syllables .syl {
  font-family: Nunito, system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(1.35rem, 6vw, 1.9rem);
  color: #1b365d;
  background: #ffe08a;
  border: 3px solid #111;
  border-radius: 12px;
  padding: 6px 10px;
  line-height: 1;
  box-shadow: 0 3px 0 #111;
  transition: background 0.15s ease, transform 0.15s ease;
}

.reading-syllables .syl.next {
  background: #7ec8ff;
  transform: translateY(-2px);
}

.reading-syllables .syl.done {
  background: #7ddea0;
}

.reading-syllables .syl.just-done {
  animation: syl-pop 0.35s ease-out;
}

@keyframes syl-pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.18);
    background: #3dce6e;
  }
  100% {
    transform: scale(1);
  }
}

.reading-syllables .syl-dash {
  font-family: Nunito, system-ui, sans-serif;
  font-weight: 900;
  font-size: 1.6rem;
  color: #1b365d;
  padding: 0 2px;
}

.reading-status {
  margin: 0 0 8px;
  font-family: var(--pixel);
  font-size: 0.5rem;
  letter-spacing: 0.04em;
  line-height: 1.45;
  color: #334;
}

.reading-status.on { color: #2e7d32; }
.reading-status.ok { color: #1b5e20; }
.reading-status.bad { color: #c62828; }

.reading-vu {
  height: 10px;
  border-radius: 999px;
  background: #dfe6ef;
  border: 2px solid #111;
  overflow: hidden;
  margin: 0 auto 10px;
  max-width: 220px;
}

.reading-vu > div {
  height: 100%;
  width: 0%;
  background: #43a047;
  transition: width 0.05s linear;
}

.reading-heard {
  min-height: 1.2em;
  margin: 0 0 12px;
  font-family: Nunito, system-ui, sans-serif;
  font-weight: 800;
  font-size: 0.9rem;
  color: #4a5a7a;
}

.reading-mic-btn {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border: 3px solid #111;
  border-radius: 14px;
  background: #7e57c2;
  color: #fff;
  font-family: var(--pixel);
  font-size: 0.55rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 3px 0 #111;
  transition: background 0.15s ease;
}

.reading-mic-btn.is-listening {
  background: #2e9b57;
}

.reading-mic-btn.is-busy {
  background: #8a94a8;
}

.reading-mic-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #111;
}

.reading-skip-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 12px 16px;
  border: 3px solid #111;
  border-radius: 14px;
  background: #e8eef5;
  color: #334;
  font-family: var(--pixel);
  font-size: 0.48rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 3px 0 #111;
}

.reading-tip {
  margin: 12px 0 0;
  font-family: Nunito, system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  color: #6a7a90;
  line-height: 1.35;
}

@media (max-width: 720px) {
  #panel {
    width: 100%;
    max-height: 52%;
    bottom: auto;
    border-radius: 0 0 20px 20px;
  }

  #editor.active #panel {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  }

  .character-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .character-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
