:root {
  --bg: #302e2c;
  --bg-soft: #3d3a37;
  --card: #f5f5f5;
  --card-2: #ffffff;
  --text: #2d2d2d;
  --muted: #777;
  --line: #d6d6d6;
  --accent: #7aa526;
  --accent-dark: #5f8d17;
  --orange: #b95f00;
  --dark-panel: rgba(0, 0, 0, 0.16);
  --light-square: #f0d9b5;
  --dark-square: #b58863;
  --last: rgba(255, 245, 120, 0.55);
  --target: rgba(25, 25, 25, 0.20);
  --select: rgba(120, 165, 38, 0.50);
  color-scheme: light;
}

body.dark {
  --bg: #202124;
  --bg-soft: #2d2e31;
  --card: #2f3033;
  --card-2: #38393d;
  --text: #e6e6e6;
  --muted: #aaa;
  --line: #4a4b4f;
  --dark-panel: rgba(255, 255, 255, 0.05);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
}
body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background:
    radial-gradient(circle at top left, rgba(255,255,255,.08), transparent 32rem),
    linear-gradient(180deg, var(--bg-soft), var(--bg));
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  -webkit-tap-highlight-color: transparent;
}

button, a, input, select, textarea {
  touch-action: manipulation;
}

img, .piece, .square, .board, .board-wrap {
  -webkit-user-drag: none;
  user-select: none;
}

button { font: inherit; cursor: pointer; }
.topbar {
  height: calc(64px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  gap: 22px;
  padding: env(safe-area-inset-top, 0px) calc(28px + env(safe-area-inset-right, 0px)) 0 calc(28px + env(safe-area-inset-left, 0px));
  background: rgba(245,245,245,.92);
  box-shadow: 0 1px 12px rgba(0,0,0,.18);
  position: sticky;
  top: 0;
  z-index: 10;
}
body.dark .topbar { background: rgba(34,34,36,.94); }
.brand {
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-size: 28px;
  letter-spacing: .5px;
}
.brand-mark { color: #6b6b6b; font-size: 34px; transform: rotate(-12deg); display: inline-block; }
.topnav { display: flex; gap: 6px; flex: 1; }
.topnav button {
  background: transparent;
  border: 0;
  color: #555;
  padding: 22px 12px;
  letter-spacing: .7px;
}
body.dark .topnav button { color: #c8c8c8; }
.topnav .nav-active { color: var(--accent-dark); border-bottom: 3px solid var(--accent); }
.top-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; min-width: max-content; }
.badge { background: var(--dark-panel); padding: 6px 10px; border-radius: 999px; color: var(--muted); font-size: 12px; }
.icon-btn {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  flex: 0 0 36px;
  aspect-ratio: 1 / 1;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  border: 0;
  background: var(--dark-panel);
  color: var(--text);
  line-height: 1;
  overflow: hidden;
}
.icon-btn > span {
  display: inline-grid;
  place-items: center;
  width: 100%;
  height: 100%;
  line-height: 1;
}
.icon-btn:disabled { opacity: .38; filter: grayscale(1); cursor: not-allowed; }
.undo-action { font-size: 20px; line-height: 1; }

.page { max-width: 1180px; margin: 26px auto; padding: 0 18px; width: 100%; overflow-x: hidden; }
.view { display: none; }
.view-active { display: block; }
.card {
  background: var(--card);
  border-radius: 6px;
  box-shadow: 0 3px 18px rgba(0,0,0,.22);
  border: 1px solid rgba(0,0,0,.06);
}
.lobby-grid { display: grid; grid-template-columns: 1fr 340px; gap: 26px; align-items: start; }
.quick-area { padding: 0; overflow: hidden; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.tab { border: 0; background: transparent; padding: 18px 12px; color: var(--muted); }
.tab.active { color: var(--orange); border-bottom: 2px solid var(--orange); }
.time-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 28px; }
.time-card {
  height: 112px;
  border: 0;
  border-radius: 4px;
  background: var(--card-2);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.04), 0 2px 5px rgba(0,0,0,.08);
  color: var(--text);
}
.time-card b { display: block; font-size: 36px; font-weight: 300; margin-bottom: 8px; }
.time-card span { color: var(--muted); }
.center { text-align: center; padding-bottom: 22px; }
.muted { color: var(--muted); }
.lobby-actions { display: flex; flex-direction: column; gap: 12px; }
.big-action {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 16px 22px;
  border: 0;
  border-radius: 6px;
  background: #9a4f00;
  color: white;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,.22);
  text-align: left;
}
.big-action span { font-size: 28px; opacity: .85; }
.big-action.green { background: var(--accent-dark); }
.big-action.ghost { background: var(--card); color: var(--text); }
.stats { padding: 18px; display: grid; gap: 4px; }

.board-layout { grid-template-columns: minmax(320px, 720px) minmax(280px, 390px); gap: 24px; align-items: start; min-width: 0; }
.view-active.board-layout { display: grid; }
.board-wrap { width: min(72vh, 720px); max-width: 100%; min-width: 0; margin: 0 auto; position: relative; }
.board {
  width: 100%;
  aspect-ratio: 1/1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(0,0,0,.35);
  background: #111;
}
.square {
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(28px, 7.4vw, 68px);
  line-height: 1;
  position: relative;
  color: #222;
  user-select: none;
}
.square.light { background: var(--light-square); }
.square.dark { background: var(--dark-square); }
.square.selected { box-shadow: inset 0 0 0 9999px var(--select); }
.square.last { box-shadow: inset 0 0 0 9999px var(--last); }
.square.target::after {
  content: "";
  width: 30%; height: 30%; border-radius: 50%; background: var(--target);
  position: absolute;
}
.square.capture::after {
  content: "";
  width: 78%; height: 78%; border-radius: 50%; border: 6px solid var(--target);
  position: absolute;
}
.square .coord-file, .square .coord-rank {
  position: absolute;
  font-size: 11px;
  font-weight: 700;
  opacity: .58;
}
.square .coord-file { bottom: 3px; right: 5px; }
.square .coord-rank { top: 3px; left: 5px; }
.piece.white { color: #f7f7f7; text-shadow: 0 1px 2px #000, 0 0 1px #000; }
.piece.black { color: #222; text-shadow: 0 1px 1px rgba(255,255,255,.35); }
.side-panel { min-height: 520px; padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; max-width: 100%; }
.panel-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.panel-head h2 { margin: 0 0 6px; font-size: 22px; }
.small-btn, .secondary, .start-btn {
  border: 0;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  font-weight: 700;
}
.small-btn.green { background: var(--accent-dark); }
.secondary { background: var(--card-2); color: var(--text); border: 1px solid var(--line); }
.status-box {
  padding: 14px;
  background: var(--card-2);
  border-radius: 5px;
  border-left: 4px solid var(--accent);
  min-height: 52px;
}
.status-box.error { border-left-color: #b23b3b; }
.move-list {
  background: var(--card-2);
  border-radius: 5px;
  padding: 10px;
  min-height: 180px;
  max-height: 310px;
  overflow: auto;
  display: grid;
  grid-template-columns: 42px 1fr 1fr;
  align-content: start;
  gap: 4px 8px;
}
.move-list span { padding: 5px 6px; border-radius: 3px; }
.move-list .num { color: var(--muted); text-align: right; }
.move-list .move { background: rgba(0,0,0,.05); }
.panel-actions { display: flex; gap: 10px; margin-top: auto; }
.progress { height: 8px; background: var(--card-2); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s ease; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.62);
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
}
.hidden { display: none !important; }
.modal { width: min(620px, 100%); padding: 0 0 18px; position: relative; overflow: hidden; }
.modal h1 { margin: 0; padding: 22px; text-align: center; font-weight: 300; color: #666; background: var(--card-2); }
body.dark .modal h1 { color: #ddd; }
.modal-close {
  position: absolute; top: -14px; right: -14px; width: 38px; height: 38px; border-radius: 50%;
  border: 0; background: #fff; color: #666; font-size: 30px; line-height: 1;
}
.select-line { margin: 18px 12px 10px; padding: 10px 14px; display: flex; align-items: center; gap: 12px; background: var(--card-2); border-radius: 5px; box-shadow: inset 0 0 0 1px var(--line); }
.select-line small { color: var(--muted); }
.mode-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); margin-top: 14px; }
.mode-tabs button { border: 0; background: transparent; padding: 14px; color: var(--muted); }
.mode-tabs .active { color: var(--accent-dark); border-bottom: 2px solid var(--accent); }
.label { display: block; text-align: center; margin: 18px 0 8px; color: #555; font-weight: 600; }
body.dark .label { color: #ddd; }
.level-grid { display: grid; grid-template-columns: repeat(8, 1fr); margin: 0 12px; }
.level-grid button, .color-grid button {
  border: 1px solid var(--line);
  background: var(--card-2);
  min-height: 44px;
  color: var(--text);
}
.level-grid button.active, .color-grid button.active { background: var(--accent); color: #fff; }
.color-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 12px 20px; }
.color-grid button { display: grid; place-items: center; gap: 3px; min-height: 76px; }
.color-grid button { font-size: 26px; }
.color-grid button span { font-size: 13px; }
.start-btn { display: block; margin: 0 auto; min-width: 280px; background: var(--card-2); color: var(--text); border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.start-btn:hover { background: var(--accent); color: #fff; }

@media (max-width: 860px) {
  body { min-height: 100dvh; }
  .topbar {
    height: 54px;
    padding: 0 max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
    gap: 8px;
    overflow: hidden;
  }
  .brand { flex: 0 0 auto; }
  .brand span:last-child { display: none; }
  .brand-mark { font-size: 30px; }
  .topnav { gap: 0; overflow: auto; -webkit-overflow-scrolling: touch; min-width: 0; scrollbar-width: none; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav button { padding: 18px 8px; font-size: 12px; white-space: nowrap; }
  .top-actions { min-width: 0; gap: 8px; flex: 0 0 auto; }
  .badge {
    max-width: 34vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 5px 8px;
  }
  .icon-btn { width: 34px; height: 34px; flex: 0 0 34px; }
  .page {
    max-width: 100%;
    margin: 14px auto;
    padding: 0 8px calc(96px + env(safe-area-inset-bottom));
  }
  .lobby-grid, .view-active.board-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .time-cards { grid-template-columns: repeat(2, 1fr); padding: 14px; }
  .board-wrap { width: min(96vw, 680px); max-width: 100%; }
  .side-panel { min-height: auto; width: 100%; }
  .move-list { max-height: 190px; }
  .level-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 520px) {
  .topnav button { font-size: 11px; padding-inline: 6px; }
  .badge { max-width: 28vw; }
  .board-wrap { width: min(96vw, calc(100vw - 16px)); }
  .side-panel { padding: 12px; border-radius: 6px; }
  .panel-head h2 { font-size: 20px; }
  .analysis-grid, .analysis-lines > div { grid-template-columns: 90px minmax(0, 1fr); }
  .candidate-row { grid-template-columns: 64px minmax(0, 1fr); }
}

/* v2: lógica visual estilo Lila/chessground */
.board.lila-board {
  background-image: url('/static/assets/board/brown.png');
  background-size: cover;
  background-position: center;
  touch-action: none;
  outline: 1px solid rgba(0,0,0,.22);
}
.board.lila-board .square {
  background: transparent;
  padding: 0;
  overflow: hidden;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.board.lila-board .square.light,
.board.lila-board .square.dark { background: transparent; }
.board.lila-board .square::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 1;
}
.board.lila-board .square.last,
.board.lila-board .square.selected { box-shadow: none; }
.board.lila-board .square.last::before {
  background: rgba(205, 210, 106, .62);
  opacity: 1;
}
.board.lila-board .square.selected::before {
  background: rgba(20, 85, 30, .42);
  opacity: 1;
}
.board.lila-board .square.check::before {
  background: radial-gradient(ellipse at center, rgba(255,0,0,.78) 0%, rgba(231,0,0,.46) 38%, rgba(169,0,0,0) 72%);
  opacity: 1;
}
.board.lila-board .square.selected.last::before {
  background: linear-gradient(rgba(20, 85, 30, .38), rgba(20, 85, 30, .38)), rgba(205, 210, 106, .62);
}
.board.lila-board .square.target::after,
.board.lila-board .square.capture::after {
  z-index: 3;
  pointer-events: none;
}
.board.lila-board .square.target::after {
  width: 27%;
  height: 27%;
  background: rgba(20, 20, 20, .26);
}
.board.lila-board .square.capture::after {
  width: 80%;
  height: 80%;
  border: clamp(4px, .75vw, 7px) solid rgba(20, 20, 20, .24);
  background: transparent;
}
.piece {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 1px rgba(0,0,0,.22));
  transform: translateZ(0);
  transition: transform .09s ease, opacity .09s ease;
  pointer-events: none;
  user-select: none;
}
.square.has-piece:hover .piece { transform: scale(1.025); }
.piece.drag-source { opacity: 0; }
.piece-drag-ghost {
  position: fixed;
  z-index: 2000;
  width: min(11.8vw, 92px);
  height: min(11.8vw, 92px);
  max-width: 15vh;
  max-height: 15vh;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.06);
  filter: drop-shadow(0 8px 14px rgba(0,0,0,.45));
}
.board.lila-board .coord-file,
.board.lila-board .coord-rank {
  z-index: 4;
  font-size: clamp(9px, 1.45vw, 13px);
  font-weight: 700;
  opacity: .78;
  text-shadow: 0 1px 1px rgba(255,255,255,.25);
}
.board.lila-board .square.light .coord-file,
.board.lila-board .square.light .coord-rank { color: #8b6f45; }
.board.lila-board .square.dark .coord-file,
.board.lila-board .square.dark .coord-rank { color: #f0d9b5; }
.move-list .move.recent { box-shadow: inset 0 0 0 1px rgba(122,165,38,.28); background: rgba(122,165,38,.12); }
.icon-btn { display: inline-grid; place-items: center; }
.promotion-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.45);
  padding: 18px;
}
.promotion-card {
  padding: 18px;
  min-width: min(360px, 94vw);
  text-align: center;
}
.promotion-card h2 {
  margin: 0 0 14px;
  font-weight: 500;
  font-size: 20px;
}
.promotion-choices {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.promotion-choices button {
  border: 1px solid var(--line);
  background: var(--card-2);
  border-radius: 6px;
  aspect-ratio: 1 / 1;
  padding: 4px;
}
.promotion-choices button:hover { box-shadow: inset 0 0 0 999px rgba(122,165,38,.16); }
.promotion-choices img { width: 100%; height: 100%; display: block; }
@media (max-width: 860px) {
  .piece-drag-ghost { width: 13.5vw; height: 13.5vw; }
  .promotion-card { min-width: min(320px, 94vw); }
}
.board.lila-board .square.drag-origin .piece { opacity: 0; }

/* v3: seletor de puzzles do Lila e motor stockfish.js */
.engine-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 0 12px 20px;
}
.engine-grid button {
  border: 1px solid var(--line);
  background: var(--card-2);
  min-height: 58px;
  color: var(--text);
  border-radius: 4px;
  display: grid;
  place-items: center;
  gap: 3px;
  font-weight: 700;
}
.engine-grid button span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.engine-grid button.active {
  background: var(--accent);
  color: #fff;
}
.engine-grid button.active span { color: rgba(255,255,255,.88); }
.puzzle-selector {
  display: grid;
  gap: 7px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 12px;
}
.puzzle-selector label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.puzzle-selector select,
.puzzle-selector input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  color: var(--text);
  padding: 0 9px;
}
.puzzle-selector #puzzleSelect { min-height: 42px; }
.selector-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.selector-row .secondary { padding: 8px 10px; }
@media (max-width: 860px) {
  .engine-grid { grid-template-columns: 1fr; }
  .selector-row { align-items: stretch; flex-direction: column; }
}

/* v4: análise/tutor de jogada inspirado no módulo analyse do Lila */
.analysis-card {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 5px;
  padding: 12px;
  display: grid;
  gap: 10px;
}
.analysis-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.analysis-head > div {
  display: grid;
  gap: 2px;
}
.analysis-glyph {
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  height: 34px;
  min-height: 34px;
  max-height: 34px;
  flex: 0 0 34px;
  aspect-ratio: 1 / 1;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(122,165,38,.16);
  color: var(--accent-dark);
  font-weight: 900;
  line-height: 1;
  overflow: hidden;
}
.analysis-card p {
  margin: 0;
  line-height: 1.35;
}
.analysis-grid {
  display: grid;
  grid-template-columns: 95px 1fr;
  gap: 6px 10px;
  font-size: 13px;
}
.analysis-grid span {
  color: var(--muted);
}
.analysis-goodMove { border-left-color: var(--accent); }
.analysis-inaccuracy { border-left-color: #4da3d5; }
.analysis-mistake { border-left-color: #e69d00; }
.analysis-blunder { border-left-color: #db3031; }
.analysis-inaccuracy .analysis-glyph { background: rgba(77,163,213,.16); color: #237fac; }
.analysis-mistake .analysis-glyph { background: rgba(230,157,0,.16); color: #a66d00; }
.analysis-blunder .analysis-glyph { background: rgba(219,48,49,.16); color: #b32424; }
.move-list .move.verdict-goodMove { color: var(--accent-dark); }
.move-list .move.verdict-inaccuracy { color: #237fac; }
.move-list .move.verdict-mistake { color: #a66d00; }
.move-list .move.verdict-blunder { color: #b32424; font-weight: 700; }
.board.lila-board .square.best-from::before {
  background: rgba(77, 163, 213, .35);
  opacity: 1;
}
.board.lila-board .square.best-to::before {
  background: radial-gradient(circle at center, rgba(77,163,213,.55) 0 34%, rgba(77,163,213,.18) 36% 100%);
  opacity: 1;
}
.panel-actions { flex-wrap: wrap; }
.panel-actions .secondary { flex: 1 1 auto; }

/* v5: análise/tutor ampliada */
.analysis-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.analysis-tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(0,0,0,.035);
  font-size: 12px;
  color: var(--text);
}
.analysis-lines {
  display: grid;
  gap: 6px;
  font-size: 13px;
}
.analysis-lines > div {
  display: grid;
  grid-template-columns: 95px 1fr;
  gap: 10px;
  align-items: start;
}
.analysis-lines span,
.analysis-list strong,
.candidate-list strong {
  color: var(--muted);
}
.analysis-lines b {
  font-weight: 650;
  line-height: 1.35;
}
.analysis-list {
  display: grid;
  gap: 8px;
  font-size: 13px;
}
.analysis-list ul {
  margin: 4px 0 0 18px;
  padding: 0;
}
.analysis-list li {
  margin: 3px 0;
  line-height: 1.32;
}
.candidate-list {
  display: grid;
  gap: 5px;
  font-size: 13px;
}
.candidate-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  background: rgba(0,0,0,.035);
}
.candidate-row span { color: var(--muted); }
.dark .analysis-tags span,
.dark .candidate-row { background: rgba(255,255,255,.055); }

/* v10: painel de análise em modo tutor */
.coach-summary {
  display: grid;
  gap: 5px;
  padding: 8px;
  border-radius: 5px;
  background: rgba(77, 163, 213, .08);
  border: 1px solid rgba(77, 163, 213, .18);
}
.coach-summary > div {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 8px;
}
.coach-summary span {
  color: var(--muted);
  font-weight: 650;
}
.coach-summary b {
  font-weight: 650;
}
.analysis-grid b,
.analysis-lines b {
  color: var(--text);
}


/* v11: ajuste mobile, área segura e bloqueio de zoom por duplo toque */
.modal-backdrop, .promotion-backdrop, .modal, .promotion-card, .side-panel, .card, .topbar {
  touch-action: manipulation;
}
.board.lila-board, .board.lila-board * {
  touch-action: none;
}
@media (max-width: 860px) {
  .modal-backdrop, .promotion-backdrop {
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(96px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  .promotion-card {
    max-width: calc(100vw - 24px);
  }
  .promotion-choices {
    grid-template-columns: repeat(4, minmax(58px, 1fr));
  }
}


/* v12: tabuleiro somente por cliques; arraste de peças bloqueado */
.board.lila-board,
.board.lila-board .square,
.board.lila-board .piece {
  -webkit-user-drag: none;
  user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.board.lila-board .square {
  cursor: pointer;
}
.piece.drag-source,
.piece-drag-ghost,
.board.lila-board .square.drag-origin .piece {
  display: none !important;
}


/* restore/undo/check: animação vermelha de xeque e xeque-mate */
@keyframes lila-check-red-flash {
  0% { opacity: .25; transform: scale(.92); }
  45% { opacity: 1; transform: scale(1.04); }
  100% { opacity: .88; transform: scale(1); }
}
@keyframes lila-mate-red-pulse {
  0%, 100% { opacity: .82; filter: saturate(1); }
  50% { opacity: 1; filter: saturate(1.45); }
}
@keyframes lila-king-alert {
  0%, 100% { transform: translateX(0) scale(1); }
  25% { transform: translateX(-2px) scale(1.025); }
  75% { transform: translateX(2px) scale(1.025); }
}
.board.lila-board .square.check::before {
  background: radial-gradient(ellipse at center, rgba(255,0,0,.90) 0%, rgba(210,0,0,.56) 38%, rgba(120,0,0,0) 74%);
  opacity: 1;
  animation: lila-check-red-flash .48s ease-out 0s 2;
}
.board.lila-board .square.checkmate::before {
  background: radial-gradient(ellipse at center, rgba(255,0,0,.98) 0%, rgba(195,0,0,.72) 42%, rgba(75,0,0,.22) 74%, rgba(75,0,0,0) 100%);
  opacity: 1;
  animation: lila-mate-red-pulse .72s ease-in-out 0s 4;
}
.board.lila-board .square.checkmate .piece {
  animation: lila-king-alert .30s ease-in-out 0s 4;
}

/* v12-check-v2: xeque sempre vermelho; mate mais intenso */
.board.lila-board .square.check {
  box-shadow: inset 0 0 0 clamp(3px, .55vw, 6px) rgba(180, 0, 0, .52), inset 0 0 24px rgba(255, 0, 0, .42);
}
.board.lila-board .square.check::before {
  background:
    radial-gradient(ellipse at center, rgba(255, 20, 20, .96) 0%, rgba(225, 0, 0, .70) 34%, rgba(140, 0, 0, .20) 62%, rgba(140, 0, 0, 0) 82%);
  opacity: 1;
  animation: lila-check-red-flash .52s ease-out 0s 2;
}
.board.lila-board .square.checkmate {
  box-shadow: inset 0 0 0 clamp(4px, .75vw, 8px) rgba(120, 0, 0, .78), inset 0 0 36px rgba(255, 0, 0, .72), 0 0 18px rgba(255, 0, 0, .50);
}
.board.lila-board .square.checkmate::before {
  background:
    radial-gradient(ellipse at center, rgba(255, 0, 0, 1) 0%, rgba(205, 0, 0, .86) 38%, rgba(95, 0, 0, .42) 70%, rgba(75, 0, 0, 0) 100%);
  opacity: 1;
  animation: lila-mate-red-pulse .62s ease-in-out 0s 5;
}
.board.lila-board .square.checkmate .piece {
  animation: lila-king-alert .28s ease-in-out 0s 5;
}


/* modern-buttons-v1: botões superiores e inferiores mais modernos */
:root {
  --btn-glass: rgba(255, 255, 255, .68);
  --btn-glass-strong: rgba(255, 255, 255, .88);
  --btn-shadow: 0 10px 26px rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.55);
  --btn-shadow-soft: 0 5px 16px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.45);
}
body.dark {
  --btn-glass: rgba(255, 255, 255, .08);
  --btn-glass-strong: rgba(255, 255, 255, .12);
  --btn-shadow: 0 10px 26px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.10);
  --btn-shadow-soft: 0 5px 16px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.08);
}
.topbar {
  height: 68px;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(238,238,238,.86));
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid rgba(255,255,255,.55);
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
}
body.dark .topbar {
  background: linear-gradient(180deg, rgba(43,43,46,.92), rgba(31,32,34,.86));
  border-bottom-color: rgba(255,255,255,.06);
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 14px;
  background: var(--btn-glass);
  box-shadow: var(--btn-shadow-soft);
  transform: rotate(-10deg);
}
.topnav {
  background: rgba(0,0,0,.045);
  border: 1px solid rgba(0,0,0,.05);
  border-radius: 999px;
  padding: 5px;
  gap: 3px;
  flex: 0 1 auto;
}
body.dark .topnav {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.08);
}
.topnav button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: .12em;
  color: #5f5f5f;
  border-bottom: 0 !important;
  transition: transform .14s ease, background .14s ease, color .14s ease, box-shadow .14s ease;
}
.topnav button:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,.48);
}
.topnav .nav-active {
  color: #fff;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  box-shadow: 0 7px 16px rgba(95,141,23,.32), inset 0 1px 0 rgba(255,255,255,.28);
}
body.dark .topnav button { color: #d2d2d2; }
body.dark .topnav .nav-active { color: #fff; }
.top-actions {
  margin-left: auto;
  gap: 12px;
}
.icon-btn {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 50%;
  background: var(--btn-glass);
  border: 1px solid rgba(255,255,255,.58);
  box-shadow: var(--btn-shadow);
  color: var(--text);
  font-size: 20px;
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease, opacity .14s ease;
}
body.dark .icon-btn { border-color: rgba(255,255,255,.08); }
.icon-btn span {
  display: inline-grid;
  place-items: center;
  width: 100%;
  height: 100%;
  line-height: 1;
}
.icon-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  background: var(--btn-glass-strong);
  box-shadow: 0 14px 30px rgba(0,0,0,.20), inset 0 1px 0 rgba(255,255,255,.65);
}
.icon-btn:active:not(:disabled) { transform: translateY(0) scale(.96); }
.icon-btn:disabled { opacity: .36; box-shadow: none; }
.undo-action {
  background: linear-gradient(180deg, #fafafa, #dedede);
  color: #4d4d4d;
  font-size: 25px;
}
body.dark .undo-action {
  background: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,.08));
  color: #f0f0f0;
}
.small-btn,
.secondary,
.start-btn,
.big-action,
.time-card,
.tab,
.puzzle-selector select,
.puzzle-selector input {
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease, border-color .14s ease, color .14s ease;
}
.small-btn,
.secondary,
.start-btn {
  border-radius: 14px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.small-btn,
.start-btn {
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  border: 1px solid rgba(255,255,255,.35);
  color: #fff;
  box-shadow: 0 10px 22px rgba(95,141,23,.28), inset 0 1px 0 rgba(255,255,255,.28);
}
.small-btn:hover,
.start-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(95,141,23,.34), inset 0 1px 0 rgba(255,255,255,.35);
}
.primary-action span:first-child { font-size: 18px; line-height: 1; }
.panel-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: auto;
}
.panel-actions .secondary,
.selector-row .secondary,
.action-btn {
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(242,242,242,.90));
  color: var(--text);
  box-shadow: 0 8px 20px rgba(0,0,0,.10), inset 0 1px 0 rgba(255,255,255,.72);
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
}
body.dark .panel-actions .secondary,
body.dark .selector-row .secondary,
body.dark .action-btn {
  border-color: rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.07));
  box-shadow: 0 8px 20px rgba(0,0,0,.26), inset 0 1px 0 rgba(255,255,255,.08);
}
.action-btn span:first-child {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(122,165,38,.14);
  color: var(--accent-dark);
  font-size: 15px;
}
.panel-actions .secondary:hover,
.selector-row .secondary:hover,
.action-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(122,165,38,.32);
  box-shadow: 0 12px 26px rgba(0,0,0,.16), inset 0 1px 0 rgba(255,255,255,.78);
}
.panel-actions .secondary:active,
.selector-row .secondary:active,
.action-btn:active { transform: translateY(0) scale(.98); }
.action-btn.active-soft {
  background: linear-gradient(180deg, rgba(122,165,38,.20), rgba(122,165,38,.10));
  border-color: rgba(122,165,38,.42);
}
.compact-action { white-space: nowrap; }
.big-action {
  border-radius: 18px;
  min-height: 68px;
  background: linear-gradient(135deg, #ac6210, #7d3d00);
  box-shadow: 0 14px 28px rgba(0,0,0,.20), inset 0 1px 0 rgba(255,255,255,.20);
}
.big-action.green { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); }
.big-action.ghost {
  background: var(--btn-glass);
  border: 1px solid rgba(255,255,255,.38);
  box-shadow: var(--btn-shadow-soft);
}
.big-action:hover { transform: translateY(-2px); }
.time-card {
  border-radius: 18px;
  box-shadow: 0 10px 22px rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.50);
}
.time-card:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(0,0,0,.13); }
.mode-tabs button,
.level-grid button,
.color-grid button {
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease, color .14s ease;
}
.level-grid button.active,
.color-grid button.active,
.mode-tabs .active {
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22);
}
@media (max-width: 860px) {
  .topbar {
    height: 62px;
    gap: 8px;
  }
  .brand-mark {
    width: 38px;
    height: 38px;
    font-size: 27px;
    border-radius: 13px;
  }
  .topnav {
    border-radius: 999px;
    padding: 4px;
    flex: 1 1 auto;
  }
  .topnav button {
    min-height: 36px;
    padding: 0 10px;
    font-size: 11px;
    letter-spacing: .10em;
  }
  .top-actions { gap: 8px; }
  .icon-btn {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }
  .panel-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    position: sticky;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 8;
    padding: 8px;
    margin-inline: -6px;
    border-radius: 20px;
    background: rgba(245,245,245,.76);
    backdrop-filter: blur(14px) saturate(1.15);
    -webkit-backdrop-filter: blur(14px) saturate(1.15);
    box-shadow: 0 12px 28px rgba(0,0,0,.18);
  }
  body.dark .panel-actions { background: rgba(38,38,40,.76); }
  .panel-actions .secondary { min-height: 46px; border-radius: 15px; padding-inline: 8px; }
}
@media (max-width: 520px) {
  .topbar { padding-inline: 8px; }
  .topnav button { padding: 0 7px; }
  .top-actions { gap: 6px; }
  .icon-btn { width: 40px; height: 40px; flex-basis: 40px; }
  .panel-actions .secondary { font-size: 13px; }
  .action-btn span:first-child { width: 24px; height: 24px; font-size: 14px; }
}

/* nav-compact-v1: menu superior menor e sem efeito cinza ao tocar */
.topbar {
  height: 62px;
}
.topnav {
  padding: 4px;
  gap: 2px;
  -webkit-tap-highlight-color: transparent;
}
.topnav button {
  min-height: 36px;
  padding: 0 13px;
  font-size: 12px;
  letter-spacing: .105em;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.topnav button:focus,
.topnav button:focus-visible {
  outline: none;
  box-shadow: none;
}
.topnav button:hover:not(.nav-active),
.topnav button:active:not(.nav-active),
.topnav button:focus:not(.nav-active) {
  background: rgba(122, 165, 38, .10);
  color: var(--accent-dark);
  transform: none;
}
.topnav .nav-active,
.topnav .nav-active:hover,
.topnav .nav-active:active,
.topnav .nav-active:focus,
.topnav .nav-active:focus-visible {
  color: #fff !important;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark)) !important;
  box-shadow: 0 7px 16px rgba(95,141,23,.28), inset 0 1px 0 rgba(255,255,255,.26) !important;
  transform: none !important;
}

@media (max-width: 860px) {
  .topbar {
    height: 56px;
    gap: 7px;
  }
  .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 24px;
    border-radius: 12px;
  }
  .topnav {
    padding: 3px;
    gap: 2px;
  }
  .topnav button {
    min-height: 31px;
    padding: 0 8px;
    font-size: 10.5px;
    letter-spacing: .085em;
  }
  .top-actions { gap: 6px; }
  .icon-btn {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }
}

@media (max-width: 520px) {
  .topbar {
    height: 54px;
    padding-inline: 7px;
  }
  .topnav {
    flex: 1 1 auto;
    min-width: 0;
  }
  .topnav button {
    min-height: 30px;
    padding: 0 7px;
    font-size: 10px;
    letter-spacing: .075em;
  }
  .icon-btn {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }
}


/* check-human-delay-v1: xeque comum mais suave; xeque-mate mantém destaque forte */
.board.lila-board .square.check:not(.checkmate) {
  box-shadow:
    inset 0 0 0 clamp(2px, .38vw, 4px) rgba(180, 0, 0, .30),
    inset 0 0 18px rgba(255, 0, 0, .22);
}
.board.lila-board .square.check:not(.checkmate)::before {
  background:
    radial-gradient(ellipse at center,
      rgba(255, 70, 70, .62) 0%,
      rgba(220, 0, 0, .38) 36%,
      rgba(140, 0, 0, .12) 62%,
      rgba(140, 0, 0, 0) 82%);
  opacity: 1;
  animation: lila-check-red-flash .46s ease-out 0s 1;
}

/* v12 levels/delay: popup de análise/dica */
.analysis-settings-card { width: min(560px, calc(100vw - 28px)); }
.settings-grid {
  display: grid;
  gap: 10px;
  padding: 18px 20px 8px;
}
.settings-grid label {
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--muted);
  margin-top: 6px;
}
.settings-grid select {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  padding: 0 12px;
  font-size: 15px;
  font-weight: 700;
}
.settings-grid small {
  color: var(--muted);
  line-height: 1.35;
}
.analysis-settings-card .start-btn {
  width: calc(100% - 40px);
  margin: 12px 20px 0;
  min-height: 50px;
  border-radius: 14px;
}
@media (max-width: 720px) {
  .analysis-settings-card { align-self: end; border-radius: 22px 22px 0 0; }
  .settings-grid { padding: 14px 16px 8px; }
}

/* Treino de abertura/defesa no modal de nova partida */
.opening-training-box {
  margin: 0 12px 18px;
  padding: 12px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}
.opening-training-box select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  background: var(--card);
  color: var(--text);
  font-weight: 700;
}

.opening-training-box select + select {
  margin-top: 8px;
}

.opening-training-box small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.35;
}
body.dark .opening-training-box select { background: rgba(255,255,255,.05); }

/* v12 opening training feedback */
.status-box { white-space: pre-line; }
.move.training-warning {
  box-shadow: inset 0 0 0 1px rgba(190, 120, 0, .45);
  background: rgba(255, 193, 7, .16);
}
body.dark .move.training-warning {
  background: rgba(255, 193, 7, .18);
}


/* pt-pieces-undo-v1: centralização real do botão desfazer no topo */
.icon-btn,
.undo-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  line-height: 1;
  text-align: center;
}
.icon-btn > span,
.undo-action > span,
.undo-icon {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100%;
  height: 100%;
  line-height: 1 !important;
  margin: 0 !important;
  padding: 0 !important;
}
.undo-icon {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 24px;
  font-weight: 800;
  transform: translateY(-1px);
}
@media (max-width: 520px) {
  .undo-icon { font-size: 22px; transform: translateY(-1px); }
}

/* full-game-review-v1: desfazer centralizado por SVG e análise completa no fim */
.icon-btn.undo-action {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  overflow: hidden;
  line-height: 0 !important;
}
.icon-btn.undo-action .undo-icon {
  position: absolute !important;
  inset: 0 !important;
  display: grid !important;
  place-items: center !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: none !important;
  line-height: 0 !important;
}
.icon-btn.undo-action .undo-icon svg {
  width: 27px;
  height: 27px;
  display: block;
  margin: auto;
  transform: none;
}
@media (max-width: 520px) {
  .icon-btn.undo-action .undo-icon svg { width: 25px; height: 25px; }
}

.game-review-controls {
  margin-top: 14px;
  padding: 10px;
  border: 1px solid rgba(95, 141, 23, .22);
  border-radius: 16px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
  background: rgba(95, 141, 23, .06);
}
.review-nav {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.9);
  color: var(--text);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75), 0 8px 18px rgba(0,0,0,.08);
}
.review-nav:disabled,
.action-btn:disabled,
.panel-actions .secondary:disabled {
  opacity: .38;
  filter: grayscale(1);
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}
.review-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.review-meta strong {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.review-meta span {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.25;
}
.move.review-selected {
  box-shadow: inset 0 0 0 2px rgba(95, 141, 23, .44);
  background: rgba(95, 141, 23, .13);
}
body.dark .game-review-controls {
  background: rgba(95, 141, 23, .12);
  border-color: rgba(255,255,255,.09);
}
body.dark .review-nav {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.1);
}


/* undo-svg-v2: SVG de desfazer redesenhado e centralizado visualmente */
.icon-btn.undo-action {
  display: inline-grid !important;
  place-items: center !important;
  padding: 0 !important;
  line-height: 0 !important;
}
.icon-btn.undo-action .undo-icon {
  position: static !important;
  inset: auto !important;
  width: 100% !important;
  height: 100% !important;
  display: grid !important;
  place-items: center !important;
  transform: none !important;
  line-height: 0 !important;
}
.icon-btn.undo-action .undo-icon svg {
  width: 25px !important;
  height: 25px !important;
  display: block !important;
  transform: translateX(.5px) !important;
  overflow: visible;
}
@media (max-width: 520px) {
  .icon-btn.undo-action .undo-icon svg {
    width: 23px !important;
    height: 23px !important;
    transform: translateX(.5px) !important;
  }
}


/* human-review-mark-v5: melhor jogada em azul e jogada realizada no mesmo padrão, porém em vermelho */
.game-review-controls {
  margin-top: 10px;
  margin-bottom: 14px;
}
.board.lila-board .square.played-from,
.board.lila-board .square.played-to {
  box-shadow: none !important;
}
.board.lila-board .square.played-from::before {
  content: "" !important;
  position: absolute !important;
  inset: 0 !important;
  pointer-events: none !important;
  background: rgba(219, 48, 49, .35) !important;
  opacity: 1 !important;
  z-index: 1 !important;
}
.board.lila-board .square.played-to::before {
  content: "" !important;
  position: absolute !important;
  inset: 0 !important;
  pointer-events: none !important;
  background: radial-gradient(circle at center, rgba(219,48,49,.55) 0 34%, rgba(219,48,49,.18) 36% 100%) !important;
  opacity: 1 !important;
  z-index: 1 !important;
}
.board.lila-board .square.played-from::after,
.board.lila-board .square.played-to::after {
  content: none !important;
  display: none !important;
  background: none !important;
  box-shadow: none !important;
  border: none !important;
}

/* three-review-points-v1: resumo pós-partida e motivos reais dos erros */
.review-insights {
  margin-top: -4px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid rgba(95, 141, 23, .18);
  border-radius: 14px;
  background: rgba(95, 141, 23, .045);
  display: grid;
  gap: 8px;
}
.review-focus {
  display: grid;
  gap: 2px;
}
.review-focus span,
.review-moments strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.review-focus b {
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
}
.review-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.review-chips span {
  border: 1px solid rgba(95, 141, 23, .24);
  background: rgba(95, 141, 23, .08);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}
.review-moments {
  display: grid;
  gap: 6px;
}
.review-moment {
  width: 100%;
  border: 1px solid rgba(0,0,0,.07);
  background: rgba(255,255,255,.7);
  border-radius: 10px;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: auto minmax(0,1fr);
  gap: 8px;
  align-items: start;
  text-align: left;
  color: var(--text);
}
.review-moment b { font-size: 13px; white-space: nowrap; }
.review-moment span { font-size: 12px; color: var(--muted); line-height: 1.25; }
body.dark .review-insights { background: rgba(95, 141, 23, .10); border-color: rgba(255,255,255,.08); }
body.dark .review-moment { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.09); }

@media (display-mode: standalone) {
  body {
    overscroll-behavior: none;
  }
  .page {
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  }
}
