:root {
    color-scheme: light;
    --bg: #f7efe2;
    --bg-deep: #efd8bc;
    --panel: rgba(255, 251, 245, 0.9);
    --panel-strong: rgba(255, 248, 240, 0.95);
    --border: rgba(100, 53, 26, 0.16);
    --text: #24160f;
    --muted: #6d5444;
    --accent: #c64f24;
    --accent-soft: #f0b368;
    --win: #1f8b4c;
    --lose: #b33636;
    --shadow: 0 18px 44px rgba(72, 34, 9, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Bahnschrift", "Trebuchet MS", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.85), transparent 28%),
        linear-gradient(135deg, var(--bg) 0%, #efd4b3 45%, var(--bg-deep) 100%);
    overflow-x: hidden;
}

.background-glow {
    position: fixed;
    width: 20rem;
    height: 20rem;
    border-radius: 999px;
    filter: blur(12px);
    opacity: 0.42;
    z-index: 0;
    pointer-events: none;
}

.background-glow-left {
    top: -6rem;
    left: -8rem;
    background: radial-gradient(circle, rgba(255, 199, 95, 0.95), rgba(255, 199, 95, 0));
}

.background-glow-right {
    right: -6rem;
    bottom: -7rem;
    background: radial-gradient(circle, rgba(224, 113, 63, 0.85), rgba(224, 113, 63, 0));
}

.app-shell {
    position: relative;
    z-index: 1;
    width: min(1280px, calc(100% - 1.25rem));
    margin: 0 auto;
    padding: 0.8rem 0 1rem;
}

.hero-panel,
.start-panel,
.log-panel,
.play-card,
.score-card,
.status-panel {
    backdrop-filter: blur(14px);
}

.login-gate {
    width: min(560px, 100%);
    margin: 1.2rem auto;
    padding: 1.2rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 26px;
    box-shadow: var(--shadow);
}

.login-copy {
    margin: 0.35rem 0 0;
    color: var(--muted);
}

.login-form {
    margin-top: 0.8rem;
    display: grid;
    gap: 0.7rem;
}

.register-form {
    margin-top: 0.55rem;
}

.login-divider {
    margin-top: 0.6rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.login-form label {
    display: grid;
    gap: 0.35rem;
    font-weight: 700;
}

.login-form input {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(100, 53, 26, 0.2);
    padding: 0.64rem 0.78rem;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
    font: inherit;
}

.hero-panel,
.start-panel,
.log-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 26px;
    box-shadow: var(--shadow);
}

.hero-panel {
    padding: 0.8rem 1rem;
    animation: rise-in 420ms ease-out;
}

.eyebrow {
    margin: 0 0 0.2rem;
    color: var(--accent);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.hero-row {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    align-items: start;
}

.hero-actions {
    display: flex;
    gap: 0.55rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: end;
}

.user-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.56rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(100, 53, 26, 0.14);
    background: rgba(255, 251, 245, 0.72);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.ghost-link {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.8rem, 2.6vw, 2.9rem);
    line-height: 0.95;
}

.deck-title-line {
    margin: 0.4rem 0 0;
    font-size: 0.86rem;
    font-weight: 700;
}

.hero-copy {
    margin: 0.3rem 0 0;
    max-width: 44rem;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.28;
}

.mode-switch {
    margin-top: 0.65rem;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.action-button,
.ghost-button,
.deck-card {
    font: inherit;
}

.action-button,
.ghost-button {
    border-radius: 999px;
    padding: 0.62rem 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.action-button {
    border: 0;
    background: linear-gradient(135deg, var(--accent) 0%, #db7a2f 100%);
    color: #fffaf4;
    box-shadow: 0 12px 24px rgba(198, 79, 36, 0.22);
}

.ghost-button {
    border: 1px solid rgba(100, 53, 26, 0.16);
    background: rgba(255, 251, 245, 0.72);
    color: var(--text);
}

.action-button:hover,
.action-button:focus-visible,
.ghost-button:hover,
.ghost-button:focus-visible,
.deck-card:hover,
.deck-card:focus-visible {
    transform: translateY(-2px);
}

.ghost-button[aria-pressed="true"] {
    border-color: rgba(31, 139, 76, 0.3);
    background: rgba(229, 249, 236, 0.9);
}

.ghost-button.is-active {
    border-color: rgba(31, 139, 76, 0.36);
    background: rgba(223, 250, 233, 0.95);
}

.scoreboard {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
    margin-top: 0.7rem;
}

.score-card {
    display: grid;
    gap: 0.12rem;
    padding: 0.55rem 0.8rem;
    background: rgba(255, 250, 244, 0.8);
    border: 1px solid rgba(100, 53, 26, 0.1);
    border-radius: 20px;
}

.score-card-accent {
    background: linear-gradient(135deg, rgba(255, 198, 132, 0.52), rgba(255, 244, 228, 0.9));
}

.score-label,
.status-label,
.card-owner,
.card-archetype,
.history-list li span {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
}

.score-value {
    font-size: clamp(1.2rem, 1.9vw, 1.7rem);
    line-height: 1;
}

.score-subtitle {
    color: var(--muted);
    font-size: 0.8rem;
}

.status-panel {
    margin-top: 0.55rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
    padding: 0.65rem 0.8rem;
    background: rgba(255, 249, 241, 0.76);
    border: 1px solid rgba(100, 53, 26, 0.1);
    border-radius: 22px;
}

.status-text,
.result-text {
    margin: 0.18rem 0 0;
    font-size: 0.84rem;
    line-height: 1.24;
}

.save-feedback {
    min-height: 1rem;
    margin: 0.45rem 0 0;
    color: var(--muted);
    font-size: 0.78rem;
}

.start-panel {
    margin-top: 0.9rem;
    padding: 1rem;
    animation: rise-in 420ms ease-out;
}

.start-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: start;
}

.start-panel-header h2,
.start-copy {
    margin: 0;
}

.start-copy {
    margin-top: 0.6rem;
    color: var(--muted);
    max-width: 44rem;
    line-height: 1.4;
    font-size: 0.9rem;
}

.deck-count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 0.95rem;
    border-radius: 999px;
    background: rgba(255, 247, 238, 0.92);
    border: 1px solid rgba(100, 53, 26, 0.12);
    font-weight: 700;
}

.deck-list {
    margin-top: 0.85rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.8rem;
}

.saved-games-panel {
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid rgba(100, 53, 26, 0.1);
}

.online-panel {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 22px;
    border: 1px solid rgba(100, 53, 26, 0.1);
    background:
        linear-gradient(155deg, rgba(255, 248, 240, 0.95), rgba(255, 241, 228, 0.84)),
        radial-gradient(circle at top right, rgba(255, 196, 128, 0.24), transparent 28%);
}

.online-panel-header,
.online-card,
.online-field {
    display: grid;
}

.online-actions,
.online-lobby-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.online-panel-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.8rem;
    align-items: start;
}

.online-panel-header h3,
.online-card h4,
.online-card p {
    margin: 0;
}

.online-status-text {
    margin: 0.7rem 0 0;
    padding: 0.8rem 0.95rem;
    border-radius: 18px;
    background: rgba(255, 251, 246, 0.82);
    border: 1px solid rgba(100, 53, 26, 0.1);
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.35;
}

.online-challenge-panel {
    margin-top: 0.75rem;
    padding: 0.85rem 0.95rem;
    border-radius: 18px;
    border: 1px solid rgba(100, 53, 26, 0.14);
    background: rgba(255, 248, 239, 0.86);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.online-grid {
    margin-top: 0.8rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.online-card {
    gap: 0.65rem;
    padding: 0.95rem;
    border-radius: 20px;
    border: 1px solid rgba(100, 53, 26, 0.1);
    background: rgba(255, 252, 248, 0.82);
}

.online-card p {
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.35;
}

.online-users-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.42rem;
}

.online-user-item {
    padding: 0.56rem 0.68rem;
    border-radius: 14px;
    border: 1px solid rgba(100, 53, 26, 0.12);
    background: rgba(255, 255, 255, 0.82);
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    align-items: center;
    font-size: 0.84rem;
}

.online-user-item.me {
    border-color: rgba(31, 139, 76, 0.24);
    background: rgba(232, 251, 238, 0.85);
}

.online-user-tag {
    color: var(--muted);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.online-lobby-actions {
    margin-top: 0.2rem;
}

.online-user-menu {
    position: fixed;
    z-index: 20;
    min-width: 168px;
    padding: 0.45rem;
    border-radius: 14px;
    border: 1px solid rgba(100, 53, 26, 0.14);
    background: rgba(255, 252, 248, 0.98);
    box-shadow: 0 16px 30px rgba(72, 34, 9, 0.18);
}

.online-user-menu button {
    width: 100%;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 700;
    text-align: left;
    padding: 0.5rem 0.6rem;
    cursor: pointer;
}

.online-user-menu button:hover,
.online-user-menu button:focus-visible {
    background: rgba(198, 79, 36, 0.12);
}

.online-field {
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 700;
}

.online-field textarea {
    width: 100%;
    min-height: 8.4rem;
    resize: vertical;
    border-radius: 16px;
    border: 1px solid rgba(100, 53, 26, 0.18);
    padding: 0.72rem 0.8rem;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
    font: inherit;
    line-height: 1.35;
}

.online-field textarea[readonly] {
    background: rgba(249, 245, 239, 0.95);
}

.deck-card:disabled,
.ghost-button:disabled,
.action-button:disabled,
.saved-game-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
    transform: none;
    box-shadow: none;
}

.saved-games-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: start;
}

.saved-games-header h3 {
    margin: 0;
    font-size: 1rem;
}

.saved-games-list {
    margin-top: 0.8rem;
    display: grid;
    gap: 0.7rem;
}

.saved-game-card {
    display: grid;
    gap: 0.45rem;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    border: 1px solid rgba(100, 53, 26, 0.1);
    background: rgba(255, 250, 244, 0.78);
}

.saved-game-topline,
.saved-game-actions {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}

.saved-game-name {
    font-weight: 700;
}

.saved-game-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 0.35rem;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    background: rgba(198, 79, 36, 0.12);
    color: var(--accent);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.saved-game-meta,
.saved-game-warning,
.saved-game-empty {
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.35;
}

.saved-game-warning {
    color: var(--lose);
}

.saved-game-actions button {
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(100, 53, 26, 0.14);
    background: white;
    color: var(--text);
    cursor: pointer;
}

.saved-game-actions .saved-game-delete {
    border-color: rgba(179, 54, 54, 0.18);
    color: var(--lose);
}

.saved-game-empty {
    padding: 0.9rem 0;
}

.deck-card {
    display: grid;
    gap: 0.45rem;
    padding: 1rem;
    border-radius: 22px;
    border: 1px solid rgba(100, 53, 26, 0.1);
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.8), rgba(255, 247, 238, 0.94)),
        linear-gradient(135deg, rgba(255, 205, 150, 0.32), rgba(255, 243, 228, 0.12));
    color: var(--text);
    text-align: left;
    cursor: pointer;
    box-shadow: 0 14px 30px rgba(72, 34, 9, 0.08);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.deck-card-type {
    color: var(--accent);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.deck-card-title {
    font-size: 1.08rem;
}

.deck-card-description,
.deck-card-meta {
    color: var(--muted);
    line-height: 1.35;
    font-size: 0.88rem;
}

.game-area.is-hidden,
.start-panel.is-hidden,
.is-hidden {
    display: none;
}

.game-layout {
    margin-top: 0.9rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 0.85rem;
    align-items: start;
}

.table-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 128px minmax(0, 1fr);
    align-items: stretch;
    gap: 0.8rem;
}

.play-card {
    background: var(--panel-strong);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 0.95rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    animation: rise-in 520ms ease-out;
    transition: transform 220ms ease, box-shadow 220ms ease, filter 220ms ease, opacity 220ms ease;
}

.play-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.55), transparent 30%, transparent 68%, rgba(255, 189, 135, 0.23));
    pointer-events: none;
}

.player-card {
    transform-origin: center left;
}

.cpu-card {
    transform-origin: center right;
}

.card-topline {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.card-owner,
.card-archetype {
    margin: 0;
}

.car-name {
    margin: 0 0 0.8rem;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.15rem, 1.9vw, 1.7rem);
}

.card-visual {
    position: relative;
    margin-bottom: 0.8rem;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid rgba(100, 53, 26, 0.1);
    min-height: 165px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0)),
        linear-gradient(135deg, rgba(255, 205, 150, 0.7), rgba(255, 243, 228, 0.95));
}

.card-hidden {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)),
        linear-gradient(135deg, #5f4538, #2d2019 72%);
}

.card-hidden .card-image {
    filter: brightness(0.2) blur(3px) saturate(0.15);
    transform: scale(1.03);
}

.card-hidden .visual-badge {
    background: rgba(29, 20, 16, 0.7);
    color: rgba(255, 246, 236, 0.92);
    border-color: rgba(255, 241, 229, 0.14);
}

.card-back-overlay {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    background:
        linear-gradient(135deg, rgba(29, 20, 16, 0.44), rgba(12, 8, 6, 0.62)),
        repeating-linear-gradient(135deg, rgba(255, 231, 208, 0.1) 0 12px, rgba(255, 231, 208, 0.02) 12px 24px);
    backdrop-filter: blur(2px);
}

.card-hidden .card-back-overlay {
    display: grid;
}

.card-back-inner {
    width: min(78%, 240px);
    aspect-ratio: 4 / 5;
    border-radius: 22px;
    padding: 0.85rem;
    display: grid;
    align-content: space-between;
    background: linear-gradient(160deg, rgba(255, 246, 235, 0.15), rgba(255, 246, 235, 0.04));
    border: 1px solid rgba(255, 240, 224, 0.18);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.18);
}

.card-back-grid {
    height: 100%;
    border-radius: 18px;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 194, 120, 0.2), transparent 30%),
        linear-gradient(135deg, rgba(255, 207, 153, 0.18), rgba(255, 237, 218, 0.04)),
        repeating-linear-gradient(0deg, rgba(255, 239, 224, 0.12) 0 10px, rgba(255, 239, 224, 0.02) 10px 20px),
        repeating-linear-gradient(90deg, rgba(255, 239, 224, 0.12) 0 10px, rgba(255, 239, 224, 0.02) 10px 20px);
    border: 1px solid rgba(255, 233, 212, 0.18);
}

.card-back-label {
    text-align: center;
    color: rgba(255, 246, 236, 0.92);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.card-image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    transform-origin: center;
    transition: transform 320ms ease, filter 320ms ease;
}

.visual-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: start;
    justify-content: end;
    padding: 0.6rem;
    pointer-events: none;
}

.visual-badge {
    padding: 0.35rem 0.58rem;
    border-radius: 999px;
    background: rgba(255, 252, 247, 0.82);
    border: 1px solid rgba(100, 53, 26, 0.12);
    color: var(--text);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stats-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.stat-item {
    display: grid;
}

.stat-button,
.stat-display {
    width: 100%;
    border-radius: 16px;
    padding: 0.62rem 0.75rem;
    border: 1px solid rgba(100, 53, 26, 0.12);
    background: rgba(255, 255, 255, 0.72);
    text-align: left;
}

.stat-button {
    cursor: pointer;
    color: inherit;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.stat-button:hover:enabled,
.stat-button:focus-visible:enabled {
    transform: translateY(-2px);
    border-color: rgba(198, 79, 36, 0.4);
    box-shadow: 0 10px 24px rgba(198, 79, 36, 0.12);
}

.stat-button:disabled {
    cursor: not-allowed;
    opacity: 0.68;
}

.stats-hidden .stat-display {
    background: rgba(36, 23, 17, 0.72);
    border-color: rgba(255, 242, 229, 0.08);
    color: rgba(255, 246, 236, 0.92);
}

.stats-hidden .stat-name,
.stats-hidden .stat-hint,
.stats-hidden .stat-value {
    color: rgba(255, 246, 236, 0.92);
}

.stat-selected {
    border-color: rgba(198, 79, 36, 0.6);
    box-shadow: 0 10px 24px rgba(198, 79, 36, 0.18);
}

.stat-win {
    border-color: rgba(31, 139, 76, 0.5);
    background: rgba(223, 251, 233, 0.92);
}

.stat-lose {
    border-color: rgba(179, 54, 54, 0.45);
    background: rgba(255, 233, 233, 0.94);
}

.stat-label-row,
.stat-value-row {
    display: flex;
    justify-content: space-between;
    gap: 0.65rem;
    align-items: baseline;
}

.stat-name {
    font-weight: 700;
}

.stat-hint {
    font-size: 0.74rem;
    color: var(--muted);
}

.stat-value {
    font-size: 0.98rem;
    font-weight: 700;
}

.versus-column {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 0.65rem;
}

.round-pill,
.category-pill,
.versus-mark {
    box-shadow: var(--shadow);
}

.round-pill,
.category-pill {
    width: 100%;
    padding: 0.78rem;
    border-radius: 22px;
    text-align: center;
    border: 1px solid rgba(100, 53, 26, 0.1);
    background: rgba(255, 250, 244, 0.78);
}

.round-pill span {
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-size: 0.72rem;
}

.round-pill strong {
    display: block;
    margin-top: 0.16rem;
    font-size: 1.4rem;
}

.category-pill {
    min-height: 72px;
    display: grid;
    place-items: center;
    color: var(--muted);
    line-height: 1.25;
    font-size: 0.86rem;
}

.versus-mark {
    width: 70px;
    height: 70px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent) 0%, #f3ae54 100%);
    color: white;
    font-size: 1.16rem;
    font-weight: 800;
    transition: transform 220ms ease, box-shadow 220ms ease, filter 220ms ease;
}

.log-panel {
    padding: 0.9rem;
}

.side-log-panel {
    max-height: calc(100vh - 8.8rem);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.log-header {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    align-items: baseline;
}

.log-header h3,
.log-header p {
    margin: 0;
}

.log-header p {
    color: var(--muted);
    font-size: 0.82rem;
}

.history-list {
    margin: 0.8rem 0 0;
    padding: 0 0.15rem 0 0;
    list-style: none;
    display: grid;
    gap: 0.55rem;
    align-content: start;
    overflow: auto;
}

.history-list li {
    display: grid;
    gap: 0.2rem;
    padding: 0.68rem 0.78rem;
    border-radius: 16px;
    background: rgba(255, 251, 245, 0.78);
    border: 1px solid rgba(100, 53, 26, 0.08);
}

.pulse-turn {
    animation: turn-pulse 820ms ease-in-out infinite alternate;
}

.play-card.card-reveal {
    animation: card-reveal 500ms cubic-bezier(0.2, 0.9, 0.25, 1);
}

.play-card.card-reveal .card-image {
    animation: image-reveal 620ms cubic-bezier(0.2, 0.9, 0.25, 1);
}

.play-card.card-duel {
    animation: card-duel 420ms ease;
}

.play-card.card-win {
    animation: card-win 760ms cubic-bezier(0.2, 0.84, 0.2, 1);
}

.play-card.card-lose {
    animation: card-lose 760ms cubic-bezier(0.2, 0.84, 0.2, 1);
}

.play-card.card-draw {
    animation: card-draw 560ms ease;
}

.versus-mark.duel-flash {
    animation: versus-flash 620ms ease;
}

.versus-mark.outcome-win {
    animation: versus-win 760ms ease;
}

.versus-mark.outcome-lose {
    animation: versus-lose 760ms ease;
}

.versus-mark.outcome-draw {
    animation: versus-draw 560ms ease;
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes turn-pulse {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.02);
    }
}

@keyframes card-reveal {
    from {
        opacity: 0.72;
        transform: translateY(18px) rotateX(10deg) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) rotateX(0) scale(1);
    }
}

@keyframes image-reveal {
    from {
        transform: scale(1.08);
        filter: saturate(0.78) blur(1px);
    }

    to {
        transform: scale(1);
        filter: saturate(1) blur(0);
    }
}

@keyframes card-duel {
    0% {
        transform: translateX(0) scale(1);
    }

    35% {
        transform: translateX(10px) scale(1.02);
    }

    70% {
        transform: translateX(-6px) scale(0.995);
    }

    100% {
        transform: translateX(0) scale(1);
    }
}

@keyframes card-win {
    0% {
        transform: translateY(0) scale(1);
        box-shadow: var(--shadow);
    }

    35% {
        transform: translateY(-10px) scale(1.03);
        box-shadow: 0 24px 54px rgba(31, 139, 76, 0.2);
    }

    100% {
        transform: translateY(0) scale(1);
        box-shadow: var(--shadow);
    }
}

@keyframes card-lose {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    30% {
        transform: translateY(10px) scale(0.985) rotate(-1deg);
        opacity: 0.88;
    }

    100% {
        transform: translateY(0) scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes card-draw {
    0% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.015);
    }

    60% {
        transform: scale(0.992);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes versus-flash {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }

    40% {
        transform: scale(1.12);
        filter: brightness(1.08);
    }

    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

@keyframes versus-win {
    0% {
        transform: scale(1);
        box-shadow: var(--shadow);
    }

    35% {
        transform: scale(1.14);
        box-shadow: 0 22px 56px rgba(31, 139, 76, 0.28);
    }

    100% {
        transform: scale(1);
        box-shadow: var(--shadow);
    }
}

@keyframes versus-lose {
    0% {
        transform: scale(1);
    }

    35% {
        transform: scale(0.94);
        filter: saturate(0.88);
    }

    100% {
        transform: scale(1);
        filter: saturate(1);
    }
}

@keyframes versus-draw {
    0% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-6deg);
    }

    75% {
        transform: rotate(6deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .play-card,
    .card-image,
    .versus-mark,
    .pulse-turn {
        animation: none !important;
        transition: none !important;
    }
}

@media (max-width: 1100px) {
    .game-layout {
        grid-template-columns: 1fr;
    }

    .side-log-panel {
        max-height: 320px;
    }
}

@media (max-width: 920px) {
    .table-layout {
        grid-template-columns: 1fr;
    }

    .versus-column {
        order: -1;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: center;
    }

    .category-pill {
        min-height: auto;
    }
}

@media (max-width: 640px) {
    .app-shell {
        width: min(100% - 0.85rem, 1280px);
        padding-top: 0.55rem;
    }

    .hero-panel,
    .play-card,
    .log-panel,
    .start-panel {
        border-radius: 22px;
    }

    .hero-row,
    .start-panel-header,
    .online-panel-header,
    .saved-games-header,
    .log-header,
    .status-panel,
    .scoreboard {
        display: grid;
        grid-template-columns: 1fr;
    }

    .online-grid {
        grid-template-columns: 1fr;
    }

    .online-challenge-panel {
        display: grid;
        grid-template-columns: 1fr;
    }

    .hero-row {
        align-items: stretch;
    }

    .hero-actions {
        justify-content: stretch;
    }

    .ghost-button,
    .action-button {
        width: 100%;
    }

    .versus-column {
        grid-template-columns: 1fr;
    }

    .versus-mark {
        width: 74px;
        height: 74px;
    }

    .side-log-panel {
        max-height: 280px;
    }
}