body[data-skin="cafe"] {
  --cafe-bg: #101b1c;
  --cafe-sky: #162d3b;
  --cafe-ink: #fff6df;
  --cafe-muted: #d7c8aa;
  --cafe-wood: #7b401c;
  --cafe-wood-hi: #bd7133;
  --cafe-gold: #ffc85a;
  --cafe-green: #1f6b54;
  --cafe-panel: rgba(28, 39, 37, .96);
  --cafe-line: rgba(255, 221, 157, .25);
  --game-sheet-bg: #172b2a;
  --game-sheet-ink: #fff9e8;
  --game-row-bg: #243b39;
  --game-row-ink: #fffaf0;
  --game-muted-bg: #304946;
  --game-muted-ink: #fff8e8;
  min-height: 100dvh;
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
  color: var(--cafe-ink);
  background: var(--cafe-bg) radial-gradient(circle at 50% -10%, #315b66 0, transparent 38%) fixed;
  overscroll-behavior-y: none;
}
body[data-skin="cafe"][data-look="day"] {
  --cafe-bg: #e7c998;
  --cafe-sky: #87c9d8;
  --cafe-ink: #34200f;
  --cafe-muted: #6d5136;
  --cafe-panel: rgba(255, 247, 226, .96);
  --cafe-line: rgba(87, 49, 19, .23);
  --game-sheet-bg: #fffaf0;
  --game-sheet-ink: #2c2118;
  --game-row-bg: #f7eee1;
  --game-row-ink: #30251d;
  --game-muted-bg: #e7ded0;
  --game-muted-ink: #493b30;
  background: #e7c998 linear-gradient(#87c9d8 0 21rem, #e7c998 38rem) fixed;
}
body[data-skin="cafe"] .skin-button { display: none !important; }
body[data-skin="cafe"] .topbar {
  z-index: 80;
  min-height: calc(62px + env(safe-area-inset-top));
  padding-block-start: env(safe-area-inset-top);
  border-bottom: 1px solid var(--cafe-line);
  background: color-mix(in srgb, var(--cafe-panel) 94%, transparent);
  box-shadow: 0 5px 18px rgba(0, 0, 0, .2);
}
/* Lobby controls stay below the phone cutout, and the fixed social buttons get
   their own scrollable lane below the final setting instead of covering it. */
body[data-skin="cafe"]:has(.game-lobby) .topbar {
  min-height: calc(62px + env(safe-area-inset-top));
  padding-block-start: max(env(safe-area-inset-top), 0px);
}
body[data-skin="cafe"]:has(.game-lobby) #app {
  padding-bottom: calc(156px + env(safe-area-inset-bottom));
}
body[data-skin="cafe"]:has(.game-lobby) .game-lobby {
  scroll-margin-top: calc(68px + env(safe-area-inset-top));
}
body[data-skin="cafe"] .brand { color: var(--cafe-gold); text-shadow: 0 2px 0 #51280e; }
body[data-skin="cafe"] .icon-button,
body[data-skin="cafe"] .lang-button { min-width: 44px; min-height: 44px; border: 1px solid var(--cafe-line); background: var(--cafe-panel); color: var(--cafe-ink); }
body[data-skin="cafe"] #app { width: min(100%, 760px); margin-inline: auto; padding-inline: max(12px, env(safe-area-inset-left)); }
body[data-skin="cafe"] .panel {
  border: 1px solid var(--cafe-line);
  border-radius: 24px;
  background: var(--cafe-panel);
  color: var(--cafe-ink);
  box-shadow: 0 9px 0 rgba(47, 24, 10, .28), 0 18px 30px rgba(0, 0, 0, .16);
}
body[data-skin="cafe"] .muted,
body[data-skin="cafe"] .field-note,
body[data-skin="cafe"] .guide-line { color: var(--cafe-muted); }
body[data-skin="cafe"] button,
body[data-skin="cafe"] input,
body[data-skin="cafe"] select,
body[data-skin="cafe"] textarea { font-size: max(16px, 1rem); }
body[data-skin="cafe"] button:focus-visible,
body[data-skin="cafe"] a:focus-visible,
body[data-skin="cafe"] input:focus-visible,
body[data-skin="cafe"] summary:focus-visible { outline: 3px solid var(--cafe-gold); outline-offset: 3px; }
body[data-skin="cafe"] .btn,
body[data-skin="cafe"] .soft-btn,
body[data-skin="cafe"] .game-tile {
  border-color: #5b2e13;
  background: linear-gradient(#9c5522, #7a3a17);
  color: #fff8e8;
  box-shadow: 0 5px 0 #51270f, 0 8px 14px rgba(0, 0, 0, .22);
}
body[data-skin="cafe"] .btn:active,
body[data-skin="cafe"] .soft-btn:active,
body[data-skin="cafe"] .game-tile:active { transform: translateY(3px); box-shadow: 0 2px 0 #51270f; }
body[data-skin="cafe"] .home-panel { overflow: hidden; background: transparent; border: 0; box-shadow: none; }
body[data-skin="cafe"] .cafe-hero {
  position: relative;
  min-height: clamp(220px, 56vw, 360px);
  margin: -16px -16px 18px;
  border-radius: 0 0 30px 30px;
  background: center bottom / cover no-repeat url("art/cafe/hero-night.webp");
  box-shadow: inset 0 -80px 70px rgba(12, 8, 3, .72), 0 8px 0 #603516;
}
body[data-skin="cafe"][data-look="day"] .cafe-hero { background-image: url("art/cafe/hero-day.webp"); }
body[data-skin="cafe"] .cafe-sign { position: absolute; inset: 18px 50% auto auto; translate: 50% 0; min-width: 170px; padding: 12px 24px; border: 4px solid #5b2b12; border-radius: 12px; background: #a85b27; color: #ffe59e; font-size: 1.7rem; font-weight: 900; box-shadow: 0 6px 0 #3b1c0c; rotate: -2deg; }
body[data-skin="cafe"] .cafe-hero-copy { position: absolute; inset: auto 18px 16px; text-align: center; color: #fff8e8; text-shadow: 0 2px 3px #000; }
body[data-skin="cafe"] .home-panel > .hero-mark,
body[data-skin="cafe"] .home-panel > h1,
body[data-skin="cafe"] .home-panel > h1 + .muted { display: none; }
body[data-skin="cafe"] .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
body[data-skin="cafe"] .game-card { min-height: 168px; padding: 0; overflow: hidden; text-align: start; }
body[data-skin="cafe"] .game-card .gc-art { min-height: 108px; background: center / cover no-repeat var(--cafe-art, var(--img)); }
body[data-skin="cafe"] .game-card .gc-label { display: grid; padding: 9px 11px 12px; }
body[data-skin="cafe"] .game-card .gc-label small { color: #ffe9c2; }
body[data-skin="cafe"] .game-card[data-m="domino"] { --cafe-art: url("art/cafe/game-domino.webp"); }
body[data-skin="cafe"] .game-card[data-m="ten"] { --cafe-art: url("art/cafe/game-ten.webp?v=2"); }
body[data-skin="cafe"] .game-card[data-m="quiz"] { --cafe-art: url("art/cafe/game-quiz.webp"); }
body[data-skin="cafe"] .game-card[data-m="ff"] { --cafe-art: url("art/cafe/game-ff.webp"); }
body[data-skin="cafe"] .game-card[data-m="gold"] { --cafe-art: url("art/cafe/game-gold.webp"); }
body[data-skin="cafe"] .game-card[data-m="sheep"] { --cafe-art: url("art/cafe/game-sheep.webp"); }
body[data-skin="cafe"] .game-card[data-m="tiles"] { --cafe-art: url("art/cafe/game-tiles.webp?v=2"); }
body[data-skin="cafe"] .game-card[data-m="classic"] { --cafe-art: url("art/cafe/game-classic.webp"); }
body[data-skin="cafe"] .game-card[data-m="quick"] { --cafe-art: url("art/cafe/game-quick.webp"); }
body[data-skin="cafe"] .cafe-hub-hero { min-height: 190px; margin: -16px -16px 16px; border-radius: 24px 24px 18px 18px; background: center / cover no-repeat var(--cafe-art); }
body[data-skin="cafe"] .cafe-hub-actions { display: grid; gap: 12px; }
body[data-skin="cafe"] .cafe-live { display: inline-flex; gap: 7px; padding: 6px 10px; border-radius: 999px; background: rgba(24, 116, 82, .2); color: var(--cafe-ink); }
body[data-skin="cafe"] #setEditInner > label:first-child,
body[data-skin="cafe"] #setEditInner > #typeTabs,
body[data-skin="cafe"] #setBox > label:first-child,
body[data-skin="cafe"] #setBox > #typeTabs { display: none; }
body[data-skin="cafe"] .lobby-grid,
body[data-skin="cafe"] .players,
body[data-skin="cafe"] .pboxes { gap: 10px; }
body[data-skin="cafe"] .lobby-player,
body[data-skin="cafe"] .pbox,
body[data-skin="cafe"] .seat { border: 2px solid var(--cafe-line); background: linear-gradient(145deg, #28694f, #153d34); color: #fff; box-shadow: 0 5px 0 #0a2921; }
body[data-skin="cafe"] .question-panel,
body[data-skin="cafe"] .ten-table,
body[data-skin="cafe"] .tile-stage,
body[data-skin="cafe"] .gold-stage,
body[data-skin="cafe"] .sheep-stage { border: 10px solid var(--cafe-wood); box-shadow: inset 0 0 0 3px var(--cafe-wood-hi), 0 10px 0 #3a1a0b; }
body[data-skin="cafe"] .soc-dock button,
body[data-skin="cafe"] .social-dock button { border: 2px solid #d39852; background: #183f3b; box-shadow: 0 5px 0 #09201e; }
body[data-skin="cafe"] .soc-sheet,
body[data-skin="cafe"] .sheet { border: 2px solid var(--cafe-line); background: var(--cafe-panel); color: var(--cafe-ink); }
body[data-skin="cafe"] .cafe-nav {
  position: fixed;
  z-index: 75;
  inset: auto max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(calc(100% - 12px), 520px);
  min-height: 68px;
  margin-inline: auto;
  border: 2px solid var(--cafe-line);
  border-radius: 24px;
  background: var(--cafe-panel);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .36);
}
body[data-skin="cafe"] .cafe-nav[hidden] { display: none; }
body[data-skin="cafe"] .cafe-nav a { display: grid; place-content: center; justify-items: center; gap: 2px; min-width: 0; color: var(--cafe-muted); font-size: .72rem; text-decoration: none; }
body[data-skin="cafe"] .cafe-nav a svg { width: 23px; height: 23px; fill: currentColor; stroke: currentColor; stroke-width: 1.5; }
body[data-skin="cafe"] .cafe-nav .cafe-nav-play { translate: 0 -16px; min-height: 76px; border: 3px solid #54270f; border-radius: 50%; background: var(--cafe-gold); color: #3a210d; box-shadow: 0 6px 0 #7e481d; }
body[data-skin="cafe"] .cafe-pref-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding-block: 8px; border-bottom: 1px solid var(--cafe-line); }
body[data-skin="cafe"] .cafe-pref-row:last-child { border-bottom: 0; }

/* Phase 1b: the cafe is a surface system, not a light card theme placed on a dark page. */
body[data-skin="cafe"] {
  --cafe-cream: #fff5d9;
  --cafe-dark: #132524;
  --cafe-dark-2: #1b3330;
  --cafe-teal: #bfe9df;
  --cafe-teal-ink: #183c36;
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
}
body[data-skin="cafe"][data-cafe-immersive="true"] { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
body[data-skin="cafe"] #app { padding-bottom: 24px; }
body[data-skin="cafe"] .topbar { min-height: calc(56px + env(safe-area-inset-top)); }
body[data-skin="cafe"] .brand { min-width: 0; overflow: hidden; }
body[data-skin="cafe"] .brand[data-icon]::before { content: attr(data-icon); display: inline-grid; place-items: center; inline-size: 34px; block-size: 34px; margin-inline-end: 6px; border-radius: 10px; background: #b86228; box-shadow: 0 3px 0 #693115; color: #fff; text-shadow: none; }
body[data-skin="cafe"] .brand-icon { flex-basis: 34px; inline-size: 34px; block-size: 34px; border: 0; margin-inline-end: 6px; background: #b86228; box-shadow: 0 3px 0 #693115; color: #fff; text-shadow: none; }
body[data-skin="cafe"] input,
body[data-skin="cafe"] textarea,
body[data-skin="cafe"] select { border-color: #7c6b54; background: #fffdf6; color: #2d1d10; }
body[data-skin="cafe"] input::placeholder,
body[data-skin="cafe"] textarea::placeholder { color: #6d6258; opacity: 1; }
body[data-skin="cafe"] .step-banner,
body[data-skin="cafe"] .room-now { background: var(--cafe-teal); color: var(--cafe-teal-ink); }
body[data-skin="cafe"] .modes button,
body[data-skin="cafe"] .room-pick,
body[data-skin="cafe"] .dash-card,
body[data-skin="cafe"] .fold,
body[data-skin="cafe"] .ten-bots,
body[data-skin="cafe"] .dm-opts { border-color: var(--cafe-line); background: var(--cafe-dark-2); color: var(--cafe-ink); }
body[data-skin="cafe"] .modes button[aria-pressed="true"] { border-color: var(--cafe-gold); background: #315b4c; color: #fffbe9; box-shadow: inset 0 0 0 1px var(--cafe-gold); }
body[data-skin="cafe"][data-look="day"] .modes button,
body[data-skin="cafe"][data-look="day"] .room-pick,
body[data-skin="cafe"][data-look="day"] .dash-card,
body[data-skin="cafe"][data-look="day"] .fold,
body[data-skin="cafe"][data-look="day"] .ten-bots,
body[data-skin="cafe"][data-look="day"] .dm-opts { background: #fffaf0; color: #34200f; }
body[data-skin="cafe"] .btn,
body[data-skin="cafe"] .soft-btn { color: #fffaf0; }
body[data-skin="cafe"] .btn.secondary,
body[data-skin="cafe"] .soft-btn { background: linear-gradient(#b96b31, #783a1a); }
body[data-skin="cafe"] .btn.ghost { color: var(--cafe-ink); background: transparent; border-color: var(--cafe-line); box-shadow: none; }

body[data-skin="cafe"] .acct-slot { z-index: 3; }
body[data-skin="cafe"] .cafe-hero { min-height: clamp(245px, 69vw, 390px); margin-block-end: 20px; }
body[data-skin="cafe"] .cafe-sign { inset: auto 50% 22px auto; min-width: min(290px, 82%); padding: 13px 18px 11px; border-color: #e2a94a; border-radius: 18px; background: linear-gradient(#56280f, #32170b); color: #fff0b5; font-size: 2.15rem; line-height: 1; box-shadow: 0 0 22px rgba(255, 200, 90, .58), 0 7px 0 #241006; rotate: 0deg; }
body[data-skin="cafe"] .cafe-sign::before { content: ""; position: absolute; inset: -11px 12px auto; block-size: 9px; background: radial-gradient(circle, #fff4a8 0 3px, #e2a94a 3.5px 5px, transparent 5.5px) 0 0 / 23px 9px repeat-x; }
body[data-skin="cafe"] .cafe-sign strong,
body[data-skin="cafe"] .cafe-sign small { display: block; }
body[data-skin="cafe"] .cafe-sign small { margin-block-start: 7px; color: #ffe8bd; font-size: .78rem; line-height: 1.35; }
body[data-skin="cafe"][data-look="day"] .cafe-sign { background: linear-gradient(#fff8e6, #f5dfb5); color: #8b3d13; text-shadow: none; }
body[data-skin="cafe"][data-look="day"] .cafe-sign small { color: #58341c; }
body[data-skin="cafe"] .home-now { margin: 12px 0 18px; padding: 10px 12px; border-radius: 12px; background: var(--cafe-teal); color: var(--cafe-teal-ink); font-weight: 700; }
body[data-skin="cafe"] .play-people { min-height: 72px; border-radius: 22px; font-size: 1.18rem; }
body[data-skin="cafe"] .play-people small { display: block; color: #fff0d8; }
body[data-skin="cafe"] .home-quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-block: 14px 0; }
body[data-skin="cafe"] .home-quick button { display: grid; place-items: center; gap: 2px; min-height: 68px; padding: 8px 4px; font-size: .76rem; }
body[data-skin="cafe"] .home-quick span { font-size: 1.35rem; }
body[data-skin="cafe"] .home-games-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; scroll-margin-top: 72px; }
body[data-skin="cafe"] .home-games-head .pick-title { margin-block: 12px; }
body[data-skin="cafe"] .game-grid { gap: 18px 12px; padding-block-start: 20px; }
body[data-skin="cafe"] .game-card { position: relative; display: grid; grid-template-rows: 112px minmax(78px, auto); min-height: 204px; overflow: hidden; border: 2px solid #7b421e; border-radius: 22px; background: repeating-linear-gradient(78deg, #94552b 0 2px, #7b421f 2px 22px, #a66234 23px 25px); box-shadow: inset 0 0 0 2px rgba(255,230,170,.12), 0 7px 0 #46210e, 0 12px 18px rgba(0,0,0,.25); }
body[data-skin="cafe"] .game-card .gc-art { position: relative; z-index: 1; inset: auto; height: 112px; min-height: 112px; overflow: hidden; background-size: contain; background-position: center top; background-repeat: no-repeat; pointer-events: none; }
body[data-skin="cafe"] .game-card[data-m="quick"] .gc-art::after { content: "🔀"; position: absolute; inset: 12px auto auto 10px; display: grid; place-items: center; inline-size: 36px; block-size: 36px; border: 2px solid #fff0bd; border-radius: 50%; background: #245d52; color: #fff; font-size: 1.2rem; box-shadow: 0 3px 0 #183b35; }
body[data-skin="cafe"] .game-card .gc-label { position: relative; inset: auto; z-index: 2; align-self: stretch; padding: 8px 9px 10px; text-shadow: 0 2px 2px #32170b; }
body[data-skin="cafe"] .game-card .gc-label b { font-size: 1.02rem; }
body[data-skin="cafe"] .game-card .gc-label small { color: #fff0c9; }
body[data-skin="cafe"][data-look="day"] .game-card { border-color: #b87836; background: repeating-linear-gradient(78deg, #e7bd7a 0 2px, #d8a961 2px 22px, #efc987 23px 25px); box-shadow: inset 0 0 0 2px rgba(255,255,255,.35), 0 7px 0 #9b6330, 0 12px 18px rgba(70,42,16,.18); }
body[data-skin="cafe"][data-look="day"] .game-card .gc-label { color: #34200f; text-shadow: none; }
body[data-skin="cafe"][data-look="day"] .game-card .gc-label small { color: #624329; }
body[data-skin="cafe"] .home-dash { margin-block-start: 28px; text-align: start; }
body[data-skin="cafe"] .dash-list .dash-extra { display: none; }
body[data-skin="cafe"] .dash-list.show-all .dash-extra { display: flex; }
body[data-skin="cafe"] .dash-more { display: block; margin: 6px auto 18px; min-height: 44px; }

body[data-skin="cafe"] .cafe-game-hub { overflow: hidden; }
body[data-skin="cafe"] .cafe-hub-hero { background-size: contain; background-color: #72411f; background-repeat: no-repeat; }
body[data-skin="cafe"] .cafe-hub-actions .btn:first-child,
body[data-skin="cafe"] #startBtn { min-height: 58px; font-size: 1.08rem; }
body[data-skin="cafe"] .lobby-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); padding: 12px 4px; border: 9px solid var(--cafe-wood); border-radius: 42% / 15%; background: radial-gradient(ellipse, #267758, #104833); box-shadow: inset 0 0 0 3px #c27d3f, 0 8px 0 #38190a; }
body[data-skin="cafe"] .lobby-grid .lobby-player { min-height: 126px; border: 0; background: transparent; box-shadow: none; overflow: visible; }
body[data-skin="cafe"] .lobby-grid .lobby-av { display: grid; place-items: center; inline-size: 64px; block-size: 64px; border: 4px solid #e3bc61; border-radius: 50%; background: #f8e8bd; box-shadow: 0 4px 0 #6a3518; font-size: 2rem; }
body[data-skin="cafe"] .lobby-grid .tag.ok { color: #123a2e; background: #bde9c9; }
body[data-skin="cafe"] .ten-bots-ctl { align-items: center; }
body[data-skin="cafe"] .ten-bots-ctl .btn { background: linear-gradient(#9c5522,#7a3a17); }

body[data-skin="cafe"] .cafe-nav { min-height: 58px; border-radius: 20px; }
body[data-skin="cafe"] .cafe-nav .cafe-nav-play { min-height: 64px; translate: 0 -12px; }
body[data-skin="cafe"][data-cafe-immersive="true"] .soc-dock { bottom: calc(14px + env(safe-area-inset-bottom)); }
body[data-skin="cafe"] .panel.ten { margin-bottom: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
body[data-skin="cafe"] .panel.ten .soc-dock { inset-inline-end: 8px; }
body[data-skin="cafe"] .dm-hand { padding-inline-end: 8px; }
body[data-skin="cafe"] .dm-table { border: 1px solid rgba(255,255,255,.2); box-shadow: inset 0 0 18px rgba(0,0,0,.16); }
body[data-skin="cafe"] .ten-hud { min-height: 44px; border-radius: 14px; background: rgba(10,35,29,.72); color: #fff9e8; }
body[data-skin="cafe"] .tseat-frame { box-shadow: 0 0 0 3px #e1bb62, 0 4px 0 #633313; }

body[data-skin="cafe"] .cafe-room-hero { overflow: hidden; border-color: #a66a32; background: linear-gradient(rgba(17,36,34,.82),rgba(17,36,34,.96)), url("art/cafe/hero-night.webp") center / cover; }
body[data-skin="cafe"][data-look="day"] .cafe-room-hero { background: linear-gradient(rgba(255,247,226,.82),rgba(255,247,226,.96)), url("art/cafe/hero-day.webp") center / cover; }
body[data-skin="cafe"] .room-table-card { display: grid; grid-template-columns: auto 1fr auto; }
body[data-skin="cafe"] .room-table-card .soft-btn { grid-column: 1 / -1; min-height: 44px; }
body[data-skin="cafe"] .room-table-card .danger { position: absolute; inset-inline-end: 8px; inset-block-start: 4px; }
body[data-skin="cafe"] .room-feed-lines { max-height: 220px; overflow: auto; padding: 8px 12px; border-radius: 14px; background: rgba(0,0,0,.12); }
body[data-skin="cafe"] .room-feed-lines p { margin: 7px 0; }
body[data-skin="cafe"] .room-feed-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-block-start: 10px; }
body[data-skin="cafe"] .room-feed-form .btn { min-width: 74px; margin: 0; }

body[data-skin="cafe"] .coins-panel + .panel { position: relative; padding-block-start: 82px; }
body[data-skin="cafe"] .coins-panel + .panel .hero-mark { display: inline-grid; place-items: center; inline-size: 92px; block-size: 92px; margin-block-start: -68px; border: 6px solid #d7a64e; border-radius: 50%; background: var(--cafe-green); box-shadow: 0 6px 0 #633414; }
body[data-skin="cafe"] #cafePrefs { border-color: #b97b37; }
body[data-skin="cafe"] #app > .panel:last-of-type .danger,
body[data-skin="cafe"] #app > .panel:last-of-type #delAcct { color: #ffd9d5; border-color: #d6685d; }

@media (max-width: 370px) {
  body[data-skin="cafe"] .home-quick button { font-size: .68rem; }
  body[data-skin="cafe"] .game-card { min-height: 196px; }
  body[data-skin="cafe"] .game-card .gc-art { min-height: 108px; }
}
@media (min-width: 620px) {
  body[data-skin="cafe"] .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 370px) {
  body[data-skin="cafe"] .game-card { min-height: 196px; }
  body[data-skin="cafe"] .game-card .gc-art { min-height: 108px; }
  body[data-skin="cafe"] .cafe-nav b { font-size: .62rem; }
}

/* Player effects are viewport overlays. Keep them above both the cafe nav (75) and top bar (80). */
body[data-skin="cafe"] :is(.splat, .sp-onbox, .sp-cards, .soc-launch, .soc-react, .soc-proj, .soc-shot) { z-index: 90; }
body[data-skin="cafe"] .sp-cards { top: max(calc(68px + env(safe-area-inset-top)), 8px); max-height: calc(100dvh - 96px - env(safe-area-inset-bottom)); overflow: hidden; }

/* Contrast pass (night): the shared page tokens are light-theme values; inside the cafe night look every surface token becomes dark and every text token light,
   so no component can end up with pale text on a pale surface. tests/e2e/contrast.mjs checks this in both looks. */
body[data-skin="cafe"]:not([data-look="day"]) {
  --ink: #fff6df;
  --muted: #d7c8aa;
  --paper: #1c2725;
  --raised: #24312f;
  --soft: #26332f;
  --line: rgba(255, 221, 157, .32);
  --teal: #6fe0d8;
  --teal-soft: #1d4a47;
  --sun-soft: #4a3a17;
  --coral-soft: #4d2a22;
  --good: #7de0a8;
  --good-soft: #1c3f2e;
  --warn: #ffd27a;
  --warn-soft: #4a3a17;
  --danger: #ff9a9a;
  --violet-soft: #33295e;
  --focus: #7cc4ff;
  --accent-soft: var(--sun-soft);
  --p0-soft: var(--coral-soft);
  --p1-soft: var(--teal-soft);
}
body[data-skin="cafe"]:not([data-look="day"]) .req-note b { color: #ff9a8f; }
body[data-skin="cafe"]:not([data-look="day"]) .chk span,
body[data-skin="cafe"]:not([data-look="day"]) .chk small { color: var(--ink); }
body[data-skin="cafe"]:not([data-look="day"]) .chk { background: var(--raised); }
body[data-skin="cafe"]:not([data-look="day"]) .chk:has(input:checked) { background: var(--teal-soft); }
body[data-skin="cafe"][data-look="day"] .brand { color: #6b3a10; text-shadow: none; }
body[data-skin="cafe"][data-look="day"] .req-note b { color: #b42318; }
body[data-skin="cafe"]:not([data-look="day"]) input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
body[data-skin="cafe"]:not([data-look="day"]) select,
body[data-skin="cafe"]:not([data-look="day"]) textarea { background: #121c1b; color: var(--ink); border-color: var(--line); }
body[data-skin="cafe"]:not([data-look="day"]) input::placeholder,
body[data-skin="cafe"]:not([data-look="day"]) textarea::placeholder { color: #b9ab8e; opacity: 1; }

/* the label sits under the picture, never over it: the picture block ends at 92px, the label (name + at most two lines) gets the rest */
body[data-skin="cafe"] .game-card .gc-label { max-height: 96px; overflow: hidden; }
body[data-skin="cafe"] .game-card .gc-label small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }

/* Domino table: the page above the table is the top bar (56px) + the panel padding (about 10px top, 12px bottom); the game box takes exactly what is left,
   so the hand ends inside the screen and the page never scrolls. The board is the flexible part. */
body[data-skin="cafe"] .dm-game { height: calc(100svh - 84px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); height: calc(100dvh - 84px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
body[data-skin="cafe"] .panel.ten.dm { padding-bottom: 6px; margin-bottom: 0; }
body[data-skin="cafe"] .dm-game > .ten-stage { min-height: 120px; }
/* the throw / chat / memes buttons sit in the free gap of my seat row, never over the hand */
body[data-skin="cafe"][data-mode="domino"]:has(.dm-game) .soc-dock,
body[data-skin="cafe"][data-mode="domino"][data-cafe-immersive="true"]:has(.dm-game) .soc-dock { inset-inline-end: auto; inset-inline-start: auto; left: 36%; bottom: calc(112px + env(safe-area-inset-bottom)); }
body[data-skin="cafe"][data-look="day"] { --muted: #4a565c; }

/* People-first directory: one obvious action, scannable live rows, then low-priority shortcuts. */
body[data-skin="cafe"] .people-panel { overflow: visible; }
body[data-skin="cafe"] .people-match { width: 100%; min-height: 76px; margin-block: 8px 22px; border-radius: 22px; font-size: 1.16rem; }
body[data-skin="cafe"] .people-match small { display: block; margin-block-start: 4px; color: #fff0d8; font-size: .86rem; line-height: 1.45; }
body[data-skin="cafe"] .people-dash { text-align: start; }
body[data-skin="cafe"] .people-section + .people-section { margin-block-start: 26px; }
body[data-skin="cafe"] .dash-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
body[data-skin="cafe"] .dash-title-row .pick-title { margin-block: 12px; }
body[data-skin="cafe"] .dash-list { display: grid; gap: 10px; }
body[data-skin="cafe"] .dash-card { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-width: 0; min-height: 72px; padding: 8px; border: 1px solid var(--cafe-line); border-radius: 16px; }
body[data-skin="cafe"] .dc-art { width: 52px; height: 52px; border-radius: 12px; background: #72411f; object-fit: contain; }
body[data-skin="cafe"] .dc-ico { display: grid; place-items: center; width: 52px; min-height: 52px; font-size: 1.55rem; }
body[data-skin="cafe"] .dc-main { min-width: 0; overflow-wrap: anywhere; }
body[data-skin="cafe"] .dc-main > span { display: block; margin-block-start: 3px; line-height: 1.45; }
body[data-skin="cafe"] .dc-side { display: grid; justify-items: center; gap: 2px; }
body[data-skin="cafe"] .dc-join { min-width: 72px; min-height: 46px; padding: 6px 10px; border: 1px solid #5b2e13; border-radius: 13px; background: var(--cafe-gold); color: #34200f; font-weight: 900; }
body[data-skin="cafe"] .dash-empty { padding: 14px; border: 1px dashed var(--cafe-line); border-radius: 16px; text-align: center; }
body[data-skin="cafe"] .dash-empty p { margin-block-end: 10px; color: var(--cafe-muted); line-height: 1.55; }
body[data-skin="cafe"] .dash-empty .soft-btn { width: 100%; min-height: 48px; }
body[data-skin="cafe"] .people-shortcuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-block-start: 28px; }
body[data-skin="cafe"] .people-shortcuts h2 { grid-column: 1 / -1; margin: 0; }
body[data-skin="cafe"] .people-shortcuts button { min-height: 54px; }

/* Theme parity for overlays and reusable status surfaces. */
body[data-skin="cafe"] :is(.dlg, .soc-sheet, .sheet, .result-hero, .fold) { color: var(--ink); }
body[data-skin="cafe"] :is(.dlg, .soc-sheet, .sheet) .muted { color: var(--muted); }
body[data-skin="cafe"] .tag { border: 1px solid var(--cafe-line); background: var(--soft); color: var(--ink); }
body[data-skin="cafe"][data-look="day"] :is(.dlg, .soc-sheet, .sheet) { background: #fffaf0; color: #34200f; }
body[data-skin="cafe"][data-look="day"] .soc-clear .soc-sheet { background: #192020; color: #fff; }

/* Arabic remains comfortably readable; Latin and Han keep their native system fallbacks. */
html[lang="ar"] body[data-skin="cafe"] { line-height: 1.5; }
html[lang="ar"] body[data-skin="cafe"] :is(p, label, li, .dc-main, .field-note) { font-size: max(15px, 1rem); line-height: 1.5; overflow-wrap: anywhere; }
html[lang="ar"] body[data-skin="cafe"] :is(.small, small, .tag, .tseat, .ten-line, .dm-foot) { font-size: max(13px, .8125rem); line-height: 1.4; }
html[lang="en"] body[data-skin="cafe"],
html[lang="zh"] body[data-skin="cafe"] { font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif; }

@media (max-width: 370px) {
  body[data-skin="cafe"] .dash-card { grid-template-columns: 46px minmax(0, 1fr) auto; gap: 7px; }
  body[data-skin="cafe"] .dc-art,
  body[data-skin="cafe"] .dc-ico { width: 46px; height: 46px; min-height: 46px; }
  body[data-skin="cafe"] .dc-join { min-width: 64px; padding-inline: 7px; }
}
/* The memes / clips / sounds popup is a dark glass popup in both looks (its texts are light by design) */
body[data-skin="cafe"] .soc-pop .soc-quick { background: rgba(28, 39, 37, .98); color: #fff6df; border-color: rgba(255, 221, 157, .32); }
body[data-skin="cafe"] .soc-pop .soc-quick .soc-head h2 { color: #fff6df; }
/* Opaque paired surfaces: these shared controls appeared in the pixel audit
   across every game, so the cafe skin must not reintroduce translucent or
   gradient-dependent contrast after the base stylesheet fixes them. */
body[data-skin="cafe"] .soft-btn {
  border-color: #4a210d;
  background: #6b2f12;
  color: #fffaf0;
}
body[data-skin="cafe"] .code-display {
  background: #fff6e5;
  color: #173f68;
}
body[data-skin="cafe"] .lobby-player .lobby-name {
  background: #102b27;
  color: #fffdf7;
}
body[data-skin="cafe"] .lobby-player :is(.muted.small, small.muted) {
  background: #fff6e5;
  color: #493522;
}
body[data-skin="cafe"] :is(.soc-head, .soc-head h2, .soc-tabs, .soc-tab) {
  background: #1c2725;
  color: #fff8e8;
}
body[data-skin="cafe"] .soc-tab.on { background: #ffd84d; color: #202b31; }
body[data-skin="cafe"] .ten-game:not(.dm-game) .ten-hud {
  background: #102f2b;
  color: #fff9e8;
}
/* never cut either card-game hand off: on short phones and with large text, keep every row in flow and scroll the table */
body[data-skin="cafe"] .ten-game { overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
body[data-skin="cafe"] .dm-game > .ten-stage { min-height: 110px; }
/* the stock / status / leave row grows with its text instead of spilling over my seat */
body[data-skin="cafe"] .dm-utility { flex: 0 0 auto; height: auto; min-height: 48px; }
/* the status cell holds the "robot is playing for you" banner AND the "I'm back" button: never clip it (a 2-line clamp hid the button) */
body[data-skin="cafe"] .dm-utility .ten-command { display: flex; flex-direction: column; align-items: center; gap: 6px; line-height: 1.35; }
body[data-skin="cafe"] .dm-utility .ten-command .tbanner { font-size: .9rem; line-height: 1.3; text-align: center; }
body[data-skin="cafe"] .dm-utility .ten-command #dBack { min-height: 44px; padding-inline: 18px; font-size: 1rem; }
/* four tabs in the memes popup: each label stays on one line */
body[data-skin="cafe"] .soc-tabs { overflow-x: auto; scrollbar-width: none; }
body[data-skin="cafe"] .soc-tab { white-space: nowrap; min-width: max-content; padding-inline: 8px; font-size: .8rem; }
body[data-skin="cafe"] .dm-stock > b { background: #8a3f12; }
/* replica-design contrast check (replica/design/tokens.*.json): teal links on the sand page were 3.1:1 in day */
body[data-skin="cafe"][data-look="day"] { --teal: #05524f; }
body[data-skin="cafe"][data-look="day"] .link-btn { color: #05524f; }
body[data-skin="cafe"] .game-grid.pick-pulse .game-card { animation: pick-pulse 1.2s ease 2; }
@keyframes pick-pulse { 50% { box-shadow: 0 0 0 4px var(--cafe-gold), 0 7px 0 #46210e; } }
/* Phase 10 and tile race keep their hand / tray at the bottom: the chat + throw buttons sit at the top there, as one small row */
body[data-skin="cafe"]:has(.ten-game:not(.dm-game)) .soc-dock,
body[data-skin="cafe"]:has(.tile-panel) .soc-dock { top: calc(66px + env(safe-area-inset-top)); bottom: auto; flex-direction: row; gap: 6px; inset-inline-end: 8px; inset-inline-start: auto; }
body[data-skin="cafe"]:has(.ten-game:not(.dm-game)) .soc-dock .soc-btn,
body[data-skin="cafe"]:has(.tile-panel) .soc-dock .soc-btn { width: 44px; height: 44px; }
/* the card's picture is always row 1 and its text row 2, whatever the markup order */
body[data-skin="cafe"] .game-card { grid-template-columns: minmax(0, 1fr); }   /* one column: the classic .game-tile has an icon + text column grid that squeezed the label */
body[data-skin="cafe"] .game-card .gc-art { grid-row: 1; grid-column: 1; width: 100%; }
body[data-skin="cafe"] .game-card .gc-label { grid-row: 2; grid-column: 1; }
body[data-skin="cafe"] .friends-rooms { display: flex; margin: 8px 0 4px auto; min-height: 44px; }
/* Tawla preview has no raster dependency: the miniature board is CSS so the
   hidden feature cannot leak an unpublished asset or produce broken requests. */
.game-card.tawla-card .gc-art, .cafe-hub-hero.tawla-hero {
  background-color: #b87a3e;
  background-image: linear-gradient(27deg, transparent 47%, #8f2824 48% 52%, transparent 53%), linear-gradient(153deg, transparent 47%, #f0dcb0 48% 52%, transparent 53%), linear-gradient(90deg, transparent 47%, #4d2c18 48% 52%, transparent 53%);
  background-size: 25% 100%, 25% 100%, 100% 100%;
  box-shadow: inset 0 0 0 8px #5d351d, inset 0 0 0 11px #dfb872;
}

/* Approved Tawla doorway and board chrome. */
body[data-skin="cafe"] .tw-hub { padding: 10px; border: 0; background: transparent; box-shadow: none; }
body[data-skin="cafe"] .tw-hub > .back { position: relative; z-index: 2; margin-bottom: 5px; }
body[data-skin="cafe"] .tw-hub-hero { position: relative; display: flex; align-items: center; justify-content: space-between; min-height: 126px; padding: 14px; overflow: hidden; border: 1px solid #b86e35; border-radius: 20px; background: radial-gradient(circle at 75% 30%,#9c572b,#542713 67%); box-shadow: inset 0 0 30px #160a0666,0 7px 0 #32170c; color: #fff6df; }
body[data-skin="cafe"] .tw-hub-copy { position: relative; z-index: 2; max-width: 52%; }
body[data-skin="cafe"] .tw-hub-copy small, body[data-skin="cafe"] .tw-hub-heading small { color: #ffd46d; font-weight: 900; }
body[data-skin="cafe"] .tw-hub-copy h1 { margin: 1px 0; color: #fff9e8; font-size: 2rem; line-height: 1; }
body[data-skin="cafe"] .tw-hub-copy p { margin: 5px 0 0; font-size: .78rem; }
.tw-box-art { position: relative; width: 43%; height: 92px; transform: rotate(-3deg); filter: drop-shadow(0 7px 4px #160a08aa); }
.tw-box-art::before, .tw-box-art span { content: ""; position: absolute; inset: 5px 48% 5px 0; border: 5px solid #5a2c18; background: repeating-conic-gradient(from 35deg at 100% 50%,#f1d596 0 5deg,#85391f 6deg 11deg); }
.tw-box-art span { inset: 5px 0 5px 52%; background: repeating-conic-gradient(from 215deg at 0 50%,#f1d596 0 5deg,#85391f 6deg 11deg); }
.tw-box-art i { position: absolute; z-index: 2; left: 48%; width: 5px; height: 20px; background: #dcae57; }
.tw-box-art i.a { top: 14px; }.tw-box-art i.b { bottom: 14px; }
body[data-skin="cafe"] .tw-hub-heading { display: flex; margin: 18px 3px 7px; }
body[data-skin="cafe"] .tw-hub-heading span { display: grid; }
body[data-skin="cafe"] .tw-hub-heading b { font-size: 1.15rem; }
.tw-hub-variants { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
body[data-skin="cafe"] .tw-hub-variant { display: grid; grid-template-columns: 42px 1fr; align-items: center; min-width: 0; min-height: 70px; padding: 6px; border: 1px solid var(--cafe-line); border-radius: 14px; background: var(--cafe-panel); color: var(--cafe-ink); text-align: start; box-shadow: none; }
body[data-skin="cafe"] .tw-hub-variant.on { border: 2px solid var(--cafe-gold); box-shadow: inset 0 0 0 1px #6c411c; }
.tw-hub-variant b, .tw-hub-variant small { display: block; }
.tw-hub-variant b { font-size: .83rem; }.tw-hub-variant small { margin-top: 2px; color: var(--cafe-muted); font-size: .58rem; line-height: 1.25; }
.tw-mini-board { position: relative; width: 34px; height: 48px; overflow: hidden; border: 3px solid #6c351a; border-radius: 4px; background: repeating-linear-gradient(75deg,#ecd292 0 5px,#84391e 6px 11px); box-shadow: inset 0 0 0 1px #e8bb6a; }
.tw-mini-board i { position: absolute; left: 4px; width: 8px; height: 8px; border-radius: 50%; background: #f6e7bf; border: 1px solid #60462e; }.tw-mini-board i:first-child { top: 5px; }.tw-mini-board i:last-child { right: 4px; bottom: 5px; left: auto; background: #38221b; }
.tw-mini-board.stack i:last-child { bottom: 12px; }.tw-mini-board.open i:first-child { top: 18px; }
body[data-skin="cafe"] .tw-hub-how { margin-top: 8px; padding: 8px 11px; border: 1px solid var(--cafe-line); border-radius: 14px; background: var(--cafe-panel); }
body[data-skin="cafe"] .tw-hub-how summary { min-height: 28px; font-weight: 900; cursor: pointer; }
body[data-skin="cafe"] .tw-hub-how p { margin: 6px 0 0; color: var(--cafe-muted); font-size: .75rem; }
.tw-hub-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 9px; }
.tw-hub-actions .tw-robot { grid-column: 1 / -1; }
body[data-skin="cafe"] .tw-hub-actions .btn { min-height: 48px; margin: 0; }
body[data-skin="cafe"][data-look="day"] .tw-hub-hero { background: radial-gradient(circle at 75% 30%,#a8602c,#6b3218 70%); }   /* dark enough for its white text at every point */
/* Tawla hub measured-pixel contrast pairs. */
body[data-skin] .tw-hub #backBtn {
  border-color:var(--game-row-ink);
  background:var(--game-row-bg);
  color:var(--game-row-ink);
  text-shadow:none;
}
body[data-skin] .tw-hub .tw-hub-copy small,
body[data-skin] .tw-hub .tw-hub-copy p {
  color:#fff9e8;
  text-shadow:0 1px 2px #2c160d;
}
body[data-skin] .tw-hub .tw-hub-heading small {
  color:#ffd46d;
  text-shadow:none;
}
body[data-skin][data-look="day"] .tw-hub .tw-hub-heading small { color:#2f1a0a; }   /* on the light day page */
body[data-skin][data-look="day"] .tw-hub-variant small { color:#4a3420; }   /* the muted token is too light on the day card */
body[data-skin][data-look="day"][data-mode="tawla"] .tw-quit { color:#fffaf0 !important; text-shadow:0 1px 3px #000; }
body[data-skin="cafe"][data-mode="tawla"]:has(.tw-game) #app { padding-bottom: 4px; }
body[data-skin="cafe"] .tw-panel { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
body[data-skin="cafe"] .tw-game { color: var(--cafe-ink); }
body[data-skin="cafe"] .tw-hud { border: 1px solid var(--cafe-line); background: var(--cafe-panel); }
body[data-skin="cafe"][data-mode="tawla"]:has(.tw-game) .soc-dock { top: calc(60px + env(safe-area-inset-top)); bottom: auto; inset-inline-end: 8px; flex-direction: row; gap: 6px; }
body[data-skin="cafe"][data-mode="tawla"]:has(.tw-game) .soc-dock .soc-btn { width: 44px; height: 44px; }
/* tawla: the score strip is a dark band in both looks (its text is light), the chat/throw buttons sit at the end of the opponent row, not over the strip */
body[data-skin="cafe"] .tw-hud { background: #1c2725; color: #fff6df; }
body[data-skin="cafe"][data-mode="tawla"]:has(.tw-game) .soc-dock { top: calc(96px + env(safe-area-inset-top)); }
body[data-skin="cafe"] .tw-player.tw-opponent { padding-inline-end: 104px; }
/* the chosen target in the throw sheet has a light player colour: dark text on it in both looks */
body[data-skin="cafe"] .soc-target.on, body[data-skin="cafe"] .soc-target.on bdi { color: #202b31; }
/* tawla: the opponent row is tall enough to hold the chat / throw buttons at its end, so they never sit on the board */
body[data-skin="cafe"] .tw-player.tw-opponent { min-height: 48px; align-items: center; }
body[data-skin="cafe"][data-mode="tawla"]:has(.tw-game) .soc-dock { top: auto; }

/* app.js aligns this fixed layer to the reserved end of the opponent row. */
body[data-skin="cafe"][data-mode="tawla"]:has(.tw-game) .soc-dock { position:fixed; z-index:120; inset-inline-end:max(7px,env(safe-area-inset-right)); bottom:auto; flex-direction:row; gap:6px; transform:none; }
body[data-skin="cafe"][data-mode="tawla"]:has(.tw-game) .soc-dock .soc-btn { width:44px; height:44px; border:2px solid #d3a84f; border-radius:50%; background:#fff8e4; color:#6b4212; box-shadow:0 4px 10px #0007,inset 0 0 0 2px #fff; }

/* Tawla 31 R1 material layer wins over the older compact café strip. */
body[data-skin="cafe"][data-mode="tawla"] .tw-hud {
  border:2px solid #9b6c21;
  background:linear-gradient(145deg,#fffdf7e8,#e6d5bbf2),url("art/tawla/marble.jpg");
  background-size:auto,300px;
  color:#5a360e;
}
body[data-skin="cafe"][data-mode="tawla"] .tw-player.tw-opponent {
  min-height:112px; padding:0; align-items:center;
}
body[data-skin="cafe"][data-mode="tawla"]:has(.tw-game) .soc-dock .soc-btn {
  width:58px; height:58px; border-width:3px;
  box-shadow:0 5px 12px #1b0c0788,inset 0 0 0 3px #fff8dc;
}
@media (max-height:700px) and (max-width:500px) {
  body[data-skin="cafe"][data-mode="tawla"] .tw-player.tw-opponent { min-height:76px; }
  body[data-skin="cafe"][data-mode="tawla"]:has(.tw-game) .soc-dock .soc-btn { width:48px; height:48px; }
}

/* The bottom navigation is useful on phones; on desktop it joins the document flow. */
@media (min-width: 900px) {
  body[data-skin="cafe"] .cafe-nav {
    position: static;
    inset: auto;
    margin: 14px auto calc(14px + env(safe-area-inset-bottom));
  }
}

/* Game cards: the description shows up to three whole lines (it was cut in the middle of the third), the card grows to fit it. */
body[data-skin="cafe"] .game-card { grid-template-rows: 112px minmax(96px, auto); min-height: 224px; }
body[data-skin="cafe"] .game-card .gc-label { max-height: none; overflow: visible; }
body[data-skin="cafe"] .game-card .gc-label small { -webkit-line-clamp: 3; max-height: 3.95em; }
/* Tawla's card uses a picture like every other game now. */
body[data-skin="cafe"] .game-card[data-m="tawla"] { --cafe-art: url("art/cafe/game-tawla.webp?v=2"); }
body[data-skin="cafe"] .game-card.tawla-card .gc-art { box-shadow: none; background-color: transparent; background-image: var(--cafe-art); }
