/* Ritstudion only (spel-rita.html).
   Split out of css/style.css so pages do not download rules they cannot use; tests/css-scope.test.js checks the scope. */

/* ===================== Ritstudion ===================== */
.rit-wrap { display: grid; gap: 8px; padding: 8px; background: linear-gradient(160deg, #fff3dc, #efe7ff); justify-content: center; align-content: center; justify-items: center; align-items: center;
  height: min(calc(100vh - 210px), 760px); min-height: 420px; aspect-ratio: auto; touch-action: none; }
.rit-wrap.tall { grid-template-columns: auto; grid-template-areas: "board" "tools" "pal"; }
.rit-wrap.wide { grid-template-columns: auto auto auto; grid-template-areas: "tools board pal"; }
.rit-board { grid-area: board; position: relative; width: 480px; height: 480px; border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 3px 0 rgba(31,35,72,.12), 0 0 0 3px #1f2348 inset; }
.rit-board canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.rit-board #ritLive { cursor: crosshair; }
.rit-board #ritLive.marker { opacity: .55; }
.rit-board.reveal { animation: ritReveal 1.3s ease-out; }
.rit-tip { position: absolute; left: 8px; right: 8px; bottom: 8px; margin: 0; padding: 6px 10px; border-radius: 12px; background: rgba(255,255,255,.94); box-shadow: 0 2px 8px rgba(31,35,72,.15); font-size: .92rem; pointer-events: none; text-align: center; }
.rit-tools { grid-area: tools; display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
.rit-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.rit-wrap.wide .rit-tools { max-height: 100%; }
.rit-wrap.wide .rit-row { display: grid; grid-template-columns: repeat(2, 46px); overflow: visible; }
.rit-wrap.tall .rit-tools { width: 100%; align-items: center; }
.rit-btn { position: relative; width: 46px; height: 46px; min-width: 46px; border-radius: 12px; border: 2px solid #e6dcc8; background: #fff; font-size: 1.35rem; display: grid; place-items: center; cursor: pointer; touch-action: manipulation; }
.rit-btn[aria-pressed="true"] { border-color: #1f2348; background: #ffe6b8; box-shadow: 0 2px 0 #1f2348; }
.rit-btn:disabled { opacity: .4; cursor: default; }
.rit-btn.size i { display: block; border-radius: 50%; background: #1f2348; }
.zz { position: absolute; right: -4px; top: -6px; width: 20px; height: 20px; border-radius: 50%; background: #1f2348; color: #fff; font-size: .75rem; display: grid; place-items: center; filter: none; opacity: 1; }
.rit-palette { grid-area: pal; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 4px 2px; max-width: 100%; }
.rit-wrap.wide .rit-palette { display: grid; grid-template-columns: repeat(3, 44px); overflow-y: auto; max-height: 100%; align-content: center; }
.rit-sw { position: relative; width: 44px; height: 44px; min-width: 44px; border-radius: 50%; border: 3px solid #fff; background: var(--c); box-shadow: 0 0 0 2px #1f2348; cursor: pointer; touch-action: manipulation; }
.rit-sw.asleep { opacity: 1; filter: none; background: repeating-linear-gradient(45deg, var(--c) 0 6px, #fff 6px 10px); }
.rit-sw.asleep .zz { right: -6px; top: -6px; }
.rit-sw[aria-pressed="true"] { box-shadow: 0 0 0 3px #1f2348, 0 0 0 6px #ffcf3a; transform: scale(1.06); }
.rit-sw.num { border-radius: 12px; width: 52px; min-width: 52px; }
.rit-sw.num b { display: inline-block; padding: 1px 5px; border-radius: 8px; background: rgba(255,255,255,.92); color: #1f2348; font-size: .95rem; font-weight: 900; }
.rit-wrap.wide .rit-palette:has(.num) { grid-template-columns: repeat(2, 52px); }
.rit-sw.rainbow { background: conic-gradient(#e8434f, #ffcf3a, #3cb55a, #2f7de1, #8a5cf0, #e8434f); }
.woke { animation: ritWake .9s ease-out; }
body.reduce-motion .woke, body.reduce-motion .rit-board.reveal { animation: none; }
.rit-sheet { z-index: 6; }
.rit-pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; margin: 10px 0; }
.rit-pic, .rit-gal { display: grid; gap: 4px; justify-items: center; padding: 6px; border: 2px solid #e6dcc8; border-radius: 14px; background: #fff; font-weight: 800; cursor: pointer; }
.rit-pic img, .rit-gal img { width: 100%; height: auto; aspect-ratio: 1; border-radius: 8px; }
.rit-pic .blank { width: 100%; aspect-ratio: 1; border-radius: 8px; border: 2px dashed #c9bda5; }
.rit-pic:focus-visible, .rit-pic:hover { border-color: #1f2348; }
.rit-gal .btn-row { gap: 4px; flex-wrap: nowrap; }
.rit-stickers { display: grid; grid-template-columns: repeat(4, 64px); gap: 8px; justify-content: center; margin: 10px 0; }
.rit-st { width: 64px; height: 64px; border-radius: 14px; border: 2px solid #e6dcc8; background: #fff; display: grid; place-items: center; cursor: pointer; }
.rit-st[aria-pressed="true"] { border-color: #1f2348; background: #ffe6b8; }
.rit-menu { display: grid; gap: 8px; margin: 10px 0; }
.rit-ask-head { display: flex; align-items: center; justify-content: center; gap: 10px; }
.rit-ask-head .big { font-size: 2rem; }
.rit-dot { width: 40px; height: 40px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px #1f2348; display: inline-block; }
.rit-q { font-size: 2rem; margin: 10px 0; }
.rit-choices { display: grid; grid-template-columns: repeat(4, minmax(56px, 1fr)); gap: 8px; }
.rit-choices .btn { font-size: 1.3rem; min-height: 52px; }
.rit-choices .btn.right { background: #b9f0d4; border-color: #2ec4a0; }
@media (max-width: 640px), (max-height: 500px) {
  body.game-play .rit-wrap { height: calc(100svh - 62px); min-height: 0; padding: 6px; gap: 6px; }
  .rit-wrap { height: auto; min-height: 0; }
  .rit-btn { width: 44px; height: 44px; min-width: 44px; font-size: 1.2rem; }
  .rit-wrap.wide .rit-row { grid-template-columns: repeat(2, 44px); gap: 4px; }
  .rit-wrap.wide .rit-palette { grid-template-columns: repeat(3, 44px); gap: 4px; }
  .rit-q { font-size: 1.6rem; }
  .rit-choices { grid-template-columns: repeat(2, 1fr); }
  .rit-stickers { grid-template-columns: repeat(4, 56px); }
  .rit-st { width: 56px; height: 56px; }
}
.game-shell.is-full > .rit-wrap { height: auto !important; }
