@import url('/game-legal.css');
:root{color-scheme:light;--paper:#f6f2e8;--ink:#163c34;--gold:#cba456;--line:#d8d4c8;--red:#b52e31;--blue:#225da1;--orange:#a35b0b;font-family:Arial,"Noto Sans Hebrew",sans-serif}*{box-sizing:border-box}body{margin:0;background:var(--paper);color:var(--ink)}[hidden]{display:none!important}button,input,select{font:inherit}button,a,input,select{-webkit-tap-highlight-color:transparent}button{cursor:pointer;padding:.7rem 1rem;border:1px solid var(--line);border-radius:9px;background:#fffdf8;color:var(--ink);font-weight:600;touch-action:manipulation}button:hover:enabled{border-color:var(--gold);box-shadow:0 3px 10px #163c3412}button:disabled{opacity:.4;cursor:default}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #d49e36;outline-offset:3px}.primary{background:var(--ink);border-color:var(--ink);color:#fff}.primary:hover:enabled{background:#245548}a{color:inherit;text-underline-offset:4px}header{display:flex;align-items:center;justify-content:space-between;gap:1rem;max-width:1280px;margin:auto;padding:22px 32px;border-bottom:1px solid var(--line)}.brand{text-decoration:none;font-size:23px;letter-spacing:2px;font-weight:800;direction:ltr}.brand span{display:block;font-size:10px;letter-spacing:4px;margin-top:6px;color:#74837a}nav{display:flex;align-items:center;gap:12px}nav button{padding:.45rem .65rem;font-size:13px}main{max-width:1180px;margin:auto;padding:28px}#setup{display:grid;grid-template-columns:.85fr 1.15fr;gap:60px;align-items:center;padding:45px 0 55px}.eyebrow{letter-spacing:2px;font-size:12px;color:#737c66;font-weight:700}h1{font-size:clamp(44px,7vw,80px);margin:10px 0;letter-spacing:-2px}h2{font-size:22px;margin:0 0 20px}.hero>p:not(.eyebrow){font-size:19px;line-height:1.9;max-width:420px}.hero-tiles{display:flex;gap:9px;direction:ltr;padding:30px 0}.hero-tiles .tile{width:70px;height:98px;font-size:47px;transform:rotate(-7deg);box-shadow:0 7px 0 #d4c6a5,0 14px 16px #1d3b3019}.hero-tiles .tile:nth-child(2){transform:rotate(3deg) translateY(-10px)}.hero-tiles .tile:nth-child(3){transform:rotate(-2deg)}.hero-tiles .tile:nth-child(4){transform:rotate(9deg) translateY(-6px)}.panel{background:#fffdf8;border:1px solid var(--line);padding:28px;border-radius:16px;box-shadow:0 10px 35px #163c3406}.form-grid{display:flex;flex-wrap:wrap;gap:16px;margin-bottom:20px}.form-grid label{flex:1;min-width:130px}label{display:flex;flex-direction:column;gap:8px;font-size:14px;font-weight:600}input,select{width:100%;padding:11px;border:1px solid var(--line);border-radius:8px;color:var(--ink);background:white;min-width:0}fieldset{margin:24px 0;padding:20px;border:1px solid var(--line);border-radius:10px}legend{font-weight:bold;padding:0 8px}.rules-settings{display:flex;flex-wrap:wrap;align-items:center;gap:20px}.rules-settings input[type=number]{width:100px}.check{flex-direction:row;align-items:center;line-height:1.5}.check input{width:20px;height:20px;accent-color:var(--ink)}small{font-size:12px;line-height:1.7;font-weight:400;color:#63766a;width:100%}.actions{display:flex;gap:9px;flex-wrap:wrap;align-items:center}.actions label{max-width:140px}.actions+p{font-size:13px;line-height:1.8;color:#617467}.game-heading{display:flex;justify-content:space-between;align-items:center}.game-heading h1{font-size:40px}.muted{color:#64786c;font-size:14px;line-height:1.6}.players{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px;margin:24px 0}.player{padding:14px;border:1px solid var(--line);border-radius:12px;background:#fffdf8;overflow-wrap:anywhere}.player.active{border:2px solid var(--gold);background:#f8edcf;padding:13px}.player strong{display:block;font-size:16px}.player small{display:block;margin-top:6px}.board-title,.rack-heading{display:flex;align-items:center;justify-content:space-between;margin:22px 0 12px}.board-title h2,.rack-heading h2{margin:0}.board{display:flex;align-content:flex-start;align-items:flex-start;flex-wrap:wrap;gap:14px;min-height:230px;max-height:48vh;overflow:auto;background:radial-gradient(ellipse at top,#285d4e,#123b31);border:6px solid #ba995d;box-shadow:inset 0 0 50px #001e192e,0 6px 0 #8d723f;border-radius:16px;padding:22px;direction:ltr}.empty-board{width:100%;text-align:center;color:#bdd0c4;padding:55px 10px;line-height:1.8}.set{display:flex;flex-wrap:wrap;gap:4px;max-width:100%;border:1px solid #ffffff33;border-radius:8px;padding:6px;align-items:center}.set.invalid{border:2px dashed #ed9c83}.set-target{padding:10px 8px;color:#d9e5dd;background:#ffffff0b;border-color:#ffffff30;min-width:36px}.tile{display:inline-flex;align-items:center;justify-content:center;position:relative;background:linear-gradient(120deg,#fffef8,#ede5cf);border:1px solid #d5c9ac;border-bottom:4px solid #c6bda5;border-radius:6px;width:44px;height:62px;min-width:44px;padding:0;font-size:28px;font-weight:800;direction:ltr;color:#292b2c;box-shadow:0 2px 4px #0002}.tile:disabled{opacity:1;color:inherit;cursor:default}.tile.red{color:var(--red)}.tile.blue{color:var(--blue)}.tile.orange{color:var(--orange)}.tile.black{color:#282d2c}.tile.selected{outline:3px solid #f1c856;outline-offset:1px;transform:translateY(-5px);background:#fff7cf}.tile .represented{font-size:11px;position:absolute;bottom:2px;right:4px}.tile .color-mark{position:absolute;top:3px;left:4px;font-size:7px}.board-actions{margin-top:22px}.board-actions button{font-size:13px}.rack{display:flex;flex-wrap:wrap;gap:7px;direction:ltr;min-height:94px;background:#e8e1d1;border:1px solid #d4c8af;border-radius:12px;padding:15px}.instruction{font-size:13px;color:#62786b;line-height:1.8}.turn-actions{justify-content:flex-end;padding:5px 0 20px}#status{min-height:26px;line-height:1.7;color:#86511c;font-weight:600}#results{margin:30px 0}#scores{display:flex;flex-wrap:wrap;gap:20px;margin-bottom:22px}.score{padding:15px;background:#f5f0e3;border-radius:9px}footer{max-width:1180px;margin:auto;padding:30px;text-align:center;border-top:1px solid var(--line);font-size:13px;color:#62786b}footer p{font-size:12px;line-height:1.8}dialog{border:1px solid var(--gold);border-radius:18px;max-width:min(460px,90vw);padding:40px;text-align:center;background:var(--paper);color:var(--ink)}dialog::backdrop{background:#0d2b25}dialog p{line-height:1.9}.handoff-icon{font-size:50px;color:var(--gold);margin-bottom:22px}@media(max-width:850px){header{padding:17px;gap:12px;flex-wrap:wrap}main{padding:18px}#setup{grid-template-columns:1fr;gap:25px;padding:10px 0 25px}.hero{max-width:650px}.hero h1{font-size:54px}.hero-tiles{padding:15px 0}.hero-tiles .tile{width:48px;min-width:48px;height:68px;font-size:32px}.panel{padding:20px}nav{gap:8px;font-size:13px}.board{padding:12px;border-width:4px;min-height:200px;max-height:45vh}.tile{width:40px;min-width:40px;height:56px;font-size:25px}.set{gap:3px;padding:4px}.players{gap:7px;grid-template-columns:repeat(2,1fr)}.player{padding:10px}.player.active{padding:9px}.rack{padding:12px;gap:6px}.actions button{padding:.65rem .75rem}.form-grid{gap:12px}.rules-settings{padding:15px}.game-heading h1{font-size:34px}}@media(max-height:500px){.board{min-height:130px;max-height:38vh}.players{margin:10px 0}.hero-tiles{display:none}}@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}
/* Release 87: direct manipulation, compact controls and an advisory clock. */
.header-menu,.more-actions{position:relative}.header-menu summary,.more-actions summary{list-style:none;cursor:pointer;border:1px solid var(--line);border-radius:9px;padding:10px 14px;background:#fffdf8;min-height:44px;display:flex;align-items:center}.header-menu summary::-webkit-details-marker,.more-actions summary::-webkit-details-marker{display:none}.header-menu>div,.menu-panel{position:absolute;inset-inline-end:0;top:calc(100% + 7px);display:grid;gap:7px;padding:12px;background:#fffdf8;border:1px solid var(--line);border-radius:12px;box-shadow:0 10px 30px #0002;z-index:30;min-width:190px}.menu-panel a{padding:10px;font-size:14px}.quiet{background:transparent;box-shadow:none}.game-title{display:flex;align-items:baseline;gap:16px;min-width:0}.game-title p{font-size:12px;color:#5d7065}.turn-clock{direction:ltr;min-width:110px;padding:7px 12px;border:1px solid #cbd9ce;background:#eaf2e9;border-radius:12px;text-align:center;display:grid;grid-template-columns:1fr auto;gap:4px 12px;align-items:center}.turn-clock>span:first-child{font-size:11px;direction:rtl}.turn-clock strong{font-size:24px;font-variant-numeric:tabular-nums}.clock-track{grid-column:1/-1;height:4px;background:#d4dfd1;border-radius:3px;overflow:hidden}.clock-track>span{display:block;width:100%;height:100%;background:#30775a;transition:width .2s linear}.turn-clock.soon{background:#fff0cc;border-color:#be8121}.turn-clock.soon .clock-track>span{background:#b57913}.turn-clock.over{background:#ffe7e1;border-color:#bc3c2c;color:#a12e23}.turn-clock.over .clock-track>span{background:#bc3c2c}.turn-clock.paused{opacity:.6}.players{display:flex;gap:10px;margin:10px 0}.player{flex:1;min-width:0;padding:10px 12px;display:flex;gap:10px;align-items:center}.player.active{padding:9px 11px}.player-info{min-width:0;flex:1}.player strong{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.player small{font-size:11px;margin-top:4px}.player-count{font-size:25px;line-height:1;min-width:30px;text-align:center;font-weight:800;font-variant-numeric:tabular-nums}.player-count span{display:block;font-size:10px;font-weight:400;margin-top:4px}.board-title{gap:12px}.board-title>div:first-child{display:flex;align-items:center;gap:14px}.board-title h2{font-size:18px}.edit-badge{font-size:11px;color:#64766b}.table-tools{display:flex;align-items:center;gap:7px;font-size:13px}.table-tools button{min-height:44px}.table-tools #boardSummary{font-size:11px;color:#536d5e}.board{gap:20px;min-height:220px;max-height:none;align-content:flex-start;overscroll-behavior:contain;scrollbar-color:#bda169 #163c34}.set{position:relative;padding:24px 9px 9px;gap:5px;border:1px solid #a9cbb280;background:#ffffff06;border-radius:11px;flex-wrap:wrap;max-width:100%;transition:border-color .12s}.set.valid{border-color:#91cba0}.set.invalid{border:2px dashed #ff9a85;background:#742e1e2b;padding:23px 8px 8px}.set-grip{position:absolute;inset:0 0 auto 0;display:flex;align-items:center;justify-content:space-between;gap:16px;width:100%;min-height:25px;padding:3px 9px;background:transparent;border:0;border-radius:8px 8px 0 0;box-shadow:none;color:#dceade;font-size:11px;cursor:grab;touch-action:none}.set-grip:disabled{opacity:.65;cursor:default}.set.invalid .set-grip{color:#ffbaab}.set.selected-set{outline:2px solid #f8cd5f;outline-offset:3px}.tile{width:50px;min-width:50px;height:70px;font-size:33px;cursor:grab;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}.tile .color-mark{top:5px;left:5px;font-size:11px}.tile .represented{font-size:14px;bottom:3px;right:5px}.tile:disabled{cursor:default}.tile.selected{transform:translateY(-3px)}.new-drop{display:flex;align-items:center;justify-content:center;min-height:104px;min-width:155px;flex:1;max-width:260px;border:2px dashed #aec9b369;border-radius:12px;background:#ffffff04;color:#c7d7cc;padding:18px;text-align:center;line-height:1.7;white-space:pre-line;font-size:13px;cursor:pointer;direction:rtl;touch-action:pan-y}.new-drop:focus-visible,.set:focus-visible,.rack:focus-visible{outline:3px solid #f0c45d;outline-offset:3px}.new-drop.empty{max-width:none;min-height:170px}.drop-active{outline:3px solid #f3c65d!important;outline-offset:3px;background-color:#e4c45a2a!important}.rack-panel{background:#ece4d3;border:1px solid #d4c8af;border-radius:13px;margin-top:15px;padding:12px}.rack-heading{margin:0 0 10px;gap:10px}.rack-heading>div:first-child{display:flex;gap:12px;align-items:baseline;flex-wrap:wrap}.rack-heading h2{font-size:17px}.opening-progress{font-size:12px;color:#586b60;font-variant-numeric:tabular-nums}.opening-progress.ready{color:#246640;font-weight:bold}.rack-tools{display:flex;align-items:center;gap:7px}.rack-tools button{min-width:44px;min-height:44px;padding:8px 10px}.rack-tools #selectionInfo{font-size:12px;white-space:nowrap}.sort-switch{display:flex;direction:rtl;border:1px solid #c8bda7;border-radius:9px;overflow:hidden;background:#f9f5eb}.sort-switch button{border:0;border-radius:0;background:transparent;font-size:12px}.sort-switch button[aria-pressed=true]{background:#d5c6a5}.rack{background:none;border:0;padding:4px 2px;gap:8px;min-height:78px;max-height:165px;overflow:auto;overscroll-behavior:contain;align-content:flex-start;scrollbar-color:#b2a17e #e8e1d1}.turn-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 0 5px}.turn-bar .actions{flex-wrap:nowrap}.turn-bar button{min-height:48px;min-width:105px}.turn-feedback{min-width:0;flex:1}.turn-feedback #status{font-size:13px;margin:0;min-height:22px;line-height:1.55}.turn-feedback #status.good{color:#21643e}.turn-feedback #status.bad{color:#a13e2b}#timerWarning{margin:4px 0 0;font-size:12px;color:#a13e2b;font-weight:600}.instruction{margin:4px 0 0;font-size:12px}.drag-ghost{position:fixed;inset:0 auto auto 0;pointer-events:none;z-index:1000;display:flex;gap:4px;padding:6px;border-radius:10px;background:#153b31d9;box-shadow:0 12px 28px #0005;max-width:80vw;direction:ltr}.drag-ghost .tile{transform:rotate(-3deg);opacity:.95}.drag-ghost .ghost-count{color:white;align-self:center;padding:10px;font-weight:bold}.drag-source{opacity:.35!important}.dragging{cursor:grabbing!important;user-select:none}.playing{height:100dvh;overflow:hidden;display:flex;flex-direction:column}.playing header{width:100%;max-width:1400px;padding:10px 20px;flex-shrink:0}.playing main{width:100%;max-width:1400px;flex:1;min-height:0;padding:10px 20px 12px;display:flex;flex-direction:column}.playing #game{display:flex;flex-direction:column;flex:1;min-height:0}.playing .game-heading{gap:15px;flex-shrink:0}.playing .game-heading h1{font-size:28px;margin:0;letter-spacing:-1px}.playing #rulesSummary{font-size:11px;margin:0 0 5px}.playing #playArea{display:flex;flex-direction:column;flex:1;min-height:0}.playing .board-title{margin:5px 0 9px;flex-shrink:0}.playing .board{flex:1;min-height:120px}.playing footer,.playing #setupStatus{display:none}.playing #results{overflow:auto}.playing .rack-panel,.playing .turn-bar{flex-shrink:0}.playing .brand{font-size:18px}.playing .brand span{display:none}
@media(max-width:700px){.playing header{padding:7px 10px}.playing main{padding:8px 10px}.playing .game-heading h1{font-size:24px}.game-title{display:block}.game-title p{font-size:10px;margin:3px 0 0}.turn-clock{min-width:98px;gap:3px 7px;padding:5px 8px}.turn-clock strong{font-size:22px}.players{gap:5px}.player,.player.active{padding:7px;gap:4px;border-radius:8px}.player strong{font-size:11px}.player small{font-size:9px;line-height:1.4}.player-count{font-size:21px;min-width:24px}.player-count span{font-size:8px}.edit-badge{display:none}.table-tools #boardSummary{display:none}.table-tools{gap:4px}.table-tools button,.more-actions summary{font-size:12px;padding:8px 10px}.board{gap:16px;padding:12px 9px;border-width:3px;border-radius:11px}.tile{width:46px;min-width:46px;height:64px;font-size:30px}.set{gap:4px;padding:25px 6px 7px}.set.invalid{padding:24px 5px 6px}.new-drop{min-width:110px;min-height:100px;font-size:11px;padding:12px}.new-drop.empty{min-height:125px}.rack-panel{padding:9px;margin-top:10px}.rack-heading{margin-bottom:7px;align-items:flex-start}.rack-heading h2{font-size:14px}.rack-heading>div:first-child{display:block}.opening-progress{display:block;font-size:10px;margin-top:5px}.rack-tools{gap:4px}.rack-tools #selectionInfo{display:none}.rack{max-height:145px;gap:7px}.turn-bar{gap:7px;padding:9px 0 2px}.turn-bar button{min-width:83px;min-height:48px;padding:9px}.turn-feedback #status{font-size:11px}#timerWarning{font-size:10px}.instruction{font-size:10px;line-height:1.4}.playing #rulesSummary{font-size:10px}.header-menu>div{min-width:160px}}@media(max-height:650px){.playing .brand{font-size:16px}.playing .players{margin:6px 0}.playing .player small{display:none}.playing .rack{max-height:79px;flex-wrap:nowrap;overflow-x:auto}.playing .instruction{display:none}.playing #rulesSummary{display:none}.playing .rack-panel{margin-top:8px}.playing .game-heading h1{font-size:22px}.playing .game-title p{display:none}}

@media(pointer:coarse){.set{padding-top:44px}.set.invalid{padding-top:43px}.set-grip{min-height:44px;font-size:12px}}

/* Clear card faces: four suit identities, two high-contrast inks. */
.card-tile{width:54px;min-width:54px;height:86px;display:flex;flex-direction:column;justify-content:space-between;padding:5px 3px 4px;gap:1px;background:linear-gradient(125deg,#fffefb,#f5efdf);font-variant-numeric:lining-nums tabular-nums}
.card-tile.red{color:#b01d30}.card-tile.black{color:#171c21}.card-tile .suit-symbol{display:block;font-family:Arial,"DejaVu Sans",sans-serif;font-size:26px;line-height:27px;min-height:27px;font-weight:700}.card-tile .tile-number{display:block;font-size:38px;line-height:41px;letter-spacing:-1px;font-weight:800}.card-tile.joker{padding:4px 3px;color:#20242a}.clown-face{display:block;width:47px;height:57px;flex:1;min-height:0}.card-tile .represented{position:static;display:block;font-size:16px;line-height:19px;letter-spacing:0;font-weight:800}.card-tile .represented.red{color:#b01d30}.card-tile .represented.black{color:#171c21}.joker-label{font-size:10px;line-height:13px;letter-spacing:1px}.rack{min-height:98px;max-height:196px}.new-drop{min-height:120px}.hero-tiles .card-tile{height:108px;padding:8px 3px}.hero-tiles .suit-symbol{font-size:29px;line-height:34px}.hero-tiles .tile-number{font-size:47px;line-height:49px}.hero-tiles .card-tile:nth-child(4){transform:rotate(9deg) translateY(-6px)}
@media(max-width:700px){.card-tile{width:48px;min-width:48px;height:78px;padding:4px 2px}.card-tile .suit-symbol{font-size:24px;line-height:25px;min-height:25px}.card-tile .tile-number{font-size:34px;line-height:37px}.clown-face{width:42px;height:52px}.rack{min-height:89px;max-height:180px}.new-drop{min-height:112px}.hero-tiles .card-tile{height:88px}.hero-tiles .suit-symbol{font-size:25px;line-height:29px}.hero-tiles .tile-number{font-size:36px;line-height:39px}}
@media(max-height:700px){.playing .rack{min-height:0;max-height:98px;flex-wrap:nowrap}.playing .instruction{display:none}}
@media(max-height:560px){.playing{height:auto;min-height:100dvh;overflow:auto;display:block}.playing main,.playing #game,.playing #playArea{display:block}.playing .board{height:40vh;min-height:140px;max-height:260px}.playing .turn-bar{position:sticky;bottom:0;z-index:10;background:var(--paper);padding:8px 0}.playing .rack{max-height:98px}}
/* release 90 */
.table-tools button{white-space:nowrap}
.player .drop-wait{display:block;color:#8a5a12}
.player .drop-player{margin-top:6px;padding:7px 10px;min-height:36px;border:1px solid var(--gold);border-radius:9px;background:#fff7e0;font:inherit;font-size:13px;font-weight:700}
@media(max-width:700px){
  .board-title h2{font-size:16px}.board-title .edit-badge{display:none}
  .table-tools button{padding:8px 9px;font-size:12px}
  /* smaller tiles on the table so that two sets fit side by side and more of the table is visible */
  #board .tile{width:38px;min-width:38px;height:62px;padding:3px 1px 2px}
  #board .tile .suit-symbol{font-size:17px;line-height:18px;min-height:18px}
  #board .tile .tile-number{font-size:27px;line-height:30px}
  #board .tile .clown-face{width:30px;height:30px}
  #board .tile .represented{font-size:12px}
  #board .set{padding:23px 5px 6px;gap:3px}
  .board{gap:10px;padding:10px 7px}
  .new-drop{min-height:70px;min-width:110px;font-size:12px}
}
.resume-row{margin-top:10px}.resume-row:has(#resume[hidden]){display:none}
/* release 91 — phones: the whole hand is always visible. It wraps onto as many rows as it needs and never scrolls
   inside itself (a swipe on a tile is a drag, so an inner scroll bar could not be reached). The page itself scrolls
   when the hand is large, and the action bar stays at the bottom of the screen. */
@media(max-width:700px),(max-height:700px) and (pointer:coarse){
  .playing{height:auto;min-height:100dvh;overflow:visible}
  .playing main,.playing #game,.playing #playArea{display:flex}
  .playing .board{flex:0 0 auto;height:32dvh;min-height:160px;max-height:330px}
  .playing .rack{flex-wrap:wrap;overflow:visible;max-height:none;min-height:70px;gap:5px;padding:4px 0}
  #rack .tile{width:40px;min-width:40px;height:64px;padding:3px 1px 2px}
  #rack .tile .suit-symbol{font-size:18px;line-height:19px;min-height:19px}
  #rack .tile .tile-number{font-size:28px;line-height:31px}
  #rack .tile .clown-face{width:31px;height:31px}
  .playing .turn-bar{position:sticky;bottom:0;z-index:10;background:var(--paper);padding:8px 0;margin-top:8px}
}
/* release 92 */
/* sort switch: the mode in use is dark and bold; the other one is pale. Pressing a mode switches to it. */
.sort-switch{border-color:var(--ink);background:#f1ead9}
.sort-switch button{background:#f1ead9;color:#4d5f58;font-weight:600;padding:8px 13px;min-height:38px}
.sort-switch button[aria-pressed=true]{background:var(--ink);color:#fff;font-weight:800}
.sort-switch button:disabled{opacity:.55}
/* your turn: the action bar lights up and "draw" is the highlighted action until a valid move is on the table */
.turn-bar.my-turn{border-top:3px solid var(--gold);padding-top:9px}
.turn-bar.my-turn #status{font-weight:800}
#draw.call{background:var(--gold);border-color:#a67c1e;color:#1c2a25;font-weight:800;box-shadow:0 0 0 0 rgba(201,154,46,.7);animation:draw-call 1.4s ease-out 3}
@keyframes draw-call{0%{box-shadow:0 0 0 0 rgba(201,154,46,.75)}100%{box-shadow:0 0 0 14px rgba(201,154,46,0)}}
@media(prefers-reduced-motion:reduce){#draw.call{animation:none}}
/* phones: the title row with the turn clock stays at the top of the screen while the page scrolls */
@media(max-width:700px),(max-height:700px) and (pointer:coarse){
  .playing .game-heading{position:sticky;top:0;z-index:30;background:var(--paper);padding:6px 0;box-shadow:0 6px 8px -8px rgba(0,0,0,.35)}
}
/* release 93 */
.name-row{display:flex;gap:8px;align-items:flex-end}.name-row label{flex:1;min-width:0}.name-row .gender{width:auto;min-width:68px;flex:0 0 auto}
.sound-toggle{min-width:42px;min-height:38px;padding:6px 9px;border:1px solid var(--ink);border-radius:9px;background:#f1ead9;color:#4d5f58;font-size:18px;line-height:1}
.sound-toggle[aria-pressed=true]{background:var(--ink);color:#fff}
/* release 97 — everything on the table shrinks together when it would otherwise need scrolling (see fitBoard) */
#board>*{zoom:var(--fit,1)}
/* phones: before shrinking, the table first grows to as much as half the screen height */
@media(max-width:700px),(max-height:700px) and (pointer:coarse){
  .playing .board{height:min(max(32dvh,min(var(--need,0px),50dvh)),var(--cap,100dvh));max-height:none}
}
/* release 98 — second tile design: a large number in one of four colours with a matching dot, like classic tiles */
.tile-style{display:block;margin:12px 0}
.color-tile{justify-content:center;gap:4px}
.color-tile.c-red,.represented.c-red{color:#c4161c}
.color-tile.c-orange,.represented.c-orange{color:#e98300}
.color-tile.c-blue,.represented.c-blue{color:#1657c9}
.color-tile.c-black,.represented.c-black{color:#15191d}

.color-tile .color-dot{display:block;width:11px;height:11px;border-radius:50%;background:currentColor;margin:0 auto;flex:0 0 auto}
#board .color-tile .color-dot,#rack .color-tile .color-dot{width:9px;height:9px}

/* release 99: a set that is not valid yet is ringed in blinking red */
#board .set.invalid{border-color:#ff5a4d;border-style:solid;background:#8f1f1438;animation:bad-set 1s ease-in-out infinite}
#board .set.invalid .set-grip{color:#ffd2c9;font-weight:700}
@keyframes bad-set{0%,100%{box-shadow:0 0 0 3px #ff3b30,0 0 14px 4px #ff3b30aa}50%{box-shadow:0 0 0 3px #ff3b3026,0 0 0 0 #ff3b3000}}
@media(prefers-reduced-motion:reduce){#board .set.invalid{animation:none;box-shadow:0 0 0 3px #ff3b30}}

/* release 100: after the game the table and the remaining hand stay visible, read-only */
#game.finished .table-tools button,#game.finished .turn-bar,#game.finished .new-drop,#game.finished .rack-tools,#game.finished #openingProgress,#game.finished #selectionInfo,#game.finished #clearSelection{display:none!important}
#game.finished #board .set,#game.finished #rack{pointer-events:none}
#game.finished #results{margin:10px 0 14px}
#game.finished .instruction{display:none}

/* release 101: tiles added during this turn are marked, for the player and for everyone watching */
#board .tile.fresh{box-shadow:0 0 0 2px #f0c45d,0 2px 5px #0006}
/* the drop zone is a slim strip once the table has sets, so it does not push the table into scrolling */
#board .new-drop:not(.empty){min-height:56px;min-width:96px;max-width:150px;padding:6px 10px;font-size:11px;line-height:1.35}
/* touch screens reserve the outer edges for system gestures (back, home): keep tiles clear of them */
@media(pointer:coarse){
  html,body{overscroll-behavior-x:none}
  .playing #rack{padding-inline:22px}
  .playing #board{padding-inline:22px}
  .playing main{padding-bottom:max(34px,env(safe-area-inset-bottom))}
}
/* short desktop windows (laptops): give the height to the table rather than to the frame around it */
@media(max-height:820px) and (pointer:fine) and (min-width:701px){
  body.playing>header{padding-block:3px}
  .playing main{padding-top:4px;padding-bottom:6px}
  .playing .players{margin:3px 0}.playing .player{padding:3px 11px}
  .playing .board-title{margin:2px 0 4px}
  .playing #board{padding:10px 14px}
  .playing .rack-panel{padding:6px 12px;margin-top:6px}.playing .rack-heading{margin-bottom:4px}
  .playing #rack{min-height:64px}
  .playing #rack .tile{width:42px;min-width:42px;height:60px;padding:3px 1px 2px}
  .playing #rack .tile .suit-symbol{font-size:16px;line-height:17px;min-height:17px}
  .playing #rack .tile .tile-number{font-size:27px;line-height:29px}
  .playing #rack .tile .clown-face{width:30px;height:30px}
  .playing .turn-bar{padding:4px 0 2px}
}

/* release 104: the hand is drawn smaller when it would not fit in view */
#rack>*{zoom:var(--rack-fit,1)}

/* ===== release 106: one layout for every screen =====
   The game always fills the visible window exactly (no page scrolling, upright or sideways). The table takes the
   height that the frame, the hand and the buttons leave; app.js then sizes the tiles of the hand and of the table. */
body.playing{height:100dvh!important;min-height:0!important;overflow:hidden!important;display:flex!important;flex-direction:column}
body.playing main,body.playing #game,body.playing #playArea{display:flex!important;flex-direction:column;flex:1 1 0;min-height:0;min-width:0}
body.playing #playArea[hidden],body.playing #game[hidden]{display:none!important}
body.playing main{padding-bottom:max(6px,env(safe-area-inset-bottom))!important}
body.playing .game-heading{position:static!important;box-shadow:none!important;flex-shrink:0}
body.playing .players,body.playing .board-title,body.playing .rack-panel,body.playing .turn-bar,body.playing #lobby{flex-shrink:0}
body.playing .board{flex:1 1 0!important;height:auto!important;min-height:0!important;max-height:none!important;overflow:auto}
body.playing .rack{flex-wrap:wrap!important;overflow:hidden!important;max-height:none!important;align-content:flex-start}
body.playing .turn-bar{position:static!important;margin-top:4px}
body.playing #rulesSummary{display:none!important}
body.playing #results{flex-shrink:1;max-height:42%;overflow:auto}
.turn-clock>span:first-child{max-width:9.5em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:700}
@media(max-height:900px){body.playing .instruction{display:none!important}}
/* phones upright: the frame is cut to the bone — the clock and the menu button share the top line with ☰ */
@media(max-width:700px) and (orientation:portrait){
  body.playing>header{padding:3px 8px!important;min-height:46px;justify-content:flex-end}
  body.playing>header .brand,body.playing>header nav>a{display:none}
  body.playing main{padding-top:2px!important}
  body.playing .game-heading{position:fixed!important;top:3px;inset-inline-start:8px;z-index:40;padding:0!important;gap:8px;background:none}
  body.playing .game-title{display:none}
  body.playing .turn-clock{padding:3px 9px}
  body.playing #exit{padding:6px 12px;min-height:38px}
  body.playing .players{margin:2px 0 3px!important;gap:5px}
  body.playing .player{padding:2px 8px!important}
  body.playing .board-title{margin:0 0 3px!important}
  body.playing .board-title h2,body.playing .rack-heading h2{font-size:14px;margin:0}
  body.playing .table-tools button{min-height:34px;padding-block:3px}
  body.playing .rack-panel{margin-top:4px!important;padding:4px 6px!important}
  body.playing .rack-heading{margin-bottom:3px!important}
  body.playing .rack-tools button,body.playing .sort-switch button{min-height:34px}
  body.playing .turn-bar{padding:3px 0!important;margin-top:3px!important}
  body.playing #rack{padding-inline:12px!important;gap:4px}
  body.playing #board{padding:8px 12px!important}
}
/* tablets and laptops that are wide but not tall */
@media(max-height:860px) and (min-width:701px) and (min-height:561px){
  body.playing>header{padding-block:3px!important}
  body.playing main{padding-top:4px!important}
  body.playing .game-heading h1{font-size:20px}
  body.playing .players{margin:3px 0!important}
  body.playing .player{padding:3px 11px!important}
  body.playing .board-title{margin:2px 0 4px!important}
  body.playing .rack-panel{padding:6px 12px!important;margin-top:6px!important}
  body.playing .rack-heading{margin-bottom:4px!important}
  body.playing .turn-bar{padding:4px 0 2px!important}
}
/* a phone held sideways: the table on one side, the hand and the buttons on the other */
@media(orientation:landscape) and (max-height:560px){
  body.playing>header{display:none!important}
  body.playing main{padding:3px 8px!important;max-width:none}
  body.playing #game{display:grid!important;grid-template-columns:auto minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);column-gap:10px;row-gap:3px}
  body.playing .game-heading{grid-column:1;grid-row:1;padding:0!important;gap:8px}
  body.playing .game-title{display:none}
  body.playing .players{grid-column:2;grid-row:1;margin:0!important;display:flex;gap:6px;min-width:0}
  body.playing .player{padding:2px 9px!important;min-width:0;flex:1 1 0}
  body.playing #lobby,body.playing #results,body.playing #playArea{grid-column:1/-1}
  body.playing #playArea{display:grid!important;grid-template-columns:minmax(0,1fr) var(--side,clamp(236px,37vw,360px));grid-template-rows:auto minmax(0,1fr) auto;column-gap:8px;grid-row:2}
  body.playing .board-title{grid-column:1;grid-row:1;margin:0 0 2px!important}
  body.playing .board-title h2,body.playing .rack-heading h2{font-size:13px;margin:0}
  body.playing .board{grid-column:1;grid-row:2/4}
  body.playing .rack-panel{grid-column:2;grid-row:1/3;margin:0!important;padding:4px 6px!important;display:flex;flex-direction:column;min-height:0}
  body.playing .rack-heading{margin-bottom:3px!important;flex-shrink:0}
  body.playing #rack{flex:1 1 0;min-height:0!important;padding-inline:4px!important}
  body.playing #board{padding:6px 12px!important}
  body.playing .turn-bar{grid-column:2;grid-row:3;margin:2px 0 0!important;padding:2px 0!important;gap:4px}
  body.playing .turn-feedback p{font-size:11px;line-height:1.25;margin:0;max-height:2.5em;overflow:hidden}
  body.playing .turn-clock{padding:2px 8px}
  body.playing .turn-clock strong{font-size:18px}
  body.playing #exit{padding:4px 10px;min-height:0}
  body.playing .table-tools button,body.playing .turn-bar button{min-height:34px;padding-block:4px}
}

/* release 107: the game clock and the host's pause button */
.game-time{display:flex;align-items:center;gap:7px;padding:4px 6px 4px 10px;border:1px solid #cbd9ce;border-radius:12px;background:#f4f1e6;direction:rtl;white-space:nowrap}
.game-time[hidden]{display:none}
.game-time>span{font-size:11px;color:#56635a}
.game-time strong{font-size:17px;font-variant-numeric:tabular-nums}
.game-time button{min-width:36px;min-height:34px;padding:2px 8px;border-radius:9px;border:1px solid #9fb3a5;background:#fff;font-size:15px;line-height:1;cursor:pointer}
.game-time.held{background:#fff0cc;border-color:#be8121}
.game-time.held button{background:#173d32;color:#fff;border-color:#173d32}
.duration{margin:2px 0 10px;font-weight:700;color:#3d4a41}
@media(max-width:700px) and (orientation:portrait){
  .game-time{padding:2px 3px 2px 7px;gap:5px}.game-time>span{display:none}.game-time strong{font-size:15px}
  body.playing #exit{padding:6px 9px}
  body.playing .turn-clock{min-width:86px}
}
@media(orientation:landscape) and (max-height:560px){.game-time{padding:1px 3px 1px 7px}.game-time>span{display:none}.game-time strong{font-size:15px}.game-time button{min-height:30px}}

/* ===== release 110: Remi Etalat — the discard row, the Atu, tiles that stay where they were laid ===== */
.variant-help{margin:10px 0 2px;padding:9px 12px;border-inline-start:4px solid #c7a668;background:#f7f1df;border-radius:8px;font-size:14px;line-height:1.5;color:#3d4a41}
.row-panel{display:flex;align-items:center;gap:8px;margin-top:6px;padding:4px 10px;border:1px solid #d6ccb2;border-radius:12px;background:#efe8d6;flex-shrink:0;min-height:52px}
.row-panel[hidden]{display:none}
.row-label{font-size:12px;font-weight:700;color:#5d5437;white-space:nowrap}
.row-tiles{flex:1 1 auto;min-width:0;display:flex;align-items:center;gap:3px;overflow-x:auto;padding:2px 0;scrollbar-width:thin}
/* pushes the row against the discard slot; physical sides, because a tile is always laid out left-to-right itself */
html[dir=rtl] .row-panel .row-tiles>.tile.row-tile:first-child{margin-right:auto}
html:not([dir=rtl]) .row-panel .row-tiles>.tile.row-tile:first-child{margin-left:auto}
.row-panel .tile.row-tile{width:28px;min-width:28px;height:42px;padding:2px 0 1px;font-size:17px;border-radius:6px;box-shadow:0 1px 2px #0004;cursor:pointer;flex:0 0 auto}
.row-panel .tile.row-tile .tile-number{font-size:19px;line-height:21px}
.row-panel .tile.row-tile .suit-symbol{font-size:11px;line-height:12px;min-height:12px}
.row-panel .tile.row-tile .color-dot{width:5px;height:5px}
.row-panel .tile.row-tile .clown-face{width:20px;height:20px}
.row-panel .tile.row-tile .joker-label,.row-panel .tile.row-tile .represented{display:none}
.row-panel .tile.row-tile:disabled{opacity:1;cursor:default}
.row-panel .tile.row-tile.first{transform:rotate(90deg);margin-inline:7px;opacity:.75}
.row-panel .tile.row-tile.going{outline:3px solid #be8121;outline-offset:1px;transform:translateY(-3px)}
.row-panel .tile.row-tile:not(:disabled):not(.first):hover{outline:2px solid #173d32}
.discard-slot{flex:0 0 auto;min-width:64px;min-height:44px;display:grid;place-items:center;padding:1px 6px;border:2px dashed #a49670;border-radius:9px;background:#fbf6e6;cursor:pointer}
.discard-slot .slot-text{font-size:11px;line-height:1.2;text-align:center;color:#6b5f3c;max-width:64px}
.discard-slot.wanted{border-color:#be8121;background:#fff1cf;animation:slot-call 1.3s ease-in-out infinite}
.discard-slot.filled{border-style:solid;border-color:#173d32;background:#e7f1e9}
.discard-slot.drop-active{border-color:#173d32;background:#dcebdf;animation:none}
@keyframes slot-call{0%,100%{box-shadow:0 0 0 0 #be812100}50%{box-shadow:0 0 0 4px #be812155}}
.atu-box{flex:0 0 auto;display:flex;align-items:center;gap:5px;padding:1px 7px;border-inline-start:1px solid #cdbf9c}
.atu-box[hidden]{display:none}
.atu-box>span:first-child{font-size:11px;font-weight:700;color:#5d5437}
#atuTile{display:flex;align-items:center;gap:4px}
.atu-holder{font-size:11px;color:#8a5a0a;max-width:6.5em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#rack .tile.taken{box-shadow:0 0 0 2px #be8121,0 2px 5px #0005}
body.remi #board .tile.fixed{cursor:default}
body.remi #board .set .tile.fixed:not(.joker){filter:saturate(.92)}
@media(prefers-reduced-motion:reduce){.discard-slot.wanted{animation:none}}
@media(max-width:700px){
  .row-panel{gap:5px;padding:3px 6px;min-height:46px;margin-top:4px}.row-label{display:none}
  .row-panel .tile.row-tile{width:24px;min-width:24px;height:36px}.row-panel .tile.row-tile .tile-number{font-size:16px;line-height:18px}
  .discard-slot{min-width:54px;min-height:38px}.atu-box{padding:0 4px}.atu-holder{display:none}
}
@media(orientation:landscape) and (max-height:560px){
  body.playing.remi .board{grid-row:2/3!important}
  body.playing .row-panel{grid-column:1;grid-row:3;margin-top:3px;min-height:42px;padding:2px 6px}
  .row-label{display:none}
  .row-panel .tile.row-tile{width:23px;min-width:23px;height:34px}.row-panel .tile.row-tile .tile-number{font-size:15px;line-height:17px}
  .discard-slot{min-height:36px}.atu-holder{display:none}
  body.playing.remi .turn-bar{flex-wrap:wrap;row-gap:2px}
  body.playing.remi .turn-bar .turn-feedback{flex:1 0 100%}
  body.playing.remi .turn-bar .turn-feedback #status,body.playing.remi .turn-bar .turn-feedback p{font-size:11px;line-height:1.25;min-height:0;max-height:2.5em}
  body.playing.remi .turn-bar .actions{flex:1;justify-content:flex-end}
}

/* release 111 — house rummy: only the newest discard can be taken, the earlier ones are shown dimmed */
.row-panel .tile.row-tile.past,.row-panel .tile.row-tile.past:disabled{opacity:.5}
/* The game is over: the no-scroll play layout is dropped, so the results and the whole final table can be read by scrolling. */
body.playing.ended{height:auto!important;min-height:100dvh!important;overflow:auto!important;display:block!important}
body.playing.ended main,body.playing.ended #game,body.playing.ended #playArea{display:block!important}
body.playing.ended #board{min-height:150px;max-height:none!important;height:auto!important;overflow:visible!important}
body.playing.ended .row-panel,body.playing.ended .rack-panel{margin-top:8px}
/* release 112 — the computer's move, tile by tile: the tile about to move is ringed, then slides to its new set */
#board .tile.bot-pick{outline:4px solid #ffcf4a;outline-offset:1px;box-shadow:0 0 0 3px #1b1b1b55,0 6px 14px #0008;position:relative;z-index:6;animation:bot-pick .5s ease-in-out infinite alternate}
#board .tile.bot-pick.bot-land{animation:none}
@keyframes bot-pick{from{filter:brightness(1)}to{filter:brightness(1.18)}}
body.bot-show #board .set.invalid{animation:none;border-style:dashed;border-color:#ffcf4a99;background:transparent}
body.bot-show #board .set{overflow:visible}
@media(prefers-reduced-motion:reduce){#board .tile.bot-pick{animation:none}}
