:root { --bg:#f5eee0; --paper:#fffaf0; --ink:#2a2118; --muted:#7d6f5e; --line:#d9ccb4; --accent:#7c3aed; --ok:#7c3aed; --mid:#f59e0b; --no:#a8998a; color-scheme:light; }
* { box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
body { margin:0; background:var(--bg); color:var(--ink); font-family:Georgia,"Palatino Linotype","Book Antiqua",serif; }
main { max-width:520px; margin:0 auto; padding:8px; display:flex; flex-direction:column; align-items:center; gap:10px; min-height:100dvh; }
header { width:100%; display:flex; align-items:center; justify-content:space-between; }
header h1 { margin:0; font-size:1.25rem; font-style:italic; letter-spacing:.02em; }
.home { color:var(--accent); text-decoration:none; font-size:.9rem; font-family:system-ui,sans-serif; }
button { font:inherit; color:inherit; background:var(--paper); border:1px solid var(--line); border-radius:999px; padding:5px 14px; cursor:pointer; }
button.on, button:hover { border-color:var(--accent); color:var(--accent); }
.bar { display:flex; gap:8px; font-family:system-ui,sans-serif; font-size:.9rem; }
#toast { position:fixed; top:64px; left:50%; transform:translateX(-50%); background:var(--ink); color:var(--paper); font-weight:700; padding:8px 16px; border-radius:999px; opacity:0; pointer-events:none; transition:opacity .15s; z-index:5; }
#toast.show { opacity:1; }
#grid { --t:min(60px, calc((100vw - 60px) / 5), calc((100dvh - 330px) / 6)); display:grid; gap:8px; }
.row { display:grid; grid-template-columns:repeat(5, var(--t)); gap:8px; }
/* tiles are rounded "stones": a state is a fill (violet), a ring (amber) or a faded stone (absent) */
.tile { width:var(--t); height:var(--t); display:flex; align-items:center; justify-content:center; border:2px solid var(--line); border-radius:32%; background:var(--paper); font:700 calc(var(--t) * .52)/1 Georgia,serif; text-transform:uppercase; }
.tile.filled { border-color:var(--ink); animation:pop .1s; }
.tile.correct { background:var(--ok); border-color:var(--ok); color:#fff; }
.tile.present { background:var(--paper); border:4px solid var(--mid); color:#b45309; }
.tile.absent { background:var(--no); border-color:var(--no); color:#f5eee0; opacity:.85; }
.tile.reveal { animation:reveal .55s cubic-bezier(.3,1.4,.5,1) both; }
.row.shake { animation:shake .4s; }
.row.bounce .tile { animation:hop .6s both; }
.row.bounce .tile:nth-child(2) { animation-delay:.08s } .row.bounce .tile:nth-child(3) { animation-delay:.16s } .row.bounce .tile:nth-child(4) { animation-delay:.24s } .row.bounce .tile:nth-child(5) { animation-delay:.32s }
@keyframes pop { 50% { transform:scale(1.08) } }
@keyframes reveal { 0% { transform:scale(.55) rotate(-10deg); opacity:.3 } 60% { transform:scale(1.12) rotate(2deg); opacity:1 } 100% { transform:none } }
@keyframes shake { 20%,60% { transform:translateX(-6px) } 40%,80% { transform:translateX(6px) } }
@keyframes hop { 40% { transform:translateY(-14px) rotate(-4deg) } }
#again { font-family:system-ui,sans-serif; }
#kb { width:100%; display:flex; flex-direction:column; gap:7px; margin-top:auto; padding-bottom:8px; }
.krow { display:flex; justify-content:center; gap:5px; }
.krow button { flex:1 1 0; max-width:44px; height:50px; padding:0; font:700 1rem Georgia,serif; text-transform:uppercase; background:var(--paper); border:1px solid var(--line); border-bottom-width:3px; border-radius:10px; color:var(--ink); }
.krow button.wide { flex:1.6 1 0; max-width:68px; font:600 .72rem system-ui,sans-serif; }
.krow button.correct { background:var(--ok); border-color:var(--ok); color:#fff; } .krow button.present { border:3px solid var(--mid); color:#b45309; } .krow button.absent { background:var(--no); border-color:var(--no); color:#f5eee0; opacity:.6; }
#modal { position:fixed; inset:0; background:rgba(42,33,24,.55); display:flex; align-items:center; justify-content:center; padding:16px; z-index:10; }
#modal[hidden] { display:none; }
.card { background:var(--paper); border:1px solid var(--line); border-radius:20px; padding:18px; width:min(380px, 100%); position:relative; text-align:center; }
.card h2 { margin:0 0 6px; font-style:italic; }
#close { position:absolute; top:8px; right:8px; border:0; background:none; }
.nums { display:flex; justify-content:space-around; margin:10px 0; }
.nums b { display:block; font-size:1.6rem; } .nums span { font:.75rem system-ui,sans-serif; color:var(--muted); }
#dist { text-align:left; display:flex; flex-direction:column; gap:3px; margin:8px 0; }
.drow { display:flex; align-items:center; gap:6px; } .drow span { width:1ch; }
.drow .bar { background:var(--ok); color:#fff; padding:1px 6px; text-align:right; font-size:.85rem; min-width:24px; border-radius:6px; display:block; }
.muted { color:var(--muted); font:.8rem system-ui,sans-serif; }
#share { background:var(--ok); border:0; color:#fff; font-weight:700; padding:8px 22px; }
@media (prefers-reduced-motion: reduce) { .tile, .row { animation:none !important; } }

/* The playable grid follows the warm tabletop and familiar green/yellow tiles in its artwork. */
body { background:#f2e7d3; }
main { max-width:550px; }
#grid { gap:6px; padding:9px; border:1px solid #dccbb0; border-radius:18px; background:#eadcc3; box-shadow:0 16px 38px rgba(89,62,30,.16); }
.row { gap:6px; }
.tile { border-radius:7px; border-color:#d4c4a8; background:#fffaf0; color:#2a2118; font-family:system-ui,sans-serif; box-shadow:0 3px 0 #c9b89e; }
.tile.filled { border-color:#a18a68; }
.tile.correct { background:#5b9b67; border-color:#438651; color:#fff; box-shadow:0 3px 0 #367243; }
.tile.present { background:#eac34f; border:2px solid #c9a237; color:#2d281a; box-shadow:0 3px 0 #b99532; }
.tile.absent { background:#b6aa97; border-color:#9d907d; color:#fff; opacity:1; box-shadow:0 3px 0 #8a7e6d; }
.krow button { background:#fff9ee; border-color:#d2c0a3; box-shadow:0 2px 0 #bca783; }
.krow button.correct { background:#5b9b67; border-color:#438651; }
.krow button.present { background:#eac34f; border:1px solid #c9a237; color:#2d281a; }
html[data-portal-theme="dark"] body.game-page .portal-crumbs { color:#5e5549; }
html[data-portal-theme="dark"] body.game-page .portal-crumbs a { color:#126b7f; }
