:root { --cw: clamp(46px, 9.5vw, 76px); --felt: #0e5a3a; --felt2: #093f2b; --gold: #f2c14e; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: #073524; color: #f4f1e8; }
#app { height: 100%; overflow: auto; }

button { font: inherit; padding: .6em 1.1em; border-radius: 10px; border: 1px solid #ffffff40; background: #ffffff18; color: inherit; cursor: pointer; }
button:hover:not(:disabled) { background: #ffffff30; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--gold); color: #2a1d00; border-color: var(--gold); font-weight: 600; }
button.small { padding: .25em .7em; font-size: .85rem; }
input { font: inherit; padding: .6em .8em; border-radius: 10px; border: 1px solid #ffffff40; background: #00000030; color: inherit; width: 100%; }
input::placeholder { color: #ffffff80; }

/* лобби */
.lobby { max-width: 460px; margin: 0 auto; padding: 24px 16px; display: flex; flex-direction: column; gap: 14px; }
.lobby h1 { margin: 0; text-align: center; }
.lobby label { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.code { letter-spacing: .2em; color: var(--gold); }
.muted { opacity: .7; margin: 0; }
.players { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.players li { padding: 10px; background: #ffffff14; border-radius: 10px; }
.room { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; background: #ffffff14; border-radius: 10px; margin-bottom: 6px; }
.center { text-align: center; padding: 40px; }

/* стол */
.game { height: 100%; display: flex; flex-direction: column; background: radial-gradient(ellipse at center, var(--felt) 0, var(--felt2) 100%); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; font-size: .9rem; background: #0006; }
.table { position: relative; flex: 1; min-height: 190px; }
.seat { position: absolute; text-align: center; padding: 6px 12px; border-radius: 12px; background: #0004; border: 2px solid transparent; min-width: 90px; }
.seat.active { border-color: var(--gold); }
.seat.top { top: 8px; left: 50%; transform: translateX(-50%); }
.seat.left { left: 8px; top: 50%; transform: translateY(-50%); }
.seat.right { right: 8px; top: 50%; transform: translateY(-50%); }
.pname { font-weight: 600; }
.pinfo { font-size: .8rem; opacity: .8; font-weight: 400; }
.red { color: #ff6b6b; }

/* карты */
.card { position: relative; width: var(--cw); height: calc(var(--cw) * 1.42); background: #fffdf6; color: #1b1b1b; border-radius: 7px; border: 1px solid #0003; box-shadow: 0 2px 6px #0006; flex: none; user-select: none; }
.card.red { color: #c4161c; }
.card .tl { position: absolute; top: 3px; left: 5px; font-size: calc(var(--cw) * .28); line-height: 1.05; font-weight: 700; text-align: center; }
.card .mid { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: calc(var(--cw) * .6); opacity: .9; }
.card.back { background: repeating-linear-gradient(45deg, #1f4e9c 0 6px, #2a63bd 6px 12px); border: 3px solid #fffdf6; }
.card.mini { width: calc(var(--cw) * .55); height: calc(var(--cw) * .78); margin: 4px auto 0; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }

.trick { position: absolute; left: 50%; top: 50%; width: calc(var(--cw) * 3); height: calc(var(--cw) * 3); transform: translate(-50%, -50%); }
.tcard { position: absolute; }
.tcard.bottom { bottom: 0; left: 50%; transform: translateX(-50%); }
.tcard.top { top: 0; left: 50%; transform: translateX(-50%); }
.tcard.left { left: 0; top: 50%; transform: translateY(-50%); }
.tcard.right { right: 0; top: 50%; transform: translateY(-50%); }
.tcard.win .card { outline: 3px solid var(--gold); }
.status { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); padding: 4px 14px; border-radius: 20px; background: #0008; white-space: nowrap; font-size: .95rem; }

/* рука */
.mine { padding: 6px 8px 14px; text-align: center; background: #0005; border-top: 3px solid transparent; }
.mine.active { border-top-color: var(--gold); }
.mine button { margin: 6px 0; }
.hand { display: flex; justify-content: center; padding-top: 22px; }
.hand .card { margin-left: calc(var(--cw) * -.45); cursor: pointer; transition: transform .12s; }
.hand .card:first-child { margin-left: 0; }
.hand .card:hover { transform: translateY(-8px); }
.hand .card.sel { transform: translateY(-18px); outline: 3px solid var(--gold); }
.hand .card.dim { filter: brightness(.55); cursor: not-allowed; }
.hand .card.dim:hover { transform: none; }
.hand .card.new { box-shadow: 0 0 0 3px #6cf, 0 2px 6px #0006; }

/* окна */
.overlay { position: fixed; inset: 0; background: #000a; display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 5; }
.modal { background: #14261d; border: 1px solid #fff3; border-radius: 16px; padding: 20px; max-width: 560px; width: 100%; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.modal h2, .modal p { margin: 0; }
.modal table { width: 100%; border-collapse: collapse; }
.modal th, .modal td { padding: 6px; border-bottom: 1px solid #fff2; }
.win-text { color: var(--gold); font-weight: 700; font-size: 1.1rem; }
.toast { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); background: #000d; padding: 10px 16px; border-radius: 10px; z-index: 9; }
.err { color: #ff8a8a; }
