.dp-root {
    --th: clamp(26px, 9.6dvh, 38px);
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: radial-gradient(130% 120% at 50% 0%, #177a54 0%, #0d5238 55%, #093d2a 100%);
    color: #fff;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}
.dp-root.dp-st { height: 100vh; height: 100dvh; }
.dp-root * { box-sizing: border-box; }

.dp-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px; text-align: center; }
.dp-logo { font-size: 44px; font-weight: 800; color: #f3c75c; text-shadow: 0 2px 12px rgba(0,0,0,.45); }
.dp-logo.dp-sm { font-size: 30px; }
.dp-sub { font-size: 15px; opacity: .9; }
.dp-hi { font-size: 22px; font-weight: 700; }
.dp-note { font-size: 13px; opacity: .85; }
.dp-err { font-size: 14px; color: #ffb3a7; font-weight: 700; }
.dp-or { font-size: 13px; opacity: .7; }

.dp-input {
    width: min(260px, 80%);
    padding: 12px 14px;
    font-size: 17px;
    border-radius: 14px;
    border: 2px solid rgba(255,255,255,.25);
    background: rgba(0,0,0,.28);
    color: #fff;
    text-align: center;
    outline: none;
    font-family: inherit;
}
.dp-input:focus { border-color: #f3c75c; }
.dp-input.dp-code { letter-spacing: 8px; font-size: 22px; font-weight: 800; width: 170px; text-transform: uppercase; }

.dp-btn {
    padding: 13px 26px;
    font-size: 17px;
    font-weight: 800;
    font-family: inherit;
    border: none;
    border-radius: 14px;
    background: rgba(255,255,255,.14);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,.3);
}
.dp-btn:active { transform: translateY(1px); }
.dp-btn:disabled { opacity: .4; }
.dp-btn.dp-gold { background: linear-gradient(180deg, #f6cf6b, #e0a93c); color: #3a2a08; }
.dp-btn.dp-sm2 { padding: 9px 16px; font-size: 14px; border-radius: 11px; }
.dp-btn.dp-danger { background: #a33226; }
.dp-btn.dp-danger.armed { background: #d84f3c; animation: dp-pulse 1s infinite; }
@keyframes dp-pulse { 50% { transform: scale(1.05); } }

.dp-bigcode {
    font-size: 52px; font-weight: 900; letter-spacing: 14px; color: #f3c75c;
    background: rgba(0,0,0,.3); padding: 10px 18px 10px 32px; border-radius: 18px;
    border: 2px dashed rgba(243,199,92,.6);
}
.dp-lobbylist { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.dp-lobbyname { background: rgba(255,255,255,.14); border-radius: 999px; padding: 6px 14px; font-size: 14px; font-weight: 700; }

.dp-room { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.dp-topbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: rgba(0,0,0,.28); }
.dp-codebox { font-size: 13px; white-space: nowrap; }
.dp-codebox b { color: #f3c75c; font-size: 16px; letter-spacing: 3px; }
.dp-players { flex: 1; display: flex; gap: 6px; overflow-x: auto; padding: 2px; }
.dp-chip { display: flex; flex-direction: column; align-items: center; min-width: 64px; background: rgba(255,255,255,.1); border-radius: 10px; padding: 4px 8px; font-size: 11px; line-height: 1.35; }
.dp-chip.me { outline: 2px solid #f3c75c; }
.dp-chip.off { opacity: .45; }
.dp-cname { font-weight: 800; max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-cscore { color: #f3c75c; font-weight: 900; font-size: 13px; }
.dp-cnum { opacity: .75; }
.dp-topbtns { display: flex; gap: 6px; }
.dp-mini { padding: 7px 10px; font-size: 12px; font-weight: 700; font-family: inherit; border: none; border-radius: 9px; background: rgba(255,255,255,.16); color: #fff; cursor: pointer; }

.dp-game { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.dp-arena { flex: 1; display: grid; min-height: 0; grid-template-columns: auto 1fr auto; grid-template-rows: auto 1fr; grid-template-areas: "t t t" "l m r"; }
.dp-seatst { grid-area: t; display: flex; justify-content: center; padding: 2px 4px; min-height: 0; }
.dp-seatsl { grid-area: l; display: flex; align-items: center; padding: 0 2px 0 4px; min-height: 0; }
.dp-seatsr { grid-area: r; display: flex; align-items: center; padding: 0 4px 0 2px; min-height: 0; }
.dp-seat { display: flex; flex-direction: column; align-items: center; gap: 1px; background: rgba(0,0,0,.3); border-radius: 10px; padding: 4px 10px; font-size: 11px; line-height: 1.3; border: 1px solid rgba(255,255,255,.15); }
.dp-seat.off { opacity: .45; }
.dp-seat.t0 { border-color: #f3c75c; }
.dp-seat.t1 { border-color: #6db3f2; }
.dp-seatst .dp-seat { flex-direction: row; align-items: baseline; gap: 8px; padding: 3px 12px; }
.dp-sname { font-weight: 800; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-sscore { color: #f3c75c; font-weight: 900; font-size: 13px; }
.dp-seat.t1 .dp-sscore { color: #9cc8f7; }
.dp-snum { opacity: .75; }
.dp-passed { background: #d84f3c; color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 10px; font-weight: 800; }

.dp-table {
    grid-area: m; display: flex; align-items: center; justify-content: center;
    padding: 4px; min-height: 0; min-width: 0;
    background: radial-gradient(100% 140% at 50% 30%, rgba(255,255,255,.09), rgba(0,0,0,.18));
}
.dp-mid { display: flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; }
.dp-chain { flex: 0 1 auto; display: flex; align-items: center; gap: 3px; overflow-x: auto; padding: 10px 4px; min-width: 0; }
.dp-zone {
    min-width: 42px; height: calc(var(--th) * 2 + 12px); min-height: 42px; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
    border: 2px dashed rgba(255,255,255,.35); border-radius: 12px;
    font-size: 20px; font-weight: 900; color: rgba(255,255,255,.6);
    cursor: pointer; text-align: center; padding: 4px;
}
.dp-zone.armed { border-color: #f3c75c; color: #f3c75c; }
.dp-zone.hot { background: rgba(243,199,92,.25); border-color: #f3c75c; color: #fff; transform: scale(1.06); }

.dp-tile {
    display: flex; flex-direction: row; align-items: stretch;
    width: calc(var(--th) * 2); height: var(--th); flex: 0 0 auto;
    background: linear-gradient(180deg, #fbf6e9, #e9dfc6);
    border-radius: 7px; border: 1px solid #b7a97f;
    box-shadow: 0 2px 5px rgba(0,0,0,.4);
    padding: 3px; gap: 3px;
    cursor: pointer;
    touch-action: none;
}
.dp-tile.dp-v { flex-direction: column; width: var(--th); height: calc(var(--th) * 2); }
.dp-tile.sel { outline: 3px solid #f3c75c; transform: translateY(-9px); }
.dp-tile.away { opacity: .3; }
.dp-face { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 2px; }
.dp-pip { width: 62%; height: 62%; place-self: center; border-radius: 50%; }
.dp-pip.on { background: #2b2317; box-shadow: inset 0 1px 1px rgba(255,255,255,.25); }
.dp-div { background: #b7a97f; flex: 0 0 1px; }
.dp-tile.dp-v .dp-div { flex: 0 0 1px; }

.dp-rotate { display: none; }
@media (orientation: portrait) {
    .dp-rotate { display: block; text-align: center; font-size: 11px; opacity: .75; padding: 3px 6px 0; }
}

.dp-controls { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: rgba(0,0,0,.22); }
.dp-myscore { margin-inline-start: auto; font-size: 14px; font-weight: 800; color: #f3c75c; }

.dp-handwrap { padding: 8px 6px 12px; background: rgba(0,0,0,.3); }
.dp-hand { display: flex; gap: 6px; overflow-x: auto; padding: 12px 6px 4px; justify-content: safe center; }

.dp-ghost { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; will-change: transform; transform: translate(-200px, -200px); filter: drop-shadow(0 8px 10px rgba(0,0,0,.5)); }

.dp-toasts { position: absolute; top: 46px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 70; pointer-events: none; }
.dp-toast { background: rgba(20,16,8,.92); border: 1px solid rgba(243,199,92,.5); color: #ffe9b0; padding: 8px 16px; border-radius: 999px; font-size: 14px; font-weight: 700; animation: dp-tin .25s ease-out; }
@keyframes dp-tin { from { opacity: 0; transform: translateY(-8px); } }

.dp-result { font-size: 16px; color: #ffe9b0; font-weight: 700; }
.dp-totals { width: min(300px, 86%); display: flex; flex-direction: column; gap: 6px; }
.dp-trow { display: flex; justify-content: space-between; background: rgba(255,255,255,.1); border-radius: 10px; padding: 8px 14px; font-size: 14px; }
.dp-trow.win { background: rgba(243,199,92,.28); outline: 2px solid #f3c75c; font-weight: 900; }

.dp-teambar { flex: 1; display: flex; gap: 8px; justify-content: center; align-items: center; font-size: 11px; min-width: 0; overflow: hidden; padding: 0 4px; }
.dp-tm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 2px 10px; border-radius: 999px; background: rgba(0,0,0,.25); }
.dp-tm b { font-size: 13px; }
.dp-tm.t0 { color: #f3c75c; }
.dp-tm.t1 { color: #9cc8f7; }

.dp-over { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 0; overflow-y: auto; padding: 8px 12px; text-align: center; }
.dp-over .dp-hi { font-size: 18px; }
.dp-over .dp-result { font-size: 14px; }
.dp-reveal { display: flex; flex-direction: column; gap: 4px; width: min(540px, 98%); }
.dp-rrow { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.08); border-radius: 10px; padding: 4px 10px; font-size: 12px; }
.dp-rrow.win { background: rgba(243,199,92,.25); outline: 1px solid #f3c75c; }
.dp-rrow.t0 { border-inline-start: 3px solid #f3c75c; }
.dp-rrow.t1 { border-inline-start: 3px solid #6db3f2; }
.dp-rname { font-weight: 800; min-width: 52px; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start; }
.dp-rhand { --th: 15px; flex: 1; display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; }
.dp-rhand .dp-tile { border-radius: 3px; padding: 1px; gap: 1px; box-shadow: none; }
.dp-rempty { opacity: .8; font-size: 11px; }
.dp-rtotal { font-weight: 900; color: #f3c75c; min-width: 24px; text-align: center; }

@media (max-height: 420px) {
    .dp-logo { font-size: 32px; }
    .dp-center { gap: 9px; padding: 12px; }
    .dp-toasts { top: 40px; }
}

@media (max-height: 345px) {
    .dp-root { --th: clamp(24px, 9.2dvh, 34px); }
    .dp-topbar { padding: 3px 8px; gap: 6px; }
    .dp-chip { font-size: 10px; padding: 2px 6px; min-width: 54px; line-height: 1.25; }
    .dp-cscore { font-size: 11px; }
    .dp-codebox { font-size: 11px; }
    .dp-codebox b { font-size: 13px; }
    .dp-mini { padding: 5px 8px; font-size: 11px; }
    .dp-table { padding: 4px 6px; }
    .dp-chain { padding: 6px 4px; }
    .dp-zone { min-height: 42px; min-width: 38px; font-size: 16px; }
    .dp-controls { padding: 3px 8px; }
    .dp-btn.dp-sm2 { padding: 6px 12px; font-size: 12px; }
    .dp-myscore { font-size: 12px; }
    .dp-handwrap { padding: 3px 4px 5px; }
    .dp-hand { padding: 7px 4px 2px; gap: 5px; }
    .dp-toasts { top: 34px; }
    .dp-seat { font-size: 10px; padding: 3px 8px; }
    .dp-seatst .dp-seat { padding: 2px 10px; }
    .dp-sscore { font-size: 11px; }
    .dp-sname { max-width: 70px; }
    .dp-passed { font-size: 9px; padding: 0 6px; }
}
