body {
    margin: 0;
    max-width: none;
    min-height: 100vh;
    padding: 0;
    font-family: "Pretendard", "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    color: #243447;
    background:
        radial-gradient(circle at 10% 8%, rgba(255, 226, 99, 0.32), transparent 24%),
        radial-gradient(circle at 88% 14%, rgba(117, 213, 255, 0.34), transparent 26%),
        radial-gradient(circle at 80% 86%, rgba(133, 232, 166, 0.28), transparent 26%),
        linear-gradient(135deg, #f7fcff 0%, #eff9ff 44%, #fff8e8 100%);
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(77, 171, 247, 0.14) 1.2px, transparent 1.2px);
    background-size: 28px 28px;
    opacity: .55;
    mask-image: linear-gradient(180deg, black, transparent 92%);
}

button,
input,
select {
    font: inherit;
}

.hidden {
    display: none !important;
}

.token-app {
    --bg: #f5fbff;
    --panel: rgba(255, 255, 255, 0.94);
    --panel-soft: rgba(255, 255, 255, 0.78);
    --ink: #243447;
    --muted: #6b7a90;
    --line: rgba(93, 134, 171, 0.18);
    --shadow: 0 14px 32px rgba(44, 92, 130, 0.12);
    --card-w: clamp(70px, 8.4vw, 104px);
    --card-h: calc(var(--card-w) * 1.43);
    min-height: 100vh;
    padding: 16px;
    display: flex;
    justify-content: center;
    align-items: stretch;
}

.token-shell {
    width: min(1460px, 100%);
    min-height: calc(100vh - 32px);
    border: 1px solid var(--line);
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.68);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
    backdrop-filter: blur(8px);
}

.token-topbar {
    min-height: 72px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.86);
}

.token-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.token-logo {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    color: white;
    font-size: 24px;
    font-weight: 1000;
    background: linear-gradient(135deg, #4dabf7, #51cf66);
    box-shadow: 0 8px 18px rgba(77, 171, 247, .24);
    flex: 0 0 auto;
}

.token-brand h1 {
    margin: 0;
    font-size: clamp(19px, 2vw, 26px);
    letter-spacing: -0.04em;
}

.token-brand p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.token-top-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.token-pill {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    padding: 9px 13px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 900;
    color: #2d4f68;
    box-shadow: 0 7px 16px rgba(44, 92, 130, .08);
}

.token-pill small {
    color: var(--muted);
    font-weight: 800;
}

.btn {
    border: 1px solid rgba(93, 134, 171, 0.16);
    border-radius: 16px;
    padding: 11px 16px;
    background: #ffffff;
    color: var(--ink);
    font-weight: 1000;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(44, 92, 130, 0.10);
    transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 22px rgba(44, 92, 130, 0.14);
}

.btn:active {
    transform: translateY(0);
    filter: brightness(0.98);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: .58;
    transform: none;
}

.btn.primary {
    background: linear-gradient(135deg, #339af0, #22b8cf);
    color: white;
    border-color: transparent;
}

.btn.warn {
    background: linear-gradient(135deg, #ffd43b, #ff922b);
    color: #513100;
    border-color: transparent;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

.start-screen {
    padding: clamp(18px, 4vw, 46px);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 430px);
    gap: clamp(18px, 4vw, 44px);
    align-items: start;
}

.lobby-panel {
    min-width: 0;
    display: grid;
    gap: 14px;
}

.student-card,
.lobby-card,
.setup-card,
.token-card-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.student-card {
    padding: 18px;
}

.student-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 13px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid var(--line);
    color: #2f80b7;
    font-weight: 1000;
    margin-bottom: 10px;
    box-shadow: 0 6px 14px rgba(44, 92, 130, .08);
}

.student-label {
    margin-top: 2px;
    font-size: clamp(22px, 2.8vw, 34px);
    line-height: 1.08;
    font-weight: 1000;
    letter-spacing: -0.04em;
}

.student-kpis {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.student-kpis div {
    border-radius: 18px;
    background: #f8fbff;
    border: 1px solid rgba(93, 134, 171, 0.12);
    padding: 12px;
}

.student-kpis span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.student-kpis strong {
    display: block;
    margin-top: 5px;
    font-size: 18px;
}

.lobby-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, .75fr);
    gap: 14px;
    align-items: start;
}

.lobby-card {
    padding: 16px;
}

.lobby-card h3 {
    margin: 0 0 5px;
    font-size: 17px;
    letter-spacing: -0.03em;
}

.lobby-card p {
    margin: 0 0 12px;
    color: var(--muted);
    line-height: 1.45;
    font-size: 13px;
}

.token-inline-actions,
.token-inline-code,
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.token-inline-actions select,
.token-inline-code input {
    min-height: 44px;
    border-radius: 15px;
    border: 1px solid var(--line);
    background: #fff;
    padding: 0 12px;
    color: var(--ink);
    font-weight: 900;
}

.token-inline-actions select {
    flex: 1 1 120px;
}

.token-inline-code input {
    flex: 1 1 160px;
    text-transform: uppercase;
    letter-spacing: .12em;
}

.token-global-status,
.room-inline-status {
    min-height: 20px;
    margin-top: 10px;
    color: #20895a;
    font-size: 13px;
    font-weight: 900;
}

.token-global-status.is-error,
.room-inline-status.is-error {
    color: #d9480f;
}

.lobby-list,
.compact-list {
    display: grid;
    gap: 8px;
}

.token-room-item,
.token-match-item,
.token-rank-item,
.active-room-card {
    min-width: 0;
    border-radius: 18px;
    background: #fff;
    border: 1px solid rgba(93, 134, 171, 0.13);
    padding: 11px 12px;
    box-shadow: 0 6px 14px rgba(44, 92, 130, .06);
}

.token-room-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.token-room-item b,
.token-match-item b,
.token-rank-item b {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.token-room-item span,
.token-match-item span,
.token-rank-item span,
.token-empty {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    line-height: 1.45;
}

.token-rank-item {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
}

.token-rank-item strong {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #e7f5ff;
    color: #1971c2;
}

.token-rank-item em {
    font-style: normal;
    font-weight: 1000;
    color: #2b8a3e;
}

.active-room-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(135deg, #ffffff, #f0f9ff);
}

.active-room-card b {
    display: block;
    font-size: 16px;
}

.active-room-card span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
}

.active-room-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.setup-card {
    padding: 22px;
    position: relative;
    overflow: hidden;
}

.setup-card::before {
    content: "";
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 999px;
    background: rgba(255, 212, 59, 0.23);
    top: -78px;
    right: -72px;
}

.setup-card h3 {
    margin: 0 0 6px;
    font-size: 23px;
    letter-spacing: -0.04em;
    position: relative;
}

.setup-card > p {
    margin: 0 0 20px;
    color: var(--muted);
    line-height: 1.5;
    position: relative;
}

.option-group {
    margin: 18px 0;
    position: relative;
}

.option-group label.title {
    display: block;
    font-weight: 1000;
    margin-bottom: 9px;
}

.segmented {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.segmented.two {
    grid-template-columns: repeat(2, 1fr);
}

.segmented button {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #ffffff;
    padding: 13px 8px;
    font-weight: 1000;
    cursor: pointer;
    color: #40566d;
}

.segmented button.selected {
    background: #339af0;
    color: white;
    border-color: transparent;
    box-shadow: 0 9px 18px rgba(51,154,240,0.20);
}

.card-preview-stack {
    margin: 22px 0 6px;
    height: 150px;
    position: relative;
    display: grid;
    place-items: center;
}

.mini-card {
    width: 82px;
    height: 116px;
    border-radius: 20px;
    position: absolute;
    background: white;
    box-shadow: 0 12px 22px rgba(44, 92, 130, 0.15);
    border: 5px solid white;
    display: grid;
    place-items: center;
    font-weight: 1000;
    color: #243447;
    font-size: 30px;
}

.mini-card:nth-child(1) {
    transform: translateX(-68px) rotate(-10deg);
    background: linear-gradient(135deg, #ffe3e8, #ffb3c1);
}

.mini-card:nth-child(2) {
    transform: translateY(-4px);
    background: linear-gradient(135deg, #fff3bf, #ffe066);
}

.mini-card:nth-child(3) {
    transform: translateX(68px) rotate(10deg);
    background: linear-gradient(135deg, #d0ebff, #a5d8ff);
}

.rules-note {
    margin-top: 16px;
    padding: 13px 15px;
    border-radius: 18px;
    background: #f0f9ff;
    color: #46677d;
    font-size: 13px;
    line-height: 1.5;
    border: 1px dashed rgba(77, 171, 247, 0.32);
}

.game-layout {
    height: calc(100vh - 104px);
    min-height: 700px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 14px;
    padding: 14px;
}

.board {
    min-width: 0;
    border-radius: 28px;
    background: rgba(255, 255, 255, .76);
    border: 1px solid var(--line);
    box-shadow: 0 12px 26px rgba(44, 92, 130, 0.08);
    position: relative;
    display: grid;
    grid-template-rows: auto auto 1fr 220px;
    overflow: hidden;
}

.board::before {
    content: "";
    position: absolute;
    inset: 16px;
    border-radius: 24px;
    background:
        radial-gradient(circle at 20% 22%, rgba(255, 212, 59, .14), transparent 18%),
        radial-gradient(circle at 80% 42%, rgba(81, 207, 102, .12), transparent 19%),
        radial-gradient(circle at 48% 78%, rgba(77, 171, 247, .12), transparent 20%);
    pointer-events: none;
}

.opponents {
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    position: relative;
    z-index: 1;
}

.player-panel {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 12px;
    box-shadow: 0 8px 18px rgba(44, 92, 130, 0.07);
    display: flex;
    gap: 11px;
    align-items: center;
    min-width: 0;
    position: relative;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.player-panel.active-turn {
    border-color: rgba(51,154,240,0.55);
    box-shadow: 0 0 0 4px rgba(77,171,247,0.16), 0 10px 20px rgba(44, 92, 130, 0.12);
    transform: translateY(-2px);
}

.player-panel.attack-target {
    border-color: rgba(245, 159, 0, 0.72);
    box-shadow: 0 0 0 4px rgba(255, 212, 59, 0.22), 0 12px 24px rgba(245, 159, 0, 0.18);
    animation: token-attack-shake .5s ease;
}

.attack-effect-badge {
    position: absolute;
    right: 10px;
    top: -12px;
    z-index: 6;
    min-width: 54px;
    padding: 6px 10px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    color: #7a2e0e;
    font-size: 13px;
    font-weight: 1000;
    background: linear-gradient(135deg, #fff3bf, #ffd43b);
    border: 3px solid #ffffff;
    box-shadow: 0 10px 18px rgba(245, 159, 0, 0.25);
    animation: token-attack-badge 1.15s ease both;
}

.avatar {
    width: 46px;
    height: 46px;
    border-radius: 17px;
    display: grid;
    place-items: center;
    color: #243447;
    font-size: 19px;
    font-weight: 1000;
    background: linear-gradient(135deg, #e7f5ff, #e6fcf5);
    box-shadow: inset 0 -3px 0 rgba(44, 92, 130, .06);
    flex: 0 0 auto;
}

.player-info {
    min-width: 0;
    flex: 1;
}

.player-info b {
    display: block;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-info span {
    display: block;
    color: var(--muted);
    font-weight: 900;
    font-size: 13px;
    margin-top: 3px;
}

.back-stack {
    display: flex;
    margin-left: auto;
    flex: 0 0 auto;
    width: clamp(64px, calc((var(--back-count, 1) * 6px) + 36px), 122px);
    height: 46px;
    align-items: center;
    justify-content: center;
    position: relative;
}

.back-stack.empty {
    opacity: .35;
}

.tiny-back {
    width: 28px;
    height: 40px;
    border-radius: 9px;
    background: linear-gradient(135deg, #d0ebff, #a5d8ff);
    border: 3px solid white;
    box-shadow: 0 4px 8px rgba(44, 92, 130, .12);
    position: absolute;
    z-index: var(--card-z, 1);
    transform: translateX(var(--card-offset, 0)) rotate(var(--card-rotate, 0deg));
}

.turn-order-rail {
    position: relative;
    z-index: 2;
    margin: 0 16px 4px;
    padding: 10px 12px;
    min-height: 58px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    background: rgba(255, 255, 255, .78);
    border: 1px solid rgba(93, 134, 171, 0.16);
    box-shadow: 0 8px 18px rgba(44, 92, 130, 0.07);
    scroll-padding: 12px;
}

.turn-order-label,
.turn-order-empty {
    flex: 0 0 auto;
    color: #436175;
    font-size: 12px;
    font-weight: 1000;
}

.turn-order-chip {
    position: relative;
    flex: 0 0 auto;
    min-width: 118px;
    padding: 8px 12px 8px 10px;
    border-radius: 17px;
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 8px;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--line);
    box-shadow: 0 6px 14px rgba(44, 92, 130, 0.07);
}

.turn-order-chip small {
    grid-row: span 2;
    min-width: 35px;
    height: 28px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: #1971c2;
    background: #e7f5ff;
    font-size: 11px;
    font-weight: 1000;
}

.turn-order-chip b {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.turn-order-chip em {
    color: var(--muted);
    font-style: normal;
    font-size: 11px;
    font-weight: 900;
}

.turn-order-chip.active {
    border-color: rgba(51,154,240,0.55);
    box-shadow: 0 0 0 4px rgba(77,171,247,0.14), 0 8px 18px rgba(44, 92, 130, 0.10);
}

.turn-order-chip.next small {
    color: #2b8a3e;
    background: #ebfbee;
}

.turn-order-chip.attack-target {
    border-color: rgba(245, 159, 0, 0.70);
    animation: token-attack-shake .5s ease;
}

.turn-order-arrow {
    flex: 0 0 auto;
    color: #7b8da3;
    font-weight: 1000;
}

.table-zone {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    justify-items: center;
    padding: 4px 24px;
    gap: 22px;
}

.turn-badge,
.status-card {
    border-radius: 22px;
    padding: 16px;
    background: #ffffff;
    border: 1px solid var(--line);
    box-shadow: 0 9px 18px rgba(44, 92, 130, 0.08);
}

.turn-badge {
    justify-self: end;
    align-self: start;
    margin-top: 26px;
    max-width: 250px;
}

.turn-badge strong {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    letter-spacing: -0.03em;
}

.turn-badge p {
    margin: 9px 0 0;
    color: var(--muted);
    line-height: 1.48;
    font-size: 13px;
}

.center-pile {
    display: flex;
    align-items: center;
    gap: clamp(18px, 3vw, 32px);
    position: relative;
}

.pile-area {
    display: grid;
    justify-items: center;
    gap: 10px;
}

.pile-label {
    font-size: 13px;
    font-weight: 1000;
    color: #436175;
    padding: 7px 12px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid var(--line);
}

.draw-pile,
.current-card-wrap {
    width: var(--card-w);
    height: var(--card-h);
}

.draw-pile {
    border: 0;
    border-radius: 21px;
    cursor: pointer;
    background: transparent;
    position: relative;
    padding: 0;
    transition: transform .15s ease;
}

.draw-pile:hover {
    transform: translateY(-4px) rotate(-1deg);
}

.draw-pile.disabled {
    opacity: .48;
    cursor: not-allowed;
    transform: none;
}

.card-back {
    position: absolute;
    inset: 0;
    border-radius: 21px;
    border: 5px solid #ffffff;
    background:
        linear-gradient(135deg, rgba(255,255,255,.36), transparent),
        repeating-linear-gradient(45deg, #a5d8ff 0 8px, #d0ebff 8px 16px);
    box-shadow: 0 14px 24px rgba(44, 92, 130, 0.16);
}

.card-back:nth-child(1) {
    transform: translate(-6px, 5px) rotate(-4deg);
    opacity: .72;
}

.card-back:nth-child(2) {
    transform: translate(0, 1px) rotate(1deg);
    opacity: .88;
}

.card-back:nth-child(3) {
    transform: translate(5px, -3px) rotate(4deg);
}

.deck-count {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-weight: 1000;
    color: #236895;
    background: rgba(255,255,255,0.94);
    box-shadow: 0 7px 14px rgba(44, 92, 130, .13);
}

.current-card-wrap {
    position: relative;
    display: grid;
    place-items: center;
}

.status-cluster {
    justify-self: start;
    align-self: start;
    margin-top: 26px;
    display: grid;
    gap: 10px;
    min-width: 205px;
}

.status-card span {
    display: block;
    font-size: 12px;
    color: var(--muted);
    font-weight: 1000;
    margin-bottom: 5px;
}

.status-card b {
    font-size: 18px;
    letter-spacing: -0.03em;
}

.color-dot {
    display: inline-flex;
    width: 17px;
    height: 17px;
    border-radius: 999px;
    margin-right: 7px;
    vertical-align: -3px;
    box-shadow: inset 0 -3px 5px rgba(0,0,0,0.08);
}

.hand-zone {
    position: relative;
    z-index: 2;
    padding: 0 16px 16px;
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 0;
}

.hand-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 8px 10px;
}

.hand-header h3 {
    margin: 0;
    font-size: 18px;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hand-tip {
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
    text-align: right;
}

.hand {
    min-height: 164px;
    padding: 17px 16px 20px;
    border-radius: 26px;
    background: rgba(240, 249, 255, 0.82);
    border: 1px solid rgba(77, 171, 247, 0.20);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 10px 22px rgba(44, 92, 130, 0.07);
    display: flex;
    gap: clamp(8px, 1vw, 13px);
    align-items: flex-end;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-padding: 16px;
}

.hand.locked {
    opacity: .66;
    filter: saturate(.86);
}

.hand.attack-target {
    position: relative;
    border-color: rgba(245, 159, 0, 0.48);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 0 0 4px rgba(255, 212, 59, 0.22), 0 12px 24px rgba(245, 159, 0, 0.14);
    animation: token-attack-shake .5s ease;
}

.hand.attack-target::after {
    content: attr(data-attack-effect) " 받음";
    position: sticky;
    right: 8px;
    align-self: flex-start;
    margin-left: auto;
    min-width: 82px;
    padding: 8px 11px;
    border-radius: 999px;
    color: #7a2e0e;
    font-size: 13px;
    font-weight: 1000;
    background: linear-gradient(135deg, #fff3bf, #ffd43b);
    border: 3px solid #ffffff;
    box-shadow: 0 10px 18px rgba(245, 159, 0, 0.25);
    animation: token-attack-badge 1.15s ease both;
}

.game-card {
    width: var(--card-w);
    height: var(--card-h);
    flex: 0 0 var(--card-w);
    border: 0;
    padding: 0;
    cursor: pointer;
    background: transparent;
    position: relative;
    border-radius: 21px;
    transform-origin: 50% 100%;
    transition: transform .16s ease, filter .16s ease;
}

.game-card .face {
    width: 100%;
    height: 100%;
    border-radius: 21px;
    background: var(--card-color, #dbeafe);
    border: 5px solid #ffffff;
    box-shadow: 0 13px 22px rgba(44, 92, 130, 0.15);
    display: grid;
    grid-template-rows: auto 1fr auto;
    padding: 9px;
    color: #243447;
    text-shadow: none;
    overflow: hidden;
    position: relative;
}

.game-card .face::before {
    content: "";
    position: absolute;
    width: 94%;
    height: 48%;
    left: 3%;
    bottom: 7%;
    border-radius: 999px;
    background: rgba(255,255,255,.25);
}

.corner {
    font-weight: 1000;
    font-size: clamp(11px, 1.02vw, 14px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
    letter-spacing: -0.05em;
}

.center-symbol {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    position: relative;
    z-index: 1;
    line-height: 1;
}

.center-symbol .symbol {
    font-size: clamp(30px, 4.2vw, 48px);
    font-weight: 1000;
    filter: drop-shadow(0 4px 5px rgba(255,255,255,0.44));
}

.center-symbol .caption {
    font-size: clamp(10px, 1vw, 13px);
    font-weight: 1000;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.48);
    white-space: nowrap;
}

.game-card.playable {
    transform: translateY(-14px) scale(1.015);
    filter: drop-shadow(0 18px 18px rgba(34, 197, 94, 0.24));
    animation: token-playable-pulse 1.35s ease-in-out infinite;
}

.game-card.playable .face {
    box-shadow:
        0 0 0 4px #ffffff,
        0 0 0 10px rgba(34, 197, 94, 0.74),
        0 0 28px 13px rgba(163, 230, 53, 0.62),
        0 18px 28px rgba(21, 128, 61, 0.22);
}

.game-card.playable::after {
    content: "\2713";
    position: absolute;
    right: -8px;
    top: -13px;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #22c55e, #a3e635);
    border: 3px solid #ffffff;
    color: #ffffff;
    font-size: 16px;
    font-weight: 1000;
    box-shadow: 0 8px 16px rgba(21, 128, 61, 0.24);
    z-index: 4;
}

.game-card:not(.playable):hover {
    transform: translateY(-4px);
}

.game-card.playable:hover {
    transform: translateY(-20px) scale(1.035);
}

.game-card.disabled {
    cursor: default;
}

.game-card.shake {
    animation: token-shake .38s ease;
}

@keyframes token-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-7px) rotate(-2deg); }
    40% { transform: translateX(7px) rotate(2deg); }
    60% { transform: translateX(-5px) rotate(-1deg); }
    80% { transform: translateX(5px) rotate(1deg); }
}

@keyframes token-playable-pulse {
    0%, 100% {
        filter: drop-shadow(0 16px 18px rgba(34, 197, 94, 0.22));
    }
    50% {
        filter: drop-shadow(0 22px 24px rgba(34, 197, 94, 0.42));
    }
}

@keyframes token-attack-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px) rotate(-.6deg); }
    40% { transform: translateX(5px) rotate(.7deg); }
    65% { transform: translateX(-3px) rotate(-.4deg); }
    85% { transform: translateX(2px); }
}

@keyframes token-attack-badge {
    0% { opacity: 0; transform: translateY(8px) scale(.86); }
    22% { opacity: 1; transform: translateY(-3px) scale(1.04); }
    70% { opacity: 1; transform: translateY(-7px) scale(1); }
    100% { opacity: 0; transform: translateY(-13px) scale(.98); }
}

@media (prefers-reduced-motion: reduce) {
    .game-card.playable,
    .player-panel.attack-target,
    .turn-order-chip.attack-target,
    .hand.attack-target,
    .attack-effect-badge,
    .hand.attack-target::after {
        animation: none;
    }
}

.side-panel {
    border-radius: 28px;
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: 0 12px 26px rgba(44, 92, 130, 0.08);
    padding: 15px;
    display: grid;
    grid-template-rows: auto auto 1fr auto auto;
    gap: 13px;
    min-height: 0;
}

.panel-section {
    border-radius: 22px;
    background: #ffffff;
    border: 1px solid var(--line);
    padding: 14px;
}

.panel-section h3 {
    margin: 0 0 12px;
    font-size: 16px;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 7px;
}

.rule-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: #4d6074;
    font-size: 13px;
    line-height: 1.45;
}

.rule-list li {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.rule-list li::before {
    content: "✓";
    color: #339af0;
    font-weight: 1000;
}

.score-list {
    display: grid;
    gap: 8px;
}

.score-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
    font-size: 14px;
    font-weight: 1000;
}

.bar {
    height: 9px;
    border-radius: 999px;
    background: rgba(77, 171, 247, 0.14);
    overflow: hidden;
    margin-top: 6px;
}

.bar span {
    display: block;
    height: 100%;
    width: 50%;
    border-radius: inherit;
    background: linear-gradient(90deg, #51cf66, #4dabf7);
    transition: width .3s ease;
}

.log-box {
    overflow: auto;
    min-height: 0;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    padding-right: 3px;
}

.log-item {
    padding: 10px 11px;
    border-radius: 16px;
    background: #f8fbff;
    border: 1px solid rgba(93, 134, 171, 0.12);
    color: #4d6074;
    font-size: 13px;
    line-height: 1.42;
}

.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

.room-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(36, 52, 71, 0.30);
    backdrop-filter: blur(7px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.modal-backdrop.active {
    display: flex;
}

.modal {
    width: min(520px, 100%);
    border-radius: 30px;
    background: #ffffff;
    border: 1px solid var(--line);
    box-shadow: 0 24px 70px rgba(36, 52, 71, 0.24);
    padding: 24px;
    text-align: center;
}

.modal h2 {
    margin: 0;
    font-size: 30px;
    letter-spacing: -0.05em;
}

.modal p {
    margin: 10px 0 20px;
    color: var(--muted);
    line-height: 1.55;
}

.color-choices {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 11px;
    margin-top: 18px;
}

.color-choice {
    min-height: 84px;
    border: 5px solid #fff;
    border-radius: 22px;
    color: #243447;
    cursor: pointer;
    font-weight: 1000;
    font-size: 18px;
    box-shadow: 0 12px 22px rgba(44, 92, 130, 0.13);
    display: grid;
    place-items: center;
    gap: 3px;
    transition: transform .14s ease;
    text-shadow: none;
}

.color-choice:hover {
    transform: translateY(-3px);
}

.color-choice small {
    display: block;
    font-size: 12px;
    opacity: .82;
}

.result-stat {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
    margin: 18px 0;
}

.result-stat div {
    border-radius: 18px;
    background: #f8fbff;
    border: 1px solid var(--line);
    padding: 12px 8px;
}

.result-stat b {
    display: block;
    font-size: 22px;
}

.result-stat span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 1000;
}

.empty-hand-message {
    width: 100%;
    min-height: 140px;
    border-radius: 23px;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-weight: 1000;
    text-align: center;
}

@media (max-width: 1100px) {
    .hero,
    .lobby-grid,
    .game-layout {
        grid-template-columns: 1fr;
    }

    .game-layout {
        height: auto;
    }

    .side-panel {
        grid-template-rows: auto;
    }

    .board {
        min-height: 700px;
    }

    .opponents {
        grid-template-columns: 1fr;
    }

    .turn-order-rail {
        margin-inline: 12px;
    }

    .player-panel {
        min-height: 74px;
    }

    .table-zone {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .turn-badge,
    .status-cluster {
        justify-self: stretch;
        align-self: auto;
        margin-top: 0;
        max-width: none;
    }

    .status-cluster {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .token-app {
        padding: 8px;
    }

    .token-shell {
        min-height: calc(100vh - 16px);
        border-radius: 24px;
    }

    .token-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .token-top-actions {
        justify-content: flex-start;
    }

    .active-room-card,
    .active-room-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .start-screen {
        padding: 20px;
    }

    .student-kpis,
    .quick-actions,
    .room-actions,
    .active-room-actions,
    .color-choices,
    .result-stat {
        grid-template-columns: 1fr;
    }

    .game-layout {
        padding: 8px;
    }

    .board {
        border-radius: 22px;
        grid-template-rows: auto auto auto 218px;
    }

    .center-pile {
        gap: 16px;
    }

    .status-cluster {
        grid-template-columns: 1fr;
    }

    .side-panel {
        border-radius: 22px;
    }
}
