.mm-welcome {
  display:grid; grid-template-columns:.9fr 1.1fr; align-items:stretch;
  overflow:hidden; border:1px solid #b3bba9; border-radius:14px; background:#f5efdf;
}
.mm-welcome-copy {align-self:center; padding:clamp(25px,4.3vw,62px)}
.mm-welcome h1,.mm-title h1 {margin:10px 0 16px; font:400 clamp(3rem,5.7vw,5.6rem)/.99 var(--serif); letter-spacing:-.055em}
.mm-welcome h1 em,.mm-title h1 em {color:#a64729; font-weight:400}
.mm-welcome-copy>p {max-width:39ch; color:var(--muted); line-height:1.55}
.mm-cover {width:100%; height:100%; min-height:350px; max-height:540px; object-fit:cover; object-position:center}
.mm-entry-actions {display:flex; flex-wrap:wrap; align-items:center; gap:8px 16px; margin-top:18px}
#mm-entry-form {max-width:315px; margin-top:20px}
#mm-entry-form label,.mm-share-label {display:grid; gap:4px; color:var(--ink); font-size:.9rem; font-weight:650}
#mm-entry-form label+label {margin-top:10px}
#mm-entry-form input,#mm-invite {
  width:100%; min-width:0; padding:10px 12px; border:1px solid #9ca797; border-radius:6px;
  background:#fffdf6; color:var(--ink); font:inherit; font-weight:400;
}
#mm-entry-form input:focus-visible,#mm-invite:focus-visible,.mm-game summary:focus-visible {outline:3px solid #27777e; outline-offset:3px}
.mm-welcome .link-button,.mm-game .link-button {
  padding:5px 0; color:#7f3f2d; background:none; border:0; box-shadow:none; text-decoration:underline; text-underline-offset:3px;
}
.mm-game {
  display:grid; grid-template-columns:minmax(204px,.46fr) minmax(0,1fr); align-items:start;
  gap:clamp(20px,3.3vw,48px); max-width:1050px; margin-inline:auto;
}
.mm-side {min-width:0; padding-top:7px}
.mm-title h1 {margin:10px 0 23px; font-size:clamp(2.65rem,4.65vw,4.3rem)}
.mm-title h1 em {display:inline-block}
.mm-scores {display:grid; gap:7px}
.mm-score {
  display:flex; align-items:center; gap:10px; min-width:0; padding:9px 11px;
  border:1px solid #c7cbbb; border-radius:9px; background:#fffcf3;
}
.mm-score.mm-current {border-color:#43755f; box-shadow:inset 3px 0 #43755f}
.mm-score.mm-guest.mm-current {border-color:#a55b38; box-shadow:inset 3px 0 #a55b38}
.mm-initials {
  display:grid; place-items:center; flex:0 0 auto; width:32px; height:32px; border-radius:50%;
  background:#dce9d8; color:#244c3f; font-weight:700; font-size:.91rem;
}
.mm-guest .mm-initials {background:#f4debc; color:#784225}
.mm-score-name {display:grid; min-width:0; line-height:1.23}
.mm-score-name strong {overflow-wrap:anywhere; font-weight:650}
.mm-score-name small,.mm-points small {font-size:.74rem; color:var(--muted)}
.mm-points {display:flex; align-items:baseline; gap:3px; margin-left:auto; font-size:1.17rem; font-variant-numeric:tabular-nums; font-weight:650}
.mm-points small {font-weight:450}
.mm-reveals {display:grid; gap:5px; margin-top:14px}
.mm-reveals:empty,.mm-notice:empty,.mm-controls:empty {display:none}
.mm-dish {display:flex; align-items:center; gap:9px; line-height:1.35; min-width:0}
.mm-dish img {width:46px; height:46px; flex-shrink:0; object-fit:cover; border:1px solid #d9d3bc; border-radius:7px; background:#fff8e8}
.mm-dish span {display:grid; min-width:0; overflow-wrap:anywhere}
.mm-dish small {color:var(--muted)}
.mm-rules,.mm-manage {margin-top:14px; font-size:.91rem; color:var(--muted)}
.mm-rules summary,.mm-manage summary {cursor:pointer; color:var(--ink); font-weight:620; width:max-content}
.mm-rules p,.mm-confirm p {margin:6px 0}
.mm-controls {margin-top:14px}
#mm-invite {font-size:.84rem; margin:4px 0 6px}
.mm-manage .btn {display:block; font-size:.88rem}
.mm-confirm {padding:11px; background:#f6ecda; border:1px solid #d1bea1; border-radius:6px}
.mm-confirm .btn+.btn {margin-left:10px}
.mm-notice {margin:12px 0 0; font-size:.91rem; color:#833a25}
.mm-table {min-width:0; overflow:visible; padding:clamp(9px,1.3vw,18px); border:1px solid #b6bca5; border-radius:13px; background:#e9e8d8; box-shadow:0 3px 0 #a8ab932b}
.mm-board-head {display:flex; justify-content:space-between; align-items:center; gap:12px; min-height:29px; margin:0 2px 10px}
.mm-board-head .mm-turn {margin:0; min-width:0; overflow-wrap:anywhere; font:600 clamp(.95rem,1.55vw,1.2rem)/1.25 var(--sans)}
.mm-progress {flex:none; font-size:.83rem; font-weight:550; font-variant-numeric:tabular-nums; color:#53614d}
.mm-table.mm-waiting {padding:clamp(16px,2.8vw,32px)}
.mm-waiting .mm-board-head {margin:0 0 4px}
.mm-wait-instructions,.mm-practice-guide,.mm-practice-message {line-height:1.5; color:var(--muted)}
.mm-practice {border-top:1px solid #bcc2ad; margin-top:19px; padding-top:17px}
.mm-practice h3 {margin:0 0 4px; font:400 clamp(1.55rem,2.7vw,2rem)/1.1 var(--serif)}
.mm-practice-guide {margin:0 0 13px}
.mm-practice-message {margin:9px 0 0}
.mm-practice-message:empty {margin:0}
.mm-practice-grid {display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; max-width:395px}
.mm-practice-grid .mm-tile {aspect-ratio:1.25}
.mm-practice-grid .mm-front>span {display:block; font-size:clamp(.66rem,1.1vw,.8rem)}
.mm-practice [data-practice-again] {margin-top:12px}
.mm-grid {display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:clamp(4px,.62vw,9px)}
.mm-tile {
  display:block; position:relative; width:100%; min-width:0; aspect-ratio:1.13; padding:0; border:0;
  background:transparent; border-radius:7px; perspective:720px; touch-action:manipulation;
}
.mm-tile[aria-disabled=true] {cursor:default}
.mm-tile:focus-visible {z-index:1; outline:3px solid #bd4927; outline-offset:2px}
.mm-rotate {position:absolute; inset:0; transform-style:preserve-3d; transition:transform .38s cubic-bezier(.23,.7,.3,1); pointer-events:none}
.mm-up .mm-rotate {transform:rotateY(180deg)}
.mm-back,.mm-front {
  position:absolute; inset:0; overflow:hidden; border-radius:7px; backface-visibility:hidden;
  -webkit-backface-visibility:hidden; box-shadow:0 2px 2px #45483b2e;
}
.mm-back {
  display:grid; place-items:center; border:1px solid #1a453a; color:#fcf1ce; background-color:#2a594c;
  background-image:repeating-linear-gradient(45deg,transparent 0 8px,#efedc316 8px 9px,transparent 9px 16px),repeating-linear-gradient(-45deg,transparent 0 8px,#efedc316 8px 9px,transparent 9px 16px);
}
.mm-back::before {content:""; position:absolute; inset:3px; border:1px solid #d9dbb27a; border-radius:4px}
.mm-coord {position:absolute; top:5px; left:7px; font:600 clamp(.53rem,.75vw,.71rem)/1 var(--sans); letter-spacing:.015em}
.mm-stamp {
  display:grid; place-items:center; width:40%; aspect-ratio:1; border-radius:50%; color:#335747;
  background:#f3e4b9; outline:1px solid #e9d7a7; outline-offset:2px; transform:rotate(-8deg);
}
.mm-bowl {width:78%; height:78%}
.mm-pending .mm-back {
  background-color:#85572f; border-color:#674021; box-shadow:inset 0 0 0 2px #f8d496;
}
.mm-pending .mm-back::after {
  content:""; position:absolute; top:7%; right:7%; width:13%; aspect-ratio:1;
  border:2px solid #f8e0a770; border-top-color:#ffefbf; border-radius:50%;
  animation:mm-waiting .8s linear infinite;
}
@keyframes mm-waiting {to {transform:rotate(1turn)}}
@media(prefers-reduced-motion:reduce) {.mm-pending .mm-back::after {animation:none}}
@media(hover:hover) {
  .mm-tile[aria-disabled=false]:hover .mm-back {background-color:#386a59; box-shadow:0 2px 6px #394d385c}
}
.mm-front {display:flex; flex-direction:column; justify-content:center; background:#fff8e9; border:2px solid #b99b5e; transform:rotateY(180deg)}
.mm-front img {flex:1 1 0; min-height:0; width:100%; object-fit:contain; background:#fffaf1}
.mm-front>span {display:block; padding:1px 2px 2px; font-size:clamp(.57rem,.77vw,.74rem); font-weight:650; line-height:1.18; color:#463d2c; overflow-wrap:anywhere}
.mm-won .mm-front {border-color:#57856d}
.mm-won-guest .mm-front {border-color:#b7734c}
.mm-won .mm-front::after {content:"✓"; position:absolute; top:2px; right:2px; display:grid; place-items:center; width:15px; height:15px; border-radius:50%; color:#fff9ec; background:#37604d; font:700 10px/1 var(--sans)}
.mm-won-guest .mm-front::after {background:#96532e}
@media(max-width:750px) {
  .mm-welcome {grid-template-columns:1fr}
  .mm-welcome-copy {padding:22px 24px}
  .mm-cover {min-height:0; height:auto; max-height:280px; aspect-ratio:2; object-position:center 49%}
  .mm-game {grid-template-columns:1fr; grid-template-areas:"title" "scores" "controls" "notice" "table" "reveals" "rules"; gap:9px; max-width:595px}
  .mm-side {display:contents}
  .mm-title {grid-area:title}
  .mm-title h1 {margin:4px 0; font-size:clamp(2.1rem,7vw,3.25rem)}
  .mm-scores {grid-area:scores; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px}
  .mm-score {gap:7px; padding:6px 8px}
  .mm-table {grid-area:table; padding:7px}
  .mm-reveals {grid-area:reveals; grid-template-columns:repeat(2,minmax(0,1fr)); margin:0}
  .mm-rules {grid-area:rules; margin:0}
  .mm-controls {grid-area:controls; margin:0}
  .mm-notice {grid-area:notice; margin:0}
  .mm-game:has(.mm-manage):not(:has(#mm-invite)):not(:has([data-mm=rematch])) {grid-template-areas:"title" "scores" "notice" "table" "reveals" "rules" "controls"}
  .mm-manage {margin:0}
  .mm-board-head {min-height:24px; margin-bottom:6px}
  .mm-tile {aspect-ratio:1.04}
}
@media(max-width:460px) {
  .mm-game {gap:6px}
  .mm-score-name strong {font-size:.86rem}
  .mm-score-name small,.mm-points small {font-size:.66rem}
  .mm-initials {width:24px; height:24px; font-size:.72rem}
  .mm-points {font-size:1rem}
  .mm-table {padding:5px; border-radius:9px}
  .mm-board-head {gap:6px}
  .mm-progress {font-size:.72rem}
  .mm-grid {gap:4px}
  .mm-tile,.mm-back,.mm-front {border-radius:4px}
  .mm-back::before {inset:2px; border-radius:2px}
  .mm-coord {top:4px; left:5px; font-size:.48rem}
  .mm-stamp {width:37%; outline-offset:1px}
  .mm-front>span {display:none}
  .mm-front {border-width:1px}
  .mm-won .mm-front::after {width:11px; height:11px; font-size:8px}
}
@media(prefers-reduced-motion:reduce) {.mm-rotate {transition:none}}

.mm-deck-select {display:grid; gap:4px; color:var(--ink); font-size:.9rem; font-weight:650}
.mm-deck-select select, select.mm-deck-select {width:100%; min-height:40px; border:1px solid #9ca797; border-radius:6px; padding:7px 10px; color:var(--ink); background:#fffdf6; font:inherit}
.mm-deck-select:focus-visible,.mm-deck-select select:focus-visible {outline:3px solid #27777e; outline-offset:2px}
.mm-title:has(.mm-deck-name) h1 {margin-bottom:5px}
.mm-deck-name {display:block; margin-bottom:13px; font-size:.92rem; font-weight:600; color:var(--muted)}
.mm-controls .mm-deck-select {margin-bottom:10px}
.mm-review {padding:10px 12px; margin-bottom:10px; border:1px solid #b9ad89; border-radius:8px; background:#fff4d8; color:#493f2c}
.mm-review p {margin:0 0 6px}
.mm-review .btn {font-size:.9rem; padding:8px 12px}
button.mm-dish {width:100%; padding:5px 8px 5px 5px; font:inherit; text-align:left; background:#fffbef; color:var(--ink); border:1px solid #c2c4ad; border-radius:8px; cursor:zoom-in}
button.mm-dish:hover {border-color:#638473; background:#fffdf6}
button.mm-dish img {width:clamp(48px,4.7vw,65px); height:clamp(48px,4.7vw,65px)}
.mm-focus-label {font-weight:650; font-size:.78rem; color:#855031}
.mm-tile.mm-up[aria-disabled=false] {cursor:zoom-in}
.mm-front img {transform:scale(1.08)}
.mm-front>span {position:relative; background:#fff8e9}

#mm-focus {
  box-sizing:border-box; width:min(850px,calc(100vw - 28px)); max-width:none; max-height:calc(100dvh - 24px);
  padding:0; overscroll-behavior:contain; overflow-x:hidden; overflow-y:auto; border:1px solid #9da993; border-radius:14px; background:#fffaf0;
}
#mm-focus::backdrop {background:rgb(16 35 29 / 69%)}
.mm-focus-bar {display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px clamp(16px,2.6vw,26px); background:#254c40; color:#fff7df; font-weight:650}
#mm-focus-romaji-control {margin-left:auto; display:inline-flex; align-items:center; gap:6px; min-height:38px; cursor:pointer; font-size:.9rem}
#mm-focus-romaji-toggle {width:1rem; height:1rem; margin:0; accent-color:#e4b877}
#mm-focus-romaji-toggle:focus-visible {outline:2px solid #fff7df; outline-offset:3px}
#mm-focus-close {display:inline-flex; align-items:center; gap:9px; min-height:38px; border:1px solid #a2b6a3; border-radius:6px; padding:3px 9px; color:inherit; background:transparent; font:inherit; font-size:.9rem}
#mm-focus-close span {font-size:1.45rem; line-height:1}
.mm-focus-layout {display:grid; grid-template-columns:minmax(0,1.15fr) minmax(0,.95fr); align-items:center}
.mm-focus-stage {margin:0; background:#fffbf2; display:grid; place-items:center; align-self:stretch; overflow:hidden}
#mm-focus-image {display:block; width:100%; height:auto; max-height:min(63dvh,480px); object-fit:contain}
.mm-focus-copy {padding:clamp(17px,3vw,32px); min-width:0; overflow-wrap:anywhere}
#mm-focus-origin {margin:0 0 5px; color:#795033; font-weight:650; font-size:.85rem; letter-spacing:.07em}
#mm-focus-name {font:650 clamp(1.7rem,3.3vw,2.4rem)/1.24 var(--sans); letter-spacing:-.04em; margin:0; color:var(--ink)}
#mm-focus-native {font-family:var(--serif); font-size:1.3rem; color:var(--muted); margin:5px 0 0; line-height:1.2}
.mm-focus-talk {margin-top:20px; padding-top:15px; border-top:1px solid #c9cab5}
#mm-focus-topic {margin:0 0 5px; font-weight:650; font-size:.88rem; color:#774a31}
#mm-focus-question {font:550 clamp(1rem,1.8vw,1.17rem)/1.65 var(--sans); margin:0}
.mm-focus-copy .mm-reading {margin:4px 0 0; color:#526454; font:500 .93rem/1.45 var(--sans)}
#mm-focus-starter-romaji {margin-bottom:5px}
#mm-focus-hints {margin-top:12px; font-size:.9rem; padding:7px 10px; border:1px solid #c8cebb; background:#eff2e6; border-radius:7px}
#mm-focus-hints summary {cursor:pointer; font-weight:600}
#mm-focus-starter {margin:8px 0 2px; font-size:1rem}
#mm-focus-gloss {display:block; line-height:1.35; color:var(--muted)}
#mm-focus-nav {display:flex; align-items:center; justify-content:space-between; gap:6px; padding:8px clamp(12px,2.5vw,24px); border-top:1px solid #d4d3bf}
#mm-focus-nav button {min-height:38px; padding:4px 8px; color:#2c5948; background:transparent; border:1px solid #9eae99; border-radius:6px; font-weight:650}
#mm-focus-nav button:disabled {opacity:.4}
#mm-focus-position {font-size:.84rem; color:var(--muted); font-variant-numeric:tabular-nums}
@media(max-width:600px) {
  .mm-deck-name {margin-bottom:3px}
  .mm-focus-layout {grid-template-columns:1fr}
  #mm-focus-image {max-height:min(37dvh,320px)}
  .mm-focus-copy {padding:14px 18px 17px}
  .mm-focus-talk {margin-top:10px; padding-top:9px}
  #mm-focus-nav button {font-size:.86rem}
  button.mm-dish {flex-wrap:wrap; gap:5px}
}
@media(max-height:510px) and (min-aspect-ratio:4/3) {
  .mm-focus-layout {grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr)}
  #mm-focus-image {max-height:62dvh}
  .mm-focus-copy {padding:10px 15px}
  .mm-focus-talk {margin-top:8px; padding-top:8px}
}
