/* Rummi: cream tiles on a green felt table */
:root { --felt: #0f3b2e; --felt2: #164a3a; --line: #2c6a54; --fg: #f4f1e8; --fg2: #b8d0c4; --hot: #ffb340; --ok: #6fe08a; --bad: #ff6a5a; --tile: #fdf6e3; --c0: #d6333a; --c1: #2a6fd6; --c2: #e08a10; --c3: #222; color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: radial-gradient(ellipse at center, #1a5a46, var(--felt) 70%); color: var(--fg); font: 15px/1.4 Nunito, "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif; -webkit-user-select: none; user-select: none; overflow: hidden; }
button, input { font: inherit; color: inherit; } button { cursor: pointer; }
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
.btn { background: rgba(0, 0, 0, .25); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; white-space: nowrap; }
.btn:hover { border-color: var(--hot); } .btn:disabled { opacity: .4; } .btn.hot { background: linear-gradient(90deg, #ffb340, #ff7a4a); border-color: transparent; color: #222; font-weight: 900; }
.big { padding: 12px 24px; border: 0; border-radius: 14px; background: linear-gradient(90deg, #ffb340, #ff7a4a); color: #222; font-weight: 900; font-size: 17px; }
.big.alt { background: linear-gradient(90deg, #5ec8ff, #6a8cff); } .big.alt2 { background: linear-gradient(90deg, #6fe08a, #3ab88a); }
.big:disabled { opacity: .4; }
.dim { color: var(--fg2); font-size: 13px; } .sp { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.ck { display: flex; align-items: center; gap: 6px; margin: 10px 0; } .ck small { color: var(--fg2); } .ck.sm { margin: 0; font-size: 18px; }

/* tiles */
.tile { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 52px; border-radius: 7px; background: linear-gradient(#fffbee, var(--tile) 60%, #e9dfc4); box-shadow: 0 2px 0 #b9ab88, 0 3px 6px rgba(0, 0, 0, .35); font: 900 24px Nunito, sans-serif; cursor: grab; touch-action: none; flex: none; transition: transform .12s; }
.tile b { pointer-events: none; } .tile.c0 { color: var(--c0); } .tile.c1 { color: var(--c1); } .tile.c2 { color: var(--c2); } .tile.c3 { color: var(--c3); }
.tile.joker { color: #c2185b; font-size: 26px; } .tile.joker::after { content: ''; position: absolute; inset: 3px; border-radius: 5px; border: 2px dashed rgba(194, 24, 91, .35); }
.tile.sel { transform: translateY(-8px); box-shadow: 0 0 0 3px var(--hot), 0 6px 10px rgba(0, 0, 0, .4); }
.tile.hinted { box-shadow: 0 0 0 3px var(--ok), 0 3px 6px rgba(0, 0, 0, .35); }
.tile.fresh::before { content: ''; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--hot); }
.tile.big { width: 54px; height: 74px; font-size: 34px; margin: 0 4px; cursor: default; }
.ghost { position: fixed; z-index: 100; pointer-events: none; display: flex; gap: 2px; opacity: .9; }

/* home */
.home { margin: auto; padding: 20px 16px; text-align: center; max-width: 560px; width: 100%; overflow-y: auto; }
.logo { margin: 8px 0; } .home h1 { margin: 6px 0 0; font-size: 54px; font-weight: 900; letter-spacing: .1em; } .home h2 { margin: 6px 0; }
.sub { margin: 0; letter-spacing: .4em; color: var(--fg2); } .tag { color: var(--fg2); }
.menu { display: grid; gap: 10px; margin: 18px auto; max-width: 340px; }
.card { background: rgba(0, 0, 0, .25); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; text-align: left; margin-top: 12px; }
.plist { list-style: none; padding: 0; margin: 6px 0; } .plist li { padding: 4px 0; }
.codeBig { font-size: 34px; letter-spacing: .25em; color: var(--hot); }
.code { width: 110px; text-transform: uppercase; letter-spacing: .2em; text-align: center; }
input { background: rgba(0, 0, 0, .3); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }

/* the game */
.game { display: flex; flex-direction: column; height: 100%; }
.top { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: rgba(0, 0, 0, .3); }
.players { display: flex; gap: 6px; flex: 1; overflow-x: auto; }
.pl { padding: 4px 10px; border-radius: 12px; background: rgba(0, 0, 0, .25); border: 2px solid transparent; white-space: nowrap; }
.pl b { display: block; font-size: 14px; } .pl small { color: var(--fg2); } .pl.on { border-color: var(--hot); background: rgba(255, 179, 64, .15); } .pl.me b { color: var(--hot); }
.pool { align-self: center; color: var(--fg2); font-weight: 800; white-space: nowrap; }
.tbarWrap { height: 4px; background: rgba(0, 0, 0, .3); } .tbarWrap i { display: block; height: 100%; width: 100%; background: var(--hot); transition: width .5s linear; }
.table { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 10px; }
.set { position: relative; display: flex; gap: 2px; padding: 8px; border-radius: 12px; background: rgba(0, 0, 0, .18); border: 2px solid rgba(255, 255, 255, .08); min-height: 70px; align-items: center; }
.set.ok { border-color: rgba(111, 224, 138, .5); } .set.bad { border-color: var(--bad); background: rgba(255, 80, 60, .12); }
.set.hover, .rack.hover { box-shadow: 0 0 0 3px var(--hot); }
.set .why { position: absolute; left: 8px; bottom: -11px; background: var(--bad); color: #fff; font-style: normal; font-size: 11px; padding: 1px 8px; border-radius: 999px; white-space: nowrap; z-index: 2; }
.newset { min-width: 140px; justify-content: center; color: var(--fg2); border-style: dashed; cursor: pointer; }
.coach { position: absolute; right: 10px; top: 70px; width: min(340px, calc(100vw - 20px)); background: rgba(10, 30, 24, .96); border: 1px solid var(--hot); border-radius: 14px; padding: 10px 14px; z-index: 20; box-shadow: 0 6px 20px rgba(0, 0, 0, .4); }
.coach .x, dialog .x { position: absolute; right: 8px; top: 4px; background: none; border: 0; font-size: 22px; color: var(--fg2); }
.coach ol { margin: 6px 0 8px; padding-left: 20px; } .coach p { margin: 6px 0; } .badmsg { color: #ffb0a6; font-weight: 800; }
.foot { background: rgba(0, 0, 0, .35); border-top: 1px solid var(--line); padding: 6px 8px calc(env(safe-area-inset-bottom, 0px) + 8px); }
.bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.st { font-weight: 900; } .st.on { color: var(--hot); }
.meld { padding: 2px 10px; border-radius: 999px; background: rgba(255, 106, 90, .25); font-weight: 800; font-size: 13px; } .meld.okk { background: rgba(111, 224, 138, .3); }
.rack { display: flex; flex-wrap: wrap; gap: 4px; min-height: 60px; padding: 8px; border-radius: 12px; background: linear-gradient(#6b4a2e, #4e3420); box-shadow: inset 0 3px 8px rgba(0, 0, 0, .4); }
.toast { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); background: rgba(0, 0, 0, .8); padding: 6px 16px; border-radius: 999px; z-index: 60; font-weight: 800; animation: fade 2.6s forwards; pointer-events: none; }
@keyframes fade { 80% { opacity: 1; } 100% { opacity: 0; } }

/* dialogs */
dialog { background: #14402f; color: var(--fg); border: 1px solid var(--line); border-radius: 18px; padding: 18px; width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
dialog::backdrop { background: rgba(0, 10, 6, .6); }
dialog h3 { margin: 0 0 10px; } dialog label { display: block; margin: 10px 0 4px; color: var(--fg2); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; } .cc { background: rgba(0, 0, 0, .25); border: 1px solid var(--line); border-radius: 18px; padding: 5px 12px; } .cc.on { background: var(--hot); color: #222; font-weight: 800; border-color: var(--hot); }
.rules { line-height: 1.7; } .lbtn { text-align: left; }
.res { width: 100%; border-collapse: collapse; margin-top: 8px; } .res th, .res td { padding: 6px; text-align: center; border-bottom: 1px solid var(--line); } .res tr.win td { color: var(--hot); font-weight: 900; }
@media (max-width: 600px) { .tile { width: 30px; height: 42px; font-size: 19px; border-radius: 6px; } .set { padding: 6px; min-height: 58px; } .bar .btn { padding: 5px 8px; font-size: 13px; } .home h1 { font-size: 42px; } }
