:root {
  color-scheme: light;
  --paper: #f7f5ed;
  --ink: #272520;
  --muted: #59564d;
  --accent: #be3f2b;
  --line: #d9d6cb;
  --outline: #aaa69a;
  --tile: #fffef9;
  --tile-hover: #fff0db;
  --locked: #fff2de;
  --lock-border: #be563a;
  --copy-hover: #413d35;
  --focus: #245fbf;
  --cols: 10;
  font-family: "Helvetica Neue",Arial,sans-serif;
  color: var(--ink);
  background: var(--paper);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #191917;
  --ink: #f5f0e5;
  --muted: #bcb7ac;
  --accent: #ff9479;
  --line: #45423b;
  --outline: #696459;
  --tile: #272623;
  --tile-hover: #39342d;
  --locked: #403029;
  --lock-border: #eb9272;
  --copy-hover: #d8cfbf;
  --focus: #96bbff;
}
*{box-sizing:border-box}
body{margin:0}
main{min-height:650px;height:100vh;height:100dvh;display:grid;grid-template-rows:auto minmax(0,1fr) auto auto;gap:18px;padding:clamp(16px,2.6vh,30px) clamp(16px,3.2vw,60px)}
header,footer,.wordmark,.action,.info{display:flex;align-items:center}
header,footer{justify-content:space-between;gap:14px}
.wordmark{gap:14px}
.wordmark img{width:clamp(33px,4vw,48px);height:auto}
h1{font-size:clamp(2.25rem,4.6vw,4.5rem);letter-spacing:-.072em;line-height:1.05;margin:0;font-weight:750}
h1 em{font-family:Georgia,serif;font-weight:500;color:var(--accent);letter-spacing:-.072em}
header p{font-size:1rem;line-height:1.4;color:var(--muted);margin:6px 0 0}
button{cursor:pointer;color:inherit;font:inherit;-webkit-tap-highlight-color:transparent}
.action{justify-content:center;gap:9px;border:1.5px solid var(--ink);border-radius:8px;padding:12px 19px;min-height:44px;font-weight:650;white-space:nowrap}
.action svg{width:19px;height:19px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
#shuffle{color:#272520;background:#ee593e;box-shadow:2px 3px 0 var(--ink)}
#shuffle:active{transform:translate(2px,3px);box-shadow:none}
#board{border:1px solid var(--outline);border-radius:12px;overflow:hidden;display:grid;grid-template-columns:repeat(var(--cols),minmax(0,1fr));grid-auto-rows:1fr;gap:1px;background:var(--line);container-type:size}
.tile{display:grid;place-items:center;padding:0;border:0;border-radius:0;min-height:0;min-width:0;background:var(--tile);line-height:1;font-family:"Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif;font-size:clamp(1.8rem,min(6.1cqw,11.4cqh),6.25rem)}
.tile span{display:block;pointer-events:none}
.tile.locked{position:relative;background:var(--locked);box-shadow:inset 0 0 0 2px var(--lock-border)}
.tile.locked::after{content:"";position:absolute;top:4px;right:4px;width:18px;height:18px;border-radius:4px;background:#fff2de url("lock.svg") center/14px no-repeat;pointer-events:none}
@media(hover:hover){.tile:hover{background:var(--tile-hover)}.tile:hover span{transform:scale(1.07)}#copy:hover{background:var(--copy-hover)}#shuffle:hover{background:#ff6c50}}
button:focus-visible{outline:3px solid var(--focus);outline-offset:3px}
.tile:focus-visible{outline-offset:-4px;z-index:1}
.info{gap:10px;font:0.875rem ui-monospace,Menlo,monospace}
.info svg{width:15px;height:15px;color:var(--accent)}
.info strong{font-weight:600}
.separator{background:var(--outline);width:1px;height:17px;margin:0 3px}
#dimensions{color:var(--muted)}
#copy{color:var(--paper);background:var(--ink);min-width:138px}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
dialog{width:min(440px,90vw);background:var(--paper);color:var(--ink);border-radius:12px;border:1px solid;padding:20px}
textarea{display:block;width:100%;height:100px;margin:14px 0;font-size:1.1rem}
@media(max-width:760px){:root{--cols:6}main{height:auto;min-height:100dvh;grid-template-rows:auto 1fr auto auto;padding:18px 14px;gap:14px}#board{container-type:normal;grid-auto-rows:minmax(58px,1fr)}.tile{font-size:clamp(32px,8vw,64px)}h1{font-size:clamp(2rem,6.2vw,3rem)}.wordmark{gap:9px}.wordmark img{width:30px}.action{padding:10px 12px}header p{font-size:.9rem}#copy{min-width:115px}.info{gap:7px}}
@media(max-width:480px){:root{--cols:5}.tile{font-size:clamp(32px,10vw,46px)}.action{font-size:.9rem}.info{font-size:.8rem}}
@media(min-width:761px) and (max-height:680px){main{min-height:510px;gap:12px;padding-top:14px;padding-bottom:14px}h1{font-size:2.5rem}}

#emoji-text{margin:0;font-size:1rem;line-height:1.6;overflow-wrap:anywhere}
.footer-actions{display:flex;align-items:center;gap:12px}
#theme{width:44px;height:44px;padding:0;background:var(--tile);border-color:var(--outline)}
#theme:hover{background:var(--tile-hover)}
#theme .sun,:root[data-theme="dark"] #theme .moon{display:none}
:root[data-theme="dark"] #theme .sun{display:block}
@media(max-width:560px){footer{flex-wrap:wrap}.footer-actions{flex:1;justify-content:flex-end;gap:8px}}
