/* The painted pieces (assets/art/). Every rule here only adds an image on top of the colours and shapes of game.css, desk.css and title.css,
   so a piece that fails to load leaves the plain look in place. Pieces are used at 1.0x or smaller (see scripts/sudoku-kakuro-cut-art.py):
   textures repeat at their own size, buttons and badges are scaled down.
   Still drawn by CSS and type (no painted piece): the top bar, the Copy code, Load, Play today and dialog buttons, the title menu buttons,
   the status pills, the segmented tab holder, the dialogs, the stitched edge of the pause cover and every drop shadow. */
:root{
  --art-title:url("./assets/art/title-plate.webp");
  --paper-ivory:url("./assets/art/paper-ivory-tile.webp");
  --paper-cool:url("./assets/art/paper-cool-tile.webp");
  --key:64px;
}
body{--peer-a:rgba(112,160,230,.30);--same-a:rgba(60,110,210,.30);--sel-a:rgba(247,201,100,.96);--shell-tint:rgba(10,14,40,.34);--kk-lift:rgba(255,252,246,.58)}
body[data-theme="paper"]{--peer-a:rgba(190,140,90,.32);--same-a:rgba(150,100,60,.30);--shell-tint:rgba(78,44,30,.58);--kk-lift:rgba(255,238,204,.58)}
body[data-theme="ocean"]{--peer-a:rgba(60,170,190,.30);--same-a:rgba(30,130,160,.32);--shell-tint:rgba(8,70,84,.52);--kk-lift:rgba(226,250,247,.58)}

/* ---- title screen: the plate sits behind a dark layer and a blur so it reads as atmosphere, never as a board ---- */
.title-art{inset:-14px;filter:blur(3px) saturate(.9);opacity:1}
.title-art::after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,rgba(5,8,20,.8),rgba(5,8,20,.9))}

/* ---- the desk and the cards ---- */
.game-shell{background-color:#10152f;background-image:linear-gradient(var(--shell-tint),var(--shell-tint)),url("./assets/art/desk-leather-tile.webp");background-size:auto,308px 308px;background-repeat:no-repeat,repeat}
.panel-card{position:relative;isolation:isolate;border:14px solid transparent;border-image:url("./assets/art/card-frame.webp") 30 fill/14px stretch;background:none;padding:6px 8px;box-shadow:none;filter:drop-shadow(0 12px 18px rgba(0,0,0,.28))}
.panel-card::before{content:"";position:absolute;inset:0;z-index:-1;background:rgba(7,10,30,.42)}

/* ---- the boards: paper under the Sudoku cells and the Kakuro white cells, ink slate under the clue squares ---- */
.sudoku-board{background-color:var(--cell);background-image:var(--paper-ivory);background-size:630px 546px;background-blend-mode:multiply}
.sudoku-cell{background-color:transparent}
.kakuro-board{background-color:#e4e1da;background-image:linear-gradient(var(--kk-lift),var(--kk-lift)),var(--paper-cool);background-size:auto,630px 546px;background-repeat:no-repeat}
.kakuro-cell{background-color:transparent}
.kakuro-clue{background-color:#111624;background-image:linear-gradient(rgba(10,13,24,.68),rgba(10,13,24,.68)),url("./assets/art/slate-tile.webp");background-size:auto,270px 236px}
.peer,.run-peer{background-color:var(--peer-a)}
.same{background-color:var(--same-a)}
.selected{background-color:var(--sel-a)!important}
.kakuro-cell.wrong{background-color:rgba(255,200,210,.7)}

/* ---- the pause cover is the folder: leather, with its brass clasp ---- */
.pause-cover{background-color:#2a1d1a;background-image:linear-gradient(rgba(10,6,6,.3),rgba(10,6,6,.3)),url("./assets/art/folder-leather-tile.webp");background-size:auto,618px 558px;backdrop-filter:none;outline:2px dashed rgba(206,168,110,.5);outline-offset:-12px}
.pause-cover::after{content:"";position:absolute;right:0;top:34%;width:69px;height:85px;background:url("./assets/art/folder-clasp.webp") right center/69px 85px no-repeat;pointer-events:none}
.pause-cover{padding-right:58px}
.pause-cover span{text-shadow:0 1px 2px rgba(0,0,0,.6)}

/* ---- keys ---- */
.number-pad{grid-template-columns:repeat(3,var(--key));justify-content:center;gap:8px}
.number-pad button{width:var(--key);height:var(--key);min-height:0;border:0;border-radius:0;background:transparent url("./assets/art/key-up.webp") center/100% 100% no-repeat;color:#3a2a14;font-size:1.45rem;text-shadow:0 1px 0 rgba(255,255,255,.35);filter:drop-shadow(0 3px 3px rgba(0,0,0,.45))}
.number-pad button:hover,.number-pad button:focus-visible{border:0;background:transparent url("./assets/art/key-up.webp") center/100% 100% no-repeat;filter:brightness(1.08) drop-shadow(0 3px 3px rgba(0,0,0,.45))}
.number-pad button:active{border:0;background:transparent url("./assets/art/key-down.webp") center/100% 100% no-repeat;transform:none;filter:drop-shadow(0 1px 1px rgba(0,0,0,.45));padding-top:3px}

/* ---- tools: each button is one engraved tile, its caption stays live text ---- */
.tool-row button{background:transparent;border:0;border-radius:0;padding:2px 0;min-height:0}
.tool-row span{width:48px;height:48px;margin:0 auto;font-size:0;color:transparent;background:center/100% 100% no-repeat;filter:drop-shadow(0 3px 3px rgba(0,0,0,.45))}
#undoButton span{background-image:url("./assets/art/icon-undo.webp")}
#redoButton span{background-image:url("./assets/art/icon-redo.webp")}
#eraseButton span{background-image:url("./assets/art/icon-erase.webp")}
#notesButton span{background-image:url("./assets/art/icon-notes.webp")}
#hintButton span{background-image:url("./assets/art/icon-hint.webp")}
#checkButton span{background-image:url("./assets/art/icon-check.webp")}
#pauseButton span{background-image:url("./assets/art/icon-pause.webp")}
#zoomButton span{display:grid;place-items:center;background-image:url("./assets/art/key-up.webp");font-size:1.7rem;font-weight:850;line-height:1;color:#3a2a14;text-shadow:0 1px 0 rgba(255,255,255,.35)}
.tool-row button:hover span{filter:brightness(1.08) drop-shadow(0 3px 3px rgba(0,0,0,.45))}
.tool-row button[aria-pressed="true"]{background:transparent;border:0}
.tool-row button[aria-pressed="true"] span{filter:brightness(1.12) drop-shadow(0 0 7px rgba(243,200,107,.95))}
.tool-row small{margin-top:4px}

/* ---- level chips, puzzle tabs and the two start buttons: one pill plate, a lit one for the chosen state ---- */
.difficulty-row button,.mode-tab,.mode-row .daily-button{border:0;border-radius:0;background:transparent url("./assets/art/pill.webp") center/100% 100% no-repeat;color:#3a2a14;font-weight:850;filter:drop-shadow(0 2px 3px rgba(0,0,0,.4))}
.difficulty-row button.is-active,.mode-tab.is-active{background:transparent url("./assets/art/pill-on.webp") center/100% 100% no-repeat;color:#2b1c06;box-shadow:none}
.difficulty-row button.is-locked{border:0;opacity:.6;filter:grayscale(.4) drop-shadow(0 2px 3px rgba(0,0,0,.4))}
.difficulty-row button{min-width:84px}
.segmented{background:rgba(0,0,0,.28)}

/* ---- badges and the streak flame ---- */
.badge-mark{width:36px;height:36px;border-radius:0;background:none;display:block}
.mastery-badge{grid-template-columns:36px 1fr}
.badge-mark img{display:block;width:36px;height:36px;filter:drop-shadow(0 2px 2px rgba(0,0,0,.4))}
.badge-mark:has(img){font-size:0;color:transparent}
.mastery-badge:not(.is-unlocked) .badge-mark img{filter:grayscale(1) brightness(.62) drop-shadow(0 2px 2px rgba(0,0,0,.4))}
.mastery-badge.is-unlocked .badge-mark{background:none}
.stat-grid div{position:relative}
.stat-grid .flame{position:absolute;left:7px;top:6px;width:20px;height:30px;margin:0;pointer-events:none}

@media(max-width:760px){:root{--key:54px}.number-pad{grid-template-columns:repeat(5,var(--key));gap:6px}.difficulty-row button{min-width:0}}
@media(orientation:landscape) and (max-height:540px){
  :root{--key:50px}
  .number-pad{grid-template-columns:repeat(3,var(--key));gap:5px}
  .tool-row span{width:40px;height:40px}.tool-row small{margin-top:1px}
}
/* Kakuro shows seven tools in one row: on a 360 px phone seven fixed 48 px icons plus the gaps are wider than the screen, so the icons shrink with their cell. */
@media(max-width:640px){
  .tool-row[data-tools="7"]{grid-template-columns:repeat(7,minmax(0,1fr))}
  .tool-row[data-tools="7"] span{width:min(48px,100%);height:auto;aspect-ratio:1/1}
}
