.tavla-lobby {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.tavla-panel {
    padding: 16px;
}

.tavla-panel h2 {
    margin: 0 0 8px;
}

.tavla-result {
    margin-top: 10px;
    color: var(--accent);
    font-weight: 600;
}

.input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #0c111a;
    color: var(--text);
    margin-bottom: 10px;
}

.btn {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
}

.btn.primary {
    border-color: var(--accent);
    background: linear-gradient(135deg, #1e293b, #0ea5e9);
    color: #e5f2ff;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tavla-room .card {
    padding: 16px;
}

.tavla-status {
    margin-bottom: 18px;
}

.tavla-room-layout {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    min-width: 0;
}

.tavla-chat {
    width: 320px;
    min-height: 420px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 0 0 320px;
}

.tavla-chat .chat-messages {
    flex: 1;
    min-height: 260px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: #0c111a;
    overflow-y: auto;
}

.tavla-chat .chat-form {
    display: flex;
    gap: 8px;
}

.tavla-chat .chat-form .input {
    flex: 1;
    margin-bottom: 0;
}

.status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    margin-bottom: 8px;
}

.notice {
    color: var(--accent);
    font-weight: 600;
}

.invite-row {
    align-items: center;
}
.invite-row .input {
    flex: 1 1 240px;
    margin-bottom: 0;
}
.invite-row .btn {
    white-space: nowrap;
}

.dice {
    display: flex;
    gap: 8px;
    align-items: center;
}

.die {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: linear-gradient(150deg, #ffffff, #e2e8f0);
    color: #0f172a;
    font-weight: 700;
    box-shadow: inset 0 2px 2px rgba(255,255,255,0.7), 0 6px 14px rgba(15, 23, 42, 0.35);
    font-family: 'Space Grotesk', sans-serif;
}

.die.rolling {
    animation: dice-bounce 0.45s ease-in-out infinite;
}

.die.final {
    animation: dice-pop 220ms ease-out;
}

.die.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

.board-die {
    position: absolute;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.7);
    background: linear-gradient(150deg, #ffffff, #dbe5f3);
    color: #0f172a;
    font-weight: 800;
    font-size: 18px;
    display: grid;
    place-items: center;
    box-shadow: inset 0 2px 3px rgba(255,255,255,0.8), inset 0 -4px 8px rgba(15,23,42,0.25), 0 14px 20px rgba(0,0,0,0.35);
    z-index: 8;
    transition: transform 420ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 240ms ease;
    pointer-events: none;
    font-family: 'Space Grotesk', sans-serif;
}

.board-die.rolling {
    transition: none;
    filter: blur(0.2px);
}

.tavla-board {
    position: relative;
    background:
        linear-gradient(135deg, rgba(122, 59, 27, 0.95), rgba(166, 82, 42, 0.92)),
        repeating-linear-gradient(90deg, rgba(255, 216, 160, 0.08) 0, rgba(255, 216, 160, 0.08) 6px, rgba(0, 0, 0, 0) 6px, rgba(0,0,0,0) 14px);
    border: 1px solid #3c1f10;
    border-radius: 22px;
    padding: 18px;
    box-shadow: inset 0 0 0 3px rgba(255, 214, 170, 0.18), inset 0 0 0 8px rgba(74, 33, 16, 0.75), 0 18px 36px rgba(0,0,0,0.35);
    margin: 0;
    flex: 1 1 0;
    min-width: 640px;
    display: flex;
    align-items: stretch;
    gap: 10px;
}

.tavla-board::before {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 16px;
    border: 1px solid rgba(255, 214, 170, 0.35);
    box-shadow: inset 0 0 0 1px rgba(76, 38, 18, 0.9), 0 0 0 1px rgba(0,0,0,0.2);
    pointer-events: none;
    z-index: 0;
}

.tavla-board::after {
    content: '';
    position: absolute;
    inset: 14px;
    border-radius: 14px;
    box-shadow: inset 0 0 0 2px rgba(255, 236, 200, 0.18);
    pointer-events: none;
    z-index: 0;
}

.tavla-board > * {
    position: relative;
    z-index: 1;
}

.board-anim-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

.tavla-board-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr)) 0.6fr repeat(6, minmax(0, 1fr));
    gap: 6px;
    row-gap: 16px;
    flex: 1 1 auto;
    padding: 8px;
    border-radius: 16px;
    background:
        linear-gradient(180deg, #f1c98d, #c9864b),
        repeating-linear-gradient(90deg, rgba(255, 244, 220, 0.12) 0, rgba(255, 244, 220, 0.12) 8px, rgba(0,0,0,0) 8px, rgba(0,0,0,0) 18px);
    box-shadow: inset 0 0 0 2px rgba(120, 62, 31, 0.35), inset 0 8px 18px rgba(0,0,0,0.15);
}

.point {
    position: relative;
    min-height: 300px;
    background: rgba(87, 45, 22, 0.12);
    border: 1px solid rgba(111, 60, 30, 0.25);
    border-radius: 14px;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    transition: border-color 120ms ease, transform 120ms ease;
    overflow: hidden;
}

.point.bottom {
    justify-content: flex-end;
}

.point::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 6px;
    width: 86%;
    height: calc(100% - 12px);
    transform: translateX(-50%);
    background: linear-gradient(180deg, rgba(255, 236, 196, 0.98), rgba(211, 144, 86, 0.98));
    clip-path: polygon(50% 100%, 100% 0%, 0 0%);
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.18));
    z-index: 1;
}

.point.point-dark::before {
    background: linear-gradient(180deg, rgba(209, 122, 59, 0.98), rgba(96, 44, 18, 0.98));
}

.point.bottom::before {
    top: auto;
    bottom: 6px;
    clip-path: polygon(50% 0%, 100% 100%, 0 100%);
}

.point.can-move {
    border-color: rgba(248, 200, 120, 0.8);
}

.point.can-target {
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.4);
}

.point.can-target.occupied {
    box-shadow: inset 0 0 0 2px rgba(239, 68, 68, 0.55);
}

.point.drop-hover {
    border-color: #f59e0b;
}

.off-area.can-target,
.bar-cell.can-target {
    border-color: rgba(56, 189, 248, 0.6);
}

.off-area.drop-hover,
.bar-cell.drop-hover {
    border-color: var(--accent);
}

.move-hint {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(15, 23, 42, 0.15);
    color: #0f172a;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 999px;
    pointer-events: none;
}

.off-area .move-hint,
.bar-cell .move-hint {
    position: static;
    display: inline-flex;
    margin-top: 6px;
}

.point.selected {
    border-color: #f59e0b;
    transform: translateY(-2px);
}

.point-inner {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    z-index: 2;
}

.point.bottom .point-inner {
    flex-direction: column-reverse;
}

.point-label {
    display: none;
}

.checker {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.75);
    background: radial-gradient(circle at 35% 30%, #ffffff 0%, #e2e8f0 55%, #cbd5f5 100%);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.75), inset 0 -4px 8px rgba(15,23,42,0.25), 0 10px 18px rgba(0,0,0,0.35);
    position: relative;
}

.checker.dragging {
    opacity: 0.35;
    filter: grayscale(20%);
}

.checker.moving-source {
    opacity: 0.2;
    filter: grayscale(10%);
}

.checker.black {
    border-color: rgba(255,255,255,0.15);
    background: radial-gradient(circle at 35% 30%, #475569 0%, #1f2937 55%, #0f172a 100%);
}

.checker::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 7px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.7);
    filter: blur(0.5px);
}

.checker-stack {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 39px;
    height: 39px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: #0f172a;
    font-size: 16px;
    border: 1px solid rgba(15, 23, 42, 0.2);
    box-shadow: 0 6px 12px rgba(15,23,42,0.2);
}

.off-slot .checker {
    width: 42px;
    height: 12px;
    border-radius: 999px;
    border: 2px solid rgba(255,255,255,0.35);
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.6), inset 0 -2px 4px rgba(15,23,42,0.25), 0 4px 6px rgba(0,0,0,0.25);
}

.off-slot .checker-stack {
    display: none;
}

.bar-cell {
    grid-column: 7;
    grid-row: 1 / span 2;
    background:
        linear-gradient(180deg, #6c3216, #4a230f),
        repeating-linear-gradient(90deg, rgba(255, 212, 160, 0.1) 0, rgba(255, 212, 160, 0.1) 6px, rgba(0,0,0,0) 6px, rgba(0,0,0,0) 14px);
    border: 1px solid rgba(48, 22, 9, 0.9);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 15px 9px;
    gap: 12px;
}

.roll-board-btn {
    padding: 10px 14px;
    border-radius: 999px;
    border: 2px solid rgba(255, 230, 190, 0.65);
    background: linear-gradient(135deg, #f6b75b, #d97706);
    color: #3b1f0e;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12px;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.6), 0 8px 14px rgba(0,0,0,0.3);
    cursor: pointer;
}

.roll-board-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 900px) {
    .tavla-board {
        width: 100%;
        min-width: 0;
    }
}

.bar-section {
    text-align: center;
}

.bar-label {
    font-size: 14px;
    color: rgba(255, 240, 200, 0.7);
}

.bar-count {
    font-size: 24px;
    font-weight: 700;
    color: #fff7e1;
}

.off-column {
    width: 120px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.off-slot {
    flex: 1;
    background:
        linear-gradient(180deg, #4b1d12, #2f140b),
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.08), rgba(0,0,0,0) 60%);
    border: 1px solid rgba(48, 22, 9, 0.9);
    border-radius: 14px;
    padding: 10px;
    text-align: center;
    color: rgba(255, 240, 200, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.off-slot .off-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    width: 100%;
}

.off-area {
    border-style: dashed;
}

.off-area.can-move {
    border-color: rgba(56, 189, 248, 0.6);
}

.off-area.selected {
    border-color: var(--accent);
    color: var(--text);
}

.anim-checker {
    position: absolute;
    width: 33px;
    height: 33px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.2);
    background: #f3f4f6;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.3);
    z-index: 10;
    transition: transform 420ms ease, opacity 420ms ease;
}

.anim-checker.black {
    background: #111827;
}

@keyframes dice-bounce {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-6px) rotate(6deg);
    }
    100% {
        transform: translateY(0) rotate(0deg);
    }
}

@keyframes dice-pop {
    0% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

@media (max-width: 900px) {
    .tavla-board-grid {
        grid-template-columns: repeat(6, 1fr) 0.5fr repeat(6, 1fr);
    }
    .point {
        min-height: 150px;
    }
}

@media (max-width: 1200px) {
    .tavla-room-layout {
        flex-direction: column;
    }
    .tavla-chat {
        width: 100%;
        min-height: 300px;
    }
}

@media (max-width: 700px) {
    .status-row {
        flex-direction: column;
        align-items: flex-start;
    }
}
