/* Teaching Land of Peace — 20% dice / 80% board layout */
:root {
    --tlpa-ink: #0f172a;
    --tlpa-muted: #64748b;
    --tlpa-accent: #1d5ae2;
    --tlpa-accent-dark: #1648b8;
    --tlpa-accent-light: #e8f0fe;
    --tlpa-accent-ring: rgba(29, 90, 226, 0.22);
    --tlpa-panel: #ffffff;
    --tlpa-panel-border: #d7e0ec;
    --tlpa-side-bg: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    --tlpa-board-bg: #dde3ea;
    --tlpa-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.08);
    --tlpa-shadow-md: 0 8px 22px rgba(15, 23, 42, 0.12);
    --tlpa-left: 20%;
    --tlpa-right: 80%;
    --tlpa-radius: 12px;
    --tlpa-radius-sm: 8px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body.tlpaPage {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: #e8ecf1;
    color: var(--tlpa-ink);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

.tlpaShell {
    display: flex;
    flex-direction: row;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* ——— Left control panel (20%) ——— */
.tlpaDiceCol {
    flex: 0 0 var(--tlpa-left);
    width: var(--tlpa-left);
    max-width: var(--tlpa-left);
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 8px 4px;
    background: var(--tlpa-side-bg);
    border-right: 1px solid var(--tlpa-panel-border);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.65);
    overflow-y: auto;
    transition: flex-basis 0.28s ease, width 0.28s ease, max-width 0.28s ease, opacity 0.2s ease, padding 0.28s ease;
}

.tlpaShell--panelHidden .tlpaDiceCol {
    flex-basis: 0 !important;
    width: 0 !important;
    max-width: 0 !important;
    padding: 0 !important;
    border-right: none;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.tlpaSideRow--panelToggle {
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    background: #f8fafc;
}

.tlpaPanelToggleLabel {
    font-size: 0.62rem;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tlpaPanelHideBtn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 28px;
    padding: 4px 10px;
    border: 1.5px solid #0f172a;
    border-radius: 999px;
    background: #fff;
    color: #0f172a;
    font-size: 0.68rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.tlpaPanelHideBtn:hover {
    background: #0f172a;
    color: #fff;
}

.tlpaPanelShowBtn {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 20;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 8px 12px;
    border: 2px solid #0f172a;
    border-radius: 999px;
    background: #fff;
    color: #0f172a;
    font-size: 0.75rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.2);
    transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.tlpaPanelShowBtn[hidden] {
    display: none !important;
}

.tlpaPanelShowBtn:hover {
    background: #1d5ae2;
    border-color: #1d5ae2;
    color: #fff;
    transform: translateY(-1px);
}

.tlpaSideCard {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: 100%;
    min-height: 0;
    background: #fff;
    border: 2.5px solid #0f172a;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: var(--tlpa-shadow-sm);
}

.tlpaSideRow {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-bottom: 2.5px solid #0f172a;
    box-sizing: border-box;
    flex-shrink: 0;
}

.tlpaSideRow:last-child {
    border-bottom: none;
}

.tlpaSideRow--nav {
    gap: 6px;
}

.tlpaSideBtn {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 34px;
    padding: 6px 4px;
    border-radius: 4px;
    border: 2px solid #0f172a;
    background: #fff;
    color: #0f172a;
    font-weight: 800;
    font-size: 0.72rem;
    letter-spacing: 0.01em;
    cursor: pointer;
    text-align: center;
    line-height: 1.15;
    transition: background 0.15s ease, transform 0.1s ease;
}

.tlpaSideBtn:hover {
    background: #f1f5f9;
}

.tlpaSideBtn:active {
    transform: translateY(1px);
}

.tlpaSideBtn--card {
    border-color: #6366f1;
    color: #4338ca;
}

.tlpaSideBtn--card:hover {
    background: #eef2ff;
}

.tlpaSideBtn--board {
    border-color: #0d9488;
    color: #0f766e;
}

.tlpaSideBtn--board:hover {
    background: #ecfdf5;
}

.tlpaZoomBtn {
    flex: 0 0 36px;
    width: 36px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    border-radius: 4px;
    border: 2px solid #0f172a;
    background: #fff;
    color: #0f172a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tlpaZoomBtn:hover {
    background: #ecfdf5;
    border-color: #0d9488;
    color: #0f766e;
}

.tlpaZoomBtn.is-active {
    border-color: #0d9488;
    background: #ccfbf1;
    color: #115e59;
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.25);
}

.tlpaLensGroup {
    display: inline-flex;
    align-items: stretch;
    gap: 4px;
    flex: 0 0 auto;
}

.tlpaLensBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 42px;
    height: 34px;
    padding: 0 7px;
    border-radius: 4px;
    border: 2px solid #0f172a;
    background: #fff;
    color: #0f172a;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tlpaLensBtn:hover {
    background: #ecfdf5;
    border-color: #0d9488;
    color: #0f766e;
}

.tlpaLensBtn.is-active {
    border-color: #0d9488;
    background: #ccfbf1;
    color: #115e59;
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.25);
}

.tlpaZoomIcon {
    flex-shrink: 0;
}

.tlpaSideRow--time {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    flex-wrap: nowrap;
}

.tlpaSideRow--time[hidden] {
    display: none !important;
}

.tlpaAdjTimeLabel {
    flex: 0 0 auto;
    font-size: 0.62rem;
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
    line-height: 1.1;
}

.tlpaTimeLine {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.tlpaTimeLine .tlpaTimerMachine {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 5px 6px;
    border: 2px solid #0f172a;
    border-radius: 4px;
    background: #0a0f0a;
    text-align: center;
}

.tlpaTimeLine .tlpaTimePmBtn {
    flex: 0 0 auto;
}

.tlpaClockVol {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.tlpaClockVolLabel {
    flex: 0 0 auto;
    font-size: 0.58rem;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tlpaClockVolSlider {
    flex: 1 1 auto;
    min-width: 0;
    height: 6px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 999px;
    background: linear-gradient(90deg, #99f6e4, #0d9488);
    outline: none;
    cursor: pointer;
}

.tlpaClockVolSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #0f766e;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25);
    cursor: pointer;
}

.tlpaClockVolSlider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #0f766e;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.25);
    cursor: pointer;
}

.tlpaClockVolSlider::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: #99f6e4;
}

.tlpaClockVolValue {
    flex: 0 0 2rem;
    text-align: right;
    font-size: 0.68rem;
    font-weight: 800;
    color: #334155;
    font-variant-numeric: tabular-nums;
}

.tlpaSideRow--time .tlpaTimerMachineTime {
    display: block;
    font-family: "Courier New", Consolas, monospace;
    font-size: clamp(0.85rem, 2.4vw, 1.05rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    color: #4ade80;
    text-shadow: 0 0 8px rgba(74, 222, 128, 0.45);
    line-height: 1.15;
}

.tlpaSideRow--time .tlpaTimerMachine.is-warn .tlpaTimerMachineTime {
    color: #f87171;
    text-shadow: 0 0 8px rgba(248, 113, 113, 0.55);
}

.tlpaSideRow--time .tlpaTimerMachine.is-done .tlpaTimerMachineTime,
.tlpaSideRow--time .tlpaTimerMachineTime.is-times-up {
    color: #fbbf24;
    font-size: clamp(0.68rem, 2vw, 0.82rem);
    letter-spacing: 0.02em;
    text-transform: lowercase;
}

.tlpaTimePmBtn {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid #0f172a;
    background: #fff;
    color: #0f172a;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.tlpaTimePmBtn--add {
    border-color: #16a34a;
    color: #15803d;
}

.tlpaTimePmBtn--add:hover {
    background: #dcfce7;
}

.tlpaTimePmBtn--sub {
    border-color: #dc2626;
    color: #b91c1c;
}

.tlpaTimePmBtn--sub:hover {
    background: #fee2e2;
}

.tlpaSideRow--play {
    align-items: stretch;
    gap: 8px;
}

.tlpaPlayActions {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tlpaDiceFaceWrap {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 96px;
    min-height: 108px;
    position: relative;
}

.tlpaDiceFaceWrap::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 22px;
    width: 52px;
    height: 12px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at center, rgba(15, 23, 42, 0.35) 0%, transparent 70%);
    filter: blur(1px);
    pointer-events: none;
    z-index: 0;
}

.tlpaDiceScene {
    width: 88px;
    height: 88px;
    perspective: 680px;
    perspective-origin: 50% 42%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: center center;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 10px 14px rgba(127, 16, 16, 0.28));
    animation: tlpaDiceSceneFloat 4.2s ease-in-out infinite;
}

.tlpaDiceScene.is-landed {
    animation: tlpaDiceBounce 0.55s cubic-bezier(0.22, 1.25, 0.36, 1) forwards;
}

.tlpaDiceScene.is-rolling-scene {
    animation: none;
}

.tlpaDiceCube {
    --tlpa-dice-size: 70px;
    --tlpa-dice-half: 35px;
    width: var(--tlpa-dice-size);
    height: var(--tlpa-dice-size);
    position: relative;
    transform-style: preserve-3d;
    /* Nearly front-facing so the result face is obvious */
    transform: rotateX(-10deg) rotateY(14deg);
    transition: transform 0.5s cubic-bezier(0.18, 0.9, 0.22, 1.05);
    will-change: transform;
}

.tlpaDiceCube.is-rolling {
    transition: none;
    animation: tlpaDiceTumble 0.22s linear infinite;
}

/* Result face is always the one toward the camera */
.tlpaDiceCube.show-1 { transform: rotateX(-10deg) rotateY(14deg); }
.tlpaDiceCube.show-2 { transform: rotateX(-100deg) rotateY(14deg); }
.tlpaDiceCube.show-3 { transform: rotateX(-10deg) rotateY(-76deg); }
.tlpaDiceCube.show-4 { transform: rotateX(-10deg) rotateY(104deg); }
.tlpaDiceCube.show-5 { transform: rotateX(80deg) rotateY(14deg); }
.tlpaDiceCube.show-6 { transform: rotateX(-10deg) rotateY(194deg); }

.tlpaDiceFace {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 9px;
    box-sizing: border-box;
    border-radius: 13px;
    background:
        radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.12) 28%, transparent 55%),
        radial-gradient(circle at 78% 82%, rgba(0, 0, 0, 0.22) 0%, transparent 48%),
        linear-gradient(155deg, #ff6b6b 0%, #ef4444 22%, #dc2626 52%, #b91c1c 78%, #7f1d1d 100%);
    border: 2.5px solid #691111;
    box-shadow:
        inset 0 3px 8px rgba(255, 255, 255, 0.42),
        inset 0 -5px 12px rgba(0, 0, 0, 0.38),
        inset 0 0 0 1px rgba(255, 200, 160, 0.18);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    filter: brightness(0.78);
    transition: filter 0.25s ease, box-shadow 0.25s ease;
}

/* Front face = result: brightest + glow ring */
.tlpaDiceCube.show-1 .tlpaDiceFace--1,
.tlpaDiceCube.show-2 .tlpaDiceFace--2,
.tlpaDiceCube.show-3 .tlpaDiceFace--3,
.tlpaDiceCube.show-4 .tlpaDiceFace--4,
.tlpaDiceCube.show-5 .tlpaDiceFace--5,
.tlpaDiceCube.show-6 .tlpaDiceFace--6 {
    filter: brightness(1.08);
    box-shadow:
        inset 0 3px 8px rgba(255, 255, 255, 0.5),
        inset 0 -5px 12px rgba(0, 0, 0, 0.28),
        0 0 0 2px rgba(255, 255, 255, 0.55),
        0 0 14px rgba(254, 202, 202, 0.65);
}

.tlpaDiceFace::before {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    pointer-events: none;
    box-shadow: inset 0 0 0 1px rgba(80, 0, 0, 0.12);
}

.tlpaDiceFace--1 { transform: translateZ(var(--tlpa-dice-half)); }
.tlpaDiceFace--2 { transform: rotateX(90deg) translateZ(var(--tlpa-dice-half)); }
.tlpaDiceFace--3 { transform: rotateY(90deg) translateZ(var(--tlpa-dice-half)); }
.tlpaDiceFace--4 { transform: rotateY(-90deg) translateZ(var(--tlpa-dice-half)); }
.tlpaDiceFace--5 { transform: rotateX(-90deg) translateZ(var(--tlpa-dice-half)); }
.tlpaDiceFace--6 { transform: rotateY(180deg) translateZ(var(--tlpa-dice-half)); }

.tlpaDiceFace .pip {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    margin: auto;
    opacity: 0;
    position: relative;
    z-index: 1;
    background:
        radial-gradient(circle at 30% 26%, #ffffff 0%, #f8fafc 38%, #e2e8f0 68%, #94a3b8 100%);
    box-shadow:
        0 1.5px 3px rgba(0, 0, 0, 0.42),
        0 0 0 1.5px rgba(90, 10, 10, 0.2),
        inset 0 -1.5px 2px rgba(15, 23, 42, 0.28),
        inset 0 1.5px 2px rgba(255, 255, 255, 0.85);
}

.tlpaDiceFace .pip.is-on {
    opacity: 1;
}

.tlpaDiceResultBadge {
    z-index: 2;
    min-width: 34px;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    color: #fff;
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    border: 1.5px solid #1e3a8a;
    box-shadow: 0 2px 6px rgba(29, 78, 216, 0.35);
    font-variant-numeric: tabular-nums;
}

.tlpaDiceResultBadge.is-pulse {
    animation: tlpaDiceBadgePulse 0.55s ease;
}

.tlpaRollBtn {
    width: 100%;
    min-height: 34px;
    padding: 6px 8px;
    border-radius: 4px;
    border: 2px solid #1d4ed8;
    background: linear-gradient(180deg, #2563eb 0%, var(--tlpa-accent) 100%);
    color: #fff;
    font-weight: 800;
    font-size: 0.72rem;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.15s ease, transform 0.1s ease;
}

.tlpaChooseBtn {
    width: 100%;
    min-height: 34px;
    padding: 6px 8px;
    border-radius: 4px;
    border: 2px solid #0f172a;
    background: #fff;
    color: #0f172a;
    font-weight: 800;
    font-size: 0.72rem;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.15s ease, transform 0.1s ease;
}

.tlpaChooseBtn:hover {
    background: #f1f5f9;
}

.tlpaChooseBtn:active,
.tlpaRollBtn:active {
    transform: translateY(1px);
}

.tlpaRollBtn:hover {
    background: linear-gradient(180deg, #1d4ed8 0%, var(--tlpa-accent-dark) 100%);
}

.tlpaRollBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tlpaDiceReadout {
    margin: 0;
    font-size: 0.62rem;
    font-weight: 700;
    text-align: left;
    line-height: 1.2;
    color: var(--tlpa-muted);
    width: 100%;
}

.tlpaDiceReadout span {
    font-variant-numeric: tabular-nums;
    color: var(--tlpa-accent);
    font-size: 1.05em;
}

.tlpaSideRow--image {
    padding: 8px;
    align-items: stretch;
}

.tlpaChosenCard {
    width: 100%;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    text-align: center;
}

.tlpaChosenCardImgBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 140px;
    padding: 6px;
    border: 2.5px solid #0f172a;
    background: #f8fafc;
    border-radius: 4px;
    cursor: zoom-in;
    transition: box-shadow 0.15s ease, background 0.15s ease;
}

.tlpaChosenCardImgBtn:disabled {
    cursor: default;
}

.tlpaChosenCardImgBtn:not(:disabled):hover {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
    background: #fff;
}

.tlpaChosenCardImgBtn:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.tlpaChosenCardImg {
    display: block;
    width: 100%;
    height: auto;
    max-height: 220px;
    border-radius: 2px;
    object-fit: contain;
}

.tlpaChosenCardImg[hidden] {
    display: none !important;
}

.tlpaChosenCardPlaceholder {
    font-size: 0.78rem;
    font-weight: 800;
    color: #94a3b8;
}

.tlpaChosenCardName {
    margin: 6px 0 0;
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--tlpa-ink);
    line-height: 1.2;
}

.tlpaChosenCardName[hidden] {
    display: none !important;
}

.tlpaSideRow--chips {
    flex: 1 1 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 4px 2px 6px;
    min-height: 0;
    overflow: hidden;
}

.tlpaSideRow--chips[hidden] {
    display: none !important;
}

.tlpaChipsHead {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: end;
    gap: 4px;
    width: 100%;
    flex-shrink: 0;
    padding: 0;
}

.tlpaChipsHeadSpacer {
    display: block;
}

.tlpaChipsHeading {
    margin: 0;
    font-size: 0.58rem;
    font-weight: 800;
    color: #1e3a8a;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.15;
    padding-bottom: 1px;
}

.tlpaInsuranceList {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    min-height: 0;
    flex: 1 1 auto;
    max-height: min(46vh, 360px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0;
    -webkit-overflow-scrolling: touch;
}

.tlpaInsuranceList::-webkit-scrollbar {
    width: 7px;
}

.tlpaInsuranceList::-webkit-scrollbar-track {
    background: #eef2f7;
    border-radius: 999px;
}

.tlpaInsuranceList::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 999px;
}

.tlpaInsuranceList::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.tlpaInsuranceRow {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.tlpaInsuranceToken {
    flex: none;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    line-height: 1;
    background: #000;
    border: 1.5px solid #0f172a;
    border-radius: 6px;
    overflow: hidden;
    padding: 0;
}

.tlpaInsuranceTokenImg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.tlpaChipControl {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    min-height: 34px;
    padding: 4px 5px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    box-sizing: border-box;
    overflow: visible;
}

.tlpaChipControl--chips {
    justify-content: flex-start;
    align-items: center;
    background: #f1f5f9;
    border-color: #cbd5e1;
    gap: 4px;
    overflow: hidden;
}

.tlpaChipControl--roll {
    width: auto;
    max-width: none;
    justify-content: flex-start;
    gap: 4px;
    padding: 4px 5px;
    background: #fff7ed;
    border-color: #fdba74;
}

.tlpaChipControl--roll .tlpaInsurancePm {
    flex: 0 0 auto;
}

.tlpaInsuranceInput {
    flex: 0 0 auto;
    min-width: 30px;
    width: 30px;
    max-width: 32px;
    height: 26px;
    padding: 0;
    border: 1.5px solid #0f172a;
    border-radius: 6px;
    background: #fff;
    color: #0f172a;
    font-size: 0.82rem;
    font-weight: 800;
    text-align: center;
    font-variant-numeric: tabular-nums;
    appearance: textfield;
    -moz-appearance: textfield;
}

.tlpaInsuranceInput::-webkit-outer-spin-button,
.tlpaInsuranceInput::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.tlpaInsuranceInput:focus {
    outline: none;
    border-color: #1d5ae2;
    box-shadow: 0 0 0 2px rgba(29, 90, 226, 0.18);
}

.tlpaInsurancePm {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.tlpaChipControl--chips .tlpaInsurancePm {
    gap: 4px;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
}

.tlpaInsurancePmBtn {
    width: 26px;
    height: 26px;
    padding: 0;
    border-radius: 50%;
    border: 1.5px solid #0f172a;
    background: #fff;
    color: #0f172a;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transition: background 0.15s ease, transform 0.1s ease;
}

.tlpaInsurancePmBtn:hover {
    transform: translateY(-1px);
}

.tlpaInsurancePmBtn--add {
    border-color: #16a34a;
    color: #15803d;
}

.tlpaInsurancePmBtn--add:hover {
    background: #dcfce7;
}

.tlpaInsurancePmBtn--sub {
    border-color: #dc2626;
    color: #b91c1c;
}

.tlpaInsurancePmBtn--sub:hover {
    background: #fee2e2;
}

.tlpaInsurancePmBtn--transfer {
    border-color: #2563eb;
    color: #1d4ed8;
    font-size: 0.72rem;
}

.tlpaInsurancePmBtn--transferLabel {
    width: auto;
    min-width: 0;
    height: 26px;
    padding: 0 8px;
    margin-left: 0;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    line-height: 1;
    white-space: nowrap;
    flex: 1 1 0%;
    box-sizing: border-box;
    overflow: hidden;
}

.tlpaInsurancePmBtn--transfer:hover {
    background: #dbeafe;
}

.tlpaInsurancePmBtn--transfer:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tlpaFlyCoin {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 2;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    overflow: hidden;
    pointer-events: none;
    will-change: transform, opacity, filter;
    box-shadow:
        0 6px 16px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(212, 175, 55, 0.35);
}

.tlpaFlyCoinImg {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 50%;
    user-select: none;
    -webkit-user-drag: none;
}

.tlpaCoinAnimModal {
    position: fixed;
    inset: 0;
    z-index: 100040;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    background: rgba(15, 23, 42, 0.62);
}

.tlpaCoinAnimModal[hidden] {
    display: none !important;
}

.tlpaCoinAnimPanel {
    width: min(92vw, 360px);
    padding: 18px 16px 20px;
    background: #fff;
    border: 2px solid #0f172a;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
    text-align: center;
}

.tlpaCoinAnimTitle {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 800;
    color: #0f172a;
}

.tlpaCoinAnimHint {
    margin: 0 0 16px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
}

.tlpaCoinAnimStage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 120px;
    padding: 10px 4px;
}

.tlpaCoinAnimFlyLayer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
}

.tlpaCoinAnimPot {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border: 2px solid #0f172a;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    min-width: 0;
    transition: transform 0.2s ease;
}

.tlpaCoinAnimPot.is-pot-give {
    animation: tlpaPotGive 0.45s ease-out;
}

.tlpaCoinAnimPot.is-pot-receive {
    animation: tlpaPotReceive 0.5s cubic-bezier(0.22, 1.2, 0.36, 1);
}

.tlpaCoinAnimEmoji {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    border-radius: 10px;
    font-size: 1.6rem;
    line-height: 1;
    overflow: hidden;
}

.tlpaCoinAnimEmojiImg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.tlpaCoinAnimName {
    font-size: 0.72rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
    word-break: break-word;
}

.tlpaCoinAnimCount {
    font-size: 0.78rem;
    font-weight: 800;
    color: #1d4ed8;
    font-variant-numeric: tabular-nums;
}

.tlpaInsuranceToken.is-pot-give,
.tlpaChipControl.is-pot-give {
    animation: tlpaPotGive 0.45s ease-out;
}

.tlpaInsuranceToken.is-pot-receive,
.tlpaChipControl.is-pot-receive {
    animation: tlpaPotReceive 0.5s cubic-bezier(0.22, 1.2, 0.36, 1);
}

@keyframes tlpaPotGive {
    0% { transform: scale(1); }
    35% { transform: scale(0.86) rotate(-6deg); }
    100% { transform: scale(1) rotate(0deg); }
}

@keyframes tlpaPotReceive {
    0% { transform: scale(1); }
    40% { transform: scale(1.18); }
    100% { transform: scale(1); }
}

.tlpaTransferPopover {
    position: fixed;
    inset: 0;
    z-index: 99997;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.tlpaTransferPopover[hidden] {
    display: none !important;
}

.tlpaTransferBackdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.tlpaTransferPanel {
    position: relative;
    z-index: 1;
    width: min(92vw, 300px);
    padding: 14px 14px 16px;
    background: #fff;
    border: 2px solid #0f172a;
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.28);
}

.tlpaTransferClose {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #f1f5f9;
    color: #0f172a;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}

.tlpaTransferClose:hover {
    background: #e2e8f0;
}

.tlpaTransferTitle {
    margin: 0 28px 4px 0;
    font-size: 0.85rem;
    font-weight: 800;
    color: #0f172a;
}

.tlpaTransferHint {
    margin: 0 0 10px;
    font-size: 0.68rem;
    font-weight: 600;
    color: #64748b;
    line-height: 1.3;
}

.tlpaTransferAmount {
    margin-bottom: 10px;
}

.tlpaTransferAmountLabel {
    display: block;
    margin-bottom: 5px;
    font-size: 0.62rem;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tlpaTransferAmountBtns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tlpaTransferAmountBtn {
    position: relative;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.tlpaTransferAmountCoin {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 50%;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.tlpaTransferAmountNum {
    position: relative;
    z-index: 1;
    font-size: 0.82rem;
    font-weight: 900;
    line-height: 1;
    color: #fff;
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.95),
        0 0 6px rgba(0, 0, 0, 0.75),
        0 0 1px #000;
    letter-spacing: -0.02em;
}

.tlpaTransferAmountBtn:hover {
    transform: scale(1.06);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.3),
        0 0 0 2px rgba(251, 191, 36, 0.45);
}

.tlpaTransferAmountBtn.is-selected {
    border-color: #fbbf24;
    box-shadow:
        0 0 0 3px rgba(251, 191, 36, 0.4),
        0 6px 16px rgba(0, 0, 0, 0.35);
    transform: scale(1.08);
}

.tlpaTransferAmountBtn.is-selected .tlpaTransferAmountNum {
    color: #fef08a;
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.95),
        0 0 8px rgba(251, 191, 36, 0.85);
}

.tlpaTransferSelectRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.tlpaTransferSelectRow .tlpaTransferAmountLabel {
    margin: 0;
}

.tlpaTransferTargets {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.tlpaTransferTargetBtn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: #0f172a;
    font-weight: 700;
    font-size: 0.78rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.tlpaTransferTargetBtn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}

.tlpaTransferTargetBtn.is-selected {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.tlpaTransferCheck {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    border: 1.5px solid #94a3b8;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.tlpaTransferTargetBtn.is-selected .tlpaTransferCheck {
    border-color: #2563eb;
    background: #2563eb;
    box-shadow: inset 0 0 0 3px #fff;
}

.tlpaTransferTargetEmoji {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    border-radius: 6px;
    font-size: 1rem;
    overflow: hidden;
}

.tlpaTransferTargetImg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.tlpaTransferEmpty {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    text-align: center;
    padding: 8px 0;
}

.tlpaTransferConfirm {
    width: 100%;
    min-height: 36px;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.tlpaTransferConfirm:hover:not(:disabled) {
    background: #1d4ed8;
}

.tlpaTransferConfirm:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ——— Chosen card zoom modal ——— */
.tlpaCardZoomModal {
    position: fixed;
    inset: 0;
    z-index: 99996;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.tlpaCardZoomModal[hidden] {
    display: none !important;
}

.tlpaCardZoomBackdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
}

.tlpaCardZoomPanel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(96vw, 920px);
    max-height: 96vh;
    padding: 16px 18px 20px;
    background: #0f172a;
    border: 2px solid #334155;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    box-sizing: border-box;
}

.tlpaCardZoomClose {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.12s ease;
}

.tlpaCardZoomClose:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(1.05);
}

.tlpaCardZoomTitle {
    margin: 0 44px 12px 0;
    align-self: flex-start;
    font-size: clamp(1rem, 2.2vw, 1.35rem);
    font-weight: 800;
    color: #f8fafc;
    line-height: 1.2;
}

.tlpaCardZoomImg {
    display: block;
    width: 100%;
    max-height: calc(96vh - 110px);
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

body.tlpaCardZoomOpen {
    overflow: hidden;
}

/* ——— Game over fullscreen ——— */
.tlpaGameOver {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    box-sizing: border-box;
}

.tlpaGameOver[hidden] {
    display: none !important;
}

body.tlpaGameOverOpen {
    overflow: hidden;
}

.tlpaGameOverInner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    width: 100%;
    height: 100%;
    padding: 24px;
    box-sizing: border-box;
    text-align: center;
}

.tlpaGameOverTitle {
    margin: 0;
    font-size: clamp(2.5rem, 12vw, 6.5rem);
    font-weight: 900;
    letter-spacing: 0.12em;
    line-height: 1.05;
    color: #ef4444;
    text-transform: uppercase;
    text-shadow:
        0 0 20px rgba(239, 68, 68, 0.85),
        0 0 60px rgba(220, 38, 38, 0.55),
        0 4px 0 #7f1d1d;
    animation: tlpaGameOverPulse 1.6s ease-in-out infinite;
}

.tlpaGameOverClose {
    padding: 14px 36px;
    border: 2px solid #ef4444;
    border-radius: 999px;
    background: transparent;
    color: #ef4444;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.tlpaGameOverClose:hover {
    background: #ef4444;
    color: #000;
    box-shadow: 0 0 24px rgba(239, 68, 68, 0.55);
    transform: scale(1.04);
}

@keyframes tlpaGameOverPulse {
    0%, 100% {
        opacity: 1;
        text-shadow:
            0 0 20px rgba(239, 68, 68, 0.85),
            0 0 60px rgba(220, 38, 38, 0.55),
            0 4px 0 #7f1d1d;
    }
    50% {
        opacity: 0.88;
        text-shadow:
            0 0 32px rgba(239, 68, 68, 1),
            0 0 80px rgba(220, 38, 38, 0.75),
            0 4px 0 #7f1d1d;
    }
}

/* ——— Choose card popup (fullscreen) ——— */
.tlpaPickModal {
    position: fixed;
    inset: 0;
    z-index: 99995;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    box-sizing: border-box;
}

.tlpaPickModal[hidden] {
    display: none !important;
}

.tlpaPickModalBackdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.88);
}

.tlpaPickModalPanel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-height: 100%;
    overflow: auto;
    background: #f8fafc;
    border: none;
    border-radius: 0;
    padding: 20px 24px 28px;
    box-shadow: none;
    box-sizing: border-box;
}

.tlpaPickModalPanel::before {
    content: "";
    display: block;
    height: 5px;
    margin: -20px -24px 18px;
    border-radius: 0;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #6366f1);
    flex-shrink: 0;
}

.tlpaPickModalClose {
    position: fixed;
    top: 16px;
    right: 18px;
    z-index: 3;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    color: #0f172a;
    font-size: 1.85rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transition: background 0.15s ease, transform 0.12s ease;
}

.tlpaPickModalClose:hover {
    background: #fff;
    transform: scale(1.06);
}

.tlpaPickModalTitle {
    margin: 0 56px 20px 0;
    font-size: clamp(1.1rem, 2.2vw, 1.5rem);
    font-weight: 800;
    color: #0f172a;
    text-align: center;
    flex-shrink: 0;
}

.tlpaPickCardGrid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(14px, 2.5vw, 28px);
    flex: 1 1 auto;
    align-content: center;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 8px 12px;
    box-sizing: border-box;
}

.tlpaPickCardItem {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: clamp(10px, 1.5vw, 18px);
    border: 2px solid #cbd5e1;
    border-radius: 14px;
    background: linear-gradient(180deg, #fff 0%, #f1f5f9 100%);
    cursor: pointer;
    text-align: center;
    min-height: 0;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}

.tlpaPickCardItem:hover {
    border-color: #6366f1;
    box-shadow: 0 10px 28px rgba(99, 102, 241, 0.22);
    transform: translateY(-3px);
}

.tlpaPickCardItem.is-selected {
    border-color: #4338ca;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.28);
}

.tlpaPickCardItem img {
    width: 100%;
    flex: 1 1 auto;
    max-height: min(48vh, 420px);
    min-height: 120px;
    object-fit: contain;
}

.tlpaPickCardItem span {
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    font-weight: 800;
    color: #1e293b;
    line-height: 1.25;
}

.tlpaStatusCard {
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.4;
}

.tlpaStatusCard strong {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 4px;
}

.tlpaSquareTitle {
    font-weight: 800;
    font-size: 0.92rem;
    color: #0f172a;
}

.tlpaSquareLines {
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
    color: #475569;
}

.tlpaSquareLines li + li { margin-top: 2px; }

.tlpaHistory {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.75rem;
    line-height: 1.45;
}

.tlpaHistory h3 {
    margin: 0 0 6px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.tlpaHistory ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tlpaHistory li {
    padding: 3px 0;
    border-bottom: 1px solid #e2e8f0;
}

.tlpaHistory li:last-child { border-bottom: none; }

/* ——— Right board panel (80%) ——— */
.tlpaBoardCol {
    position: relative;
    flex: 0 0 var(--tlpa-right);
    width: var(--tlpa-right);
    max-width: var(--tlpa-right);
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(29, 90, 226, 0.06) 0%, transparent 55%),
        var(--tlpa-board-bg);
    overflow: hidden;
    transition: flex-basis 0.28s ease, width 0.28s ease, max-width 0.28s ease, padding 0.28s ease;
}

.tlpaShell--panelHidden .tlpaBoardCol {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 8px;
}

.tlpaBoardStage {
    position: relative;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.tlpaShell--panelHidden .tlpaBoardStage {
    transform: scale(1.04);
}

.tlpaShell--panelHidden .tlpaBoardFrame {
    max-height: calc(100vh - 8px);
}

.tlpaBoardFrame {
    position: relative;
    display: inline-block;
    max-width: 100%;
    max-height: calc(100vh - 16px);
    line-height: 0;
}

.tlpaBoardFrame--zoom {
    cursor: none;
}

.tlpaBoardFrame--zoom .tlpaPlayLayer {
    pointer-events: none;
}

.tlpaMagnifierLens {
    position: absolute;
    width: 300px;
    height: 300px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 4px solid #1e293b;
    box-shadow:
        0 0 0 3px #fff,
        0 10px 28px rgba(0, 0, 0, 0.45),
        inset 0 0 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    pointer-events: none;
    z-index: 25;
    background-color: #fff;
    background-repeat: no-repeat;
}

/* 2-box lens: tall window (~2 squares) */
.tlpaMagnifierLens--2 {
    width: 350px;
    height: 350px;
    border-radius: 14px;
}

.tlpaMagnifierLens--2::after {
    bottom: -14px;
    right: -10px;
    width: 42px;
    height: 7px;
}

/* 4-box lens: taller, slightly narrower */
.tlpaMagnifierLens--4 {
    width: 430px;
    height: 510px;
    border-radius: 16px;
}

.tlpaMagnifierLens--4::after {
    bottom: -16px;
    right: -12px;
}

.tlpaMagnifierLens[hidden] {
    display: none !important;
}

.tlpaMagnifierLens::after {
    content: "";
    position: absolute;
    bottom: -22px;
    right: -18px;
    width: 52px;
    height: 8px;
    background: #374151;
    border-radius: 4px;
    transform: rotate(45deg);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.tlpaBoardImg {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 24px);
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    border: 2px solid #94a3b8;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.18);
}

.tlpaPlayLayer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.tlpaHint {
    margin: 0;
    font-size: 0.78rem;
    color: #475569;
    line-height: 1.4;
}

.tlpaShell--hidden {
    display: none !important;
}

/* ——— Token setup (before game) ——— */
.tlpaTokenSetup {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    background: rgba(15, 23, 42, 0.88);
}

.tlpaTokenSetup[hidden] {
    display: none !important;
}

.tlpaTokenSetupPanel {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: 20px 24px 28px;
    background: #f8fafc;
    overflow: auto;
    box-sizing: border-box;
}

.tlpaTokenSetupPanel::before {
    content: "";
    display: block;
    height: 5px;
    margin: -20px -24px 16px;
    background: linear-gradient(90deg, #1d5ae2, #6366f1, #0d9488);
}

.tlpaTokenSetupTitle {
    margin: 0 0 8px;
    font-size: clamp(1.15rem, 2.4vw, 1.6rem);
    font-weight: 800;
    color: #0f172a;
    text-align: center;
}

.tlpaTokenSetupHint {
    margin: 0 0 18px;
    font-size: 0.88rem;
    color: #64748b;
    text-align: center;
    line-height: 1.4;
}

.tlpaTokenPicker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: clamp(10px, 2vw, 16px);
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 4px 8px 16px;
}

.tlpaTokenPickItem {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 88px;
    padding: 10px 6px;
    border: 2px solid #cbd5e1;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease, background 0.18s ease;
}

.tlpaTokenPickItem:hover {
    border-color: #6366f1;
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.18);
    transform: translateY(-2px);
}

.tlpaTokenPickItem.is-selected {
    border-color: #1d5ae2;
    background: #e8f0fe;
    box-shadow: 0 0 0 3px rgba(29, 90, 226, 0.25);
}

.tlpaTokenPickEmoji {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: clamp(2rem, 4.5vw, 2.5rem);
}

.tlpaTokenPickImg {
    width: clamp(2rem, 4.5vw, 2.6rem);
    height: clamp(2rem, 4.5vw, 2.6rem);
    object-fit: cover;
    object-position: center;
    border-radius: 50%;
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.tlpaTokenPickLabel {
    font-size: 0.62rem;
    font-weight: 700;
    color: #475569;
    text-align: center;
    line-height: 1.15;
}

.tlpaTokenSetupCount {
    margin: 0 0 18px;
    font-size: 0.9rem;
    font-weight: 800;
    color: #1d5ae2;
    text-align: center;
}

.tlpaTimerSetup {
    width: 100%;
    max-width: 520px;
    margin: 0 auto 18px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid var(--tlpa-panel-border);
    border-radius: var(--tlpa-radius);
    box-shadow: var(--tlpa-shadow-sm);
}

.tlpaTimerSetupLabel {
    margin: 0 0 10px;
    font-size: 0.82rem;
    font-weight: 800;
    color: #0f172a;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tlpaTimerChips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.tlpaTimerChip {
    flex: 1 1 auto;
    min-width: 72px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1.5px solid #94a3b8;
    background: #f8fafc;
    color: #334155;
    font-weight: 700;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tlpaTimerChip:hover {
    border-color: #1d5ae2;
    background: #eff6ff;
    color: #1d4ed8;
}

.tlpaTimerChip.is-selected {
    border-color: #1d5ae2;
    background: #dbeafe;
    color: #1e40af;
    box-shadow: 0 0 0 3px rgba(29, 90, 226, 0.2);
}

.tlpaTimerCustom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
}

.tlpaTimerCustom[hidden] {
    display: none !important;
}

.tlpaTimerCustomLabel {
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
}

.tlpaTimerCustomInput {
    width: 120px;
    padding: 8px 10px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
}

.tlpaTimerCustomInput:focus {
    outline: none;
    border-color: #1d5ae2;
    box-shadow: 0 0 0 3px rgba(29, 90, 226, 0.2);
}

/* ——— Timing machine display ——— */
.tlpaTimerMachine {
    width: 100%;
    margin-top: 14px;
}

.tlpaTimerMachine[hidden] {
    display: none !important;
}

.tlpaTimerMachineCase {
    padding: 12px 14px 14px;
    border-radius: 14px;
    background: linear-gradient(180deg, #4b5563 0%, #1f2937 55%, #111827 100%);
    border: 2px solid #374151;
    box-shadow:
        0 8px 20px rgba(15, 23, 42, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.tlpaTimerMachineBrand {
    margin-bottom: 8px;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-align: center;
    color: #cbd5e1;
}

.tlpaTimerMachineDisplay {
    padding: 12px 10px;
    border-radius: 8px;
    background: linear-gradient(180deg, #0a0f0a 0%, #111811 100%);
    border: 2px inset #000;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.65);
    text-align: center;
}

.tlpaTimerMachineTime {
    display: block;
    font-family: "Courier New", Consolas, monospace;
    font-size: clamp(1.5rem, 4.5vw, 2rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.08em;
    color: #4ade80;
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.55);
    line-height: 1.1;
}

.tlpaTimerMachineLights {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.tlpaTimerMachineLights span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #334155;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.tlpaTimerMachineLights span.is-on {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.75);
}

.tlpaTimerMachineLights span.is-blink {
    animation: tlpaTimerBlink 1s step-end infinite;
}

.tlpaTimerMachine--live.is-warn .tlpaTimerMachineTime {
    color: #f87171;
    text-shadow: 0 0 12px rgba(248, 113, 113, 0.75);
}

.tlpaTimerMachine--live.is-warn .tlpaTimerMachineLights span.is-on {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.75);
}

.tlpaTimerMachine--live.is-done .tlpaTimerMachineTime {
    color: #fbbf24;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.65);
}

.tlpaTimerMachineTime.is-times-up {
    font-size: clamp(0.85rem, 2.6vw, 1.1rem);
    letter-spacing: 0.03em;
    text-transform: lowercase;
}

.tlpaTimerMachine--live.is-running .tlpaTimerMachineDisplay {
    animation: tlpaTimerPulse 2s ease-in-out infinite;
}

@keyframes tlpaTimerBlink {
    0%, 100% { background: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, 0.75); }
    50% { background: #334155; box-shadow: none; }
}

@keyframes tlpaTimerPulse {
    0%, 100% { box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.65); }
    50% { box-shadow: inset 0 2px 14px rgba(74, 222, 128, 0.12); }
}

.tlpaStartGameBtn {
    display: block;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    min-height: 48px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--tlpa-radius-sm);
    background: linear-gradient(180deg, #2563eb 0%, var(--tlpa-accent) 100%);
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(29, 90, 226, 0.38);
    transition: opacity 0.18s ease, transform 0.12s ease;
}

.tlpaStartGameBtn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.tlpaStartGameBtn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.tlpaToken {
    position: absolute;
    width: clamp(30px, 3.2vw, 40px);
    height: clamp(30px, 3.2vw, 40px);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px solid #1e293b;
    background: #000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    z-index: 3;
    cursor: grab;
    touch-action: none;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(16px, 2.2vw, 22px);
    line-height: 1;
    user-select: none;
    overflow: hidden;
}

.tlpaBoardTokenImg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    pointer-events: none;
}

.tlpaToken--img {
    border-color: #d4af37;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(212, 175, 55, 0.35);
}

.tlpaToken--stack {
    transform: translate(-42%, -50%);
}

.tlpaToken.is-dragging {
    cursor: grabbing;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
    z-index: 10;
}

.tlpaMissingImg {
    padding: 24px;
    text-align: center;
    color: #b91c1c;
    font-size: 0.9rem;
}

body.tlpaPage.tlpaEmbed { background: #fff; }
body.tlpaPage.tlpaEmbed .tlpaDiceCol { padding: 10px 8px; }

/* ——— Fullscreen image viewer (See card / See board) ——— */
.tlpaFullscreen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    box-sizing: border-box;
    background: rgba(15, 23, 42, 0.88);
}

.tlpaFullscreen[hidden] {
    display: none !important;
}

.tlpaFullscreenPanel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: #f8fafc;
    overflow: hidden;
    box-sizing: border-box;
}

.tlpaFullscreenPanel::before {
    content: "";
    display: block;
    height: 5px;
    flex-shrink: 0;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #6366f1);
}

.tlpaFullscreenPanel--board::before {
    background: linear-gradient(90deg, #0d9488, #14b8a6, #0d9488);
}

.tlpaFullscreenClose {
    position: fixed;
    top: 16px;
    right: 18px;
    z-index: 3;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    color: #0f172a;
    font-size: 1.85rem;
    line-height: 1;
    font-weight: 400;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transition: background 0.15s ease, transform 0.12s ease;
}

.tlpaFullscreenClose:hover {
    background: #fff;
    transform: scale(1.06);
}

.tlpaFullscreenTitle {
    margin: 0;
    padding: 18px 56px 14px;
    font-size: clamp(1.1rem, 2.2vw, 1.5rem);
    font-weight: 800;
    color: #0f172a;
    text-align: center;
    flex-shrink: 0;
}

.tlpaFullscreenBody {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 8px 20px 24px;
    box-sizing: border-box;
}

.tlpaFullscreenImg {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.2);
    user-select: none;
    -webkit-user-drag: none;
    background: #fff;
}

@keyframes tlpaDiceBadgePulse {
    0% { transform: scale(0.75); opacity: 0.4; }
    60% { transform: scale(1.12); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes tlpaDiceSceneFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes tlpaDiceTumble {
    0% {
        transform: rotateX(12deg) rotateY(-20deg) rotateZ(0deg) translateY(0);
    }
    20% {
        transform: rotateX(140deg) rotateY(90deg) rotateZ(40deg) translateY(-10px);
    }
    40% {
        transform: rotateX(260deg) rotateY(210deg) rotateZ(-55deg) translateY(-4px);
    }
    60% {
        transform: rotateX(390deg) rotateY(320deg) rotateZ(70deg) translateY(-12px);
    }
    80% {
        transform: rotateX(500deg) rotateY(430deg) rotateZ(-35deg) translateY(-2px);
    }
    100% {
        transform: rotateX(620deg) rotateY(540deg) rotateZ(15deg) translateY(0);
    }
}

@keyframes tlpaDiceBounce {
    0% { transform: scale(1.16) translateY(-8px); }
    55% { transform: scale(0.96) translateY(2px); }
    100% { transform: scale(1) translateY(0); }
}

@media (max-width: 768px) {
    .tlpaShell {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow: auto;
    }

    html, body.tlpaPage { overflow: auto; }

    .tlpaDiceCol,
    .tlpaBoardCol {
        flex: none;
        width: 100%;
        max-width: 100%;
    }

    .tlpaSideRow--nav {
        flex-direction: row;
    }

    .tlpaPickCardGrid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
        padding: 0 4px 8px;
    }

    .tlpaPickCardItem img {
        max-height: min(36vh, 280px);
    }

    .tlpaPickModalPanel {
        padding: 16px 14px 20px;
    }

    .tlpaPickModalPanel::before {
        margin: -16px -14px 14px;
    }

    .tlpaFullscreenBody {
        padding: 6px 10px 16px;
    }

    .tlpaFullscreenTitle {
        padding: 14px 48px 10px;
    }

    .tlpaTokenPicker {
        grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
        gap: 10px;
    }

    .tlpaTokenPickItem {
        min-height: 76px;
    }

    .tlpaBoardCol {
        min-height: 55vh;
    }

    .tlpaBoardImg {
        max-height: none;
        width: 100%;
    }
}
