﻿:root {
            --bg: #f4f6fb;
            --card: #ffffff;
            --text: #1f2937;
            --muted: #6b7280;
            --border: #e5e7eb;
            --shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
            --blue: #2563eb;
            --blue-bg: #dbeafe;
            --danger: #ef4444;
            --danger-dark: #991b1b;
            --status-bg: #eef2ff;
        }

        * {
            box-sizing: border-box;
        }

        body {
            font-family: Arial, "Microsoft YaHei", sans-serif;
            margin: 0;
            padding: 10px;
            background: var(--bg);
            color: var(--text);
            font-size: 14px;
        }

        .container {
            max-width: 1040px;
            margin: 0 auto;
        }

        .compact-mode .container {
            max-width: 980px;
        }

        .top-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 10px;
            margin-bottom: 8px;
            flex-wrap: wrap;
        }

        .title-box h1 {
            margin: 0 0 2px 0;
            font-size: 23px;
            line-height: 1.2;
        }

        .title-box .sub {
            color: var(--muted);
            font-size: 12px;
        }

        .compact-mode .title-box h1 {
            font-size: 21px;
        }

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

        .card {
            background: var(--card);
            border-radius: 12px;
            padding: 10px;
            margin-bottom: 10px;
            box-shadow: var(--shadow);
        }

        .card h2 {
            margin: 0 0 8px 0;
            font-size: 17px;
        }

        .compact-mode .card {
            padding: 8px;
            margin-bottom: 8px;
        }

        .compact-mode .card h2 {
            font-size: 16px;
            margin-bottom: 6px;
        }

        .status-card {
            padding-top: 8px;
            padding-bottom: 8px;
        }

        .status-line {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
            align-items: center;
        }

        .status-badge,
        .winner-badge,
        .turn-badge {
            display: inline-block;
            padding: 4px 9px;
            border-radius: 999px;
            font-weight: bold;
            font-size: 12px;
        }

        .status-badge {
            background: var(--status-bg);
            color: #3730a3;
        }

        .winner-badge {
            background: #fee2e2;
            color: var(--danger-dark);
        }

        .turn-badge {
            background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
            color: #166534;
            box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.12);
        }

        .two-col {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            margin-bottom: 10px;
        }

        .player-panel {
            border-radius: 10px;
            padding: 8px;
        }

        .player-panel.p1-theme {
            background: linear-gradient(180deg, #eff6ff 0%, #f9fbff 100%);
            border: 1px solid #dbeafe;
        }

        .player-panel.p2-theme {
            background: linear-gradient(180deg, #fff1f2 0%, #fffafb 100%);
            border: 1px solid #fecdd3;
        }

        .resource-grid {
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 7px;
        }

        .resource-item {
            background: white;
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 8px;
            min-height: 62px;
        }

        .resource-label {
            font-size: 11px;
            color: var(--muted);
            margin-bottom: 4px;
        }

        .resource-value {
            font-size: 18px;
            font-weight: bold;
            line-height: 1.1;
        }

        .compact-mode .resource-item {
            min-height: 56px;
            padding: 7px;
        }

        .compact-mode .resource-value {
            font-size: 17px;
        }

        .resource-item.theme-hp {
            background: linear-gradient(180deg, #fff1f2 0%, #ffffff 100%);
            border-color: #fecdd3;
        }

        .resource-item.theme-qi {
            background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
            border-color: #bfdbfe;
        }

        .resource-item.theme-shield {
            background: linear-gradient(180deg, #eef2ff 0%, #ffffff 100%);
            border-color: #c7d2fe;
        }

        .resource-item.theme-spark {
            background: linear-gradient(180deg, #fff7ed 0%, #ffffff 100%);
            border-color: #fdba74;
        }

        .resource-item.theme-battery {
            background: linear-gradient(180deg, #ecfeff 0%, #ffffff 100%);
            border-color: #a5f3fc;
        }

        .resource-item.theme-pickaxe {
            background: linear-gradient(180deg, #f3f4f6 0%, #ffffff 100%);
            border-color: #d1d5db;
        }

        .resource-item.theme-flash {
            background: linear-gradient(180deg, #faf5ff 0%, #ffffff 100%);
            border-color: #d8b4fe;
        }

        .selection-layout {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            margin-bottom: 10px;
        }

        .move-side {
            border-radius: 12px;
            padding: 10px;
            border: 1px solid #edf2ff;
        }

        .move-side.p1-side {
            background: linear-gradient(180deg, #f7fbff 0%, #ffffff 100%);
            border-color: #dbeafe;
        }

        .move-side.p2-side {
            background: linear-gradient(180deg, #fff8f9 0%, #ffffff 100%);
            border-color: #fecdd3;
        }

        .move-side h3 {
            margin: 0 0 8px 0;
            font-size: 16px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 8px;
        }

        .active-turn-tip {
            font-size: 11px;
            color: var(--muted);
            font-weight: normal;
        }

        .move-group-title {
            margin: 9px 0 5px 0;
            font-size: 12px;
            color: #4b5563;
            font-weight: bold;
        }

        .move-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
            gap: 7px;
        }

        .move-btn-wrap {
            position: relative;
        }

        .move-btn {
            width: 100%;
            border: 1px solid #d1d5db;
            background: white;
            border-radius: 11px;
            padding: 8px 6px;
            cursor: pointer;
            text-align: center;
            transition: 0.15s ease;
            font-size: 12px;
            min-height: 58px;
            position: relative;
            overflow: hidden;
        }

        .move-btn::after {
            content: "";
            position: absolute;
            inset: 0;
            background: linear-gradient(180deg, rgba(255,255,255,0.4), rgba(255,255,255,0));
            pointer-events: none;
        }

        .move-btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
        }

        .move-btn.keyboard-focus {
            box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.18);
        }

        .move-btn.disabled {
            opacity: 0.38;
            cursor: not-allowed;
            background: #f3f4f6;
        }

        .move-label {
            font-size: 14px;
            font-weight: bold;
            margin-bottom: 2px;
            line-height: 1.2;
        }

        .move-name {
            font-size: 10px;
            color: var(--muted);
            line-height: 1.2;
        }

        .move-hotkey {
            position: absolute;
            top: 5px;
            right: 6px;
            font-size: 10px;
            color: rgba(31, 41, 55, 0.45);
            font-weight: bold;
            z-index: 2;
            pointer-events: none;
        }

        .move-btn.selected.p1-selected {
            border: 2px solid #2563eb;
            background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
            color: #1d4ed8;
            font-weight: bold;
            box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.10), 0 4px 10px rgba(37, 99, 235, 0.12);
        }

        .move-btn.selected.p2-selected {
            border: 2px solid #dc2626;
            background: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 100%);
            color: #b91c1c;
            font-weight: bold;
            box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.10), 0 4px 10px rgba(220, 38, 38, 0.12);
        }

        .tooltip {
            position: absolute;
            left: 50%;
            bottom: calc(100% + 6px);
            transform: translateX(-50%);
            width: 220px;
            background: #111827;
            color: white;
            border-radius: 10px;
            padding: 10px;
            font-size: 12px;
            line-height: 1.6;
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
            opacity: 0;
            pointer-events: none;
            transition: 0.12s ease;
            z-index: 20;
        }

        .move-btn-wrap:hover .tooltip {
            opacity: 1;
        }

        .submit-row {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
            align-items: center;
            margin-top: 6px;
        }

        .selection-info-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            margin-top: 8px;
        }

        .selection-box {
            background: #f8fafc;
            border: 1px solid #e5e7eb;
            border-radius: 10px;
            padding: 8px 10px;
            font-size: 13px;
        }

        button.action-btn,
        a.action-btn {
            border: none;
            border-radius: 10px;
            padding: 9px 12px;
            cursor: pointer;
            font-size: 13px;
            font-weight: bold;
            background: #e5e7eb;
            color: #111827;
            text-decoration: none;
            display: inline-block;
        }

        button.action-btn.primary,
        a.action-btn.primary {
            background: #2563eb;
            color: white;
        }

        button.action-btn.danger,
        a.action-btn.danger {
            background: #ef4444;
            color: white;
        }

        button.action-btn.secondary,
        a.action-btn.secondary {
            background: #6b7280;
            color: white;
        }

        button.action-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .message-box {
            margin-top: 8px;
            color: #374151;
            min-height: 18px;
            font-size: 13px;
        }

        .bottom-layout {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
        }

        .round-box {
            background: #f9fafb;
            border-radius: 10px;
            padding: 10px;
            line-height: 1.7;
            font-size: 13px;
            border: 1px solid #edf2f7;
        }

        .round-box.emphasized {
            background: linear-gradient(180deg, #fff7ed 0%, #ffffff 100%);
            border: 1px solid #fdba74;
            box-shadow: 0 0 0 2px rgba(251, 146, 60, 0.12);
        }

        .history-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
            max-height: 240px;
            overflow-y: auto;
        }

        .history-item {
            background: #f9fafb;
            border-radius: 10px;
            padding: 10px;
            border: 1px solid var(--border);
            font-size: 13px;
            line-height: 1.7;
        }

        .muted {
            color: var(--muted);
        }

        .danger-text {
            color: #b91c1c;
            font-weight: bold;
        }

        .good-text {
            color: #15803d;
            font-weight: bold;
        }

        .modal-mask {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.35);
            display: none;
            align-items: center;
            justify-content: center;
            padding: 16px;
            z-index: 1000;
        }

        .modal-mask.show {
            display: flex;
        }

        .modal {
            width: min(720px, 100%);
            max-height: 85vh;
            overflow-y: auto;
            background: white;
            border-radius: 14px;
            padding: 18px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
        }

        .modal h2 {
            margin-top: 0;
        }

        .modal-section {
            margin-bottom: 16px;
            line-height: 1.8;
        }

        .modal-close-row {
            display: flex;
            justify-content: flex-end;
            margin-bottom: 8px;
        }

        .setting-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            padding: 8px 0;
            border-bottom: 1px solid #f1f5f9;
        }

        .setting-item:last-child {
            border-bottom: none;
        }

        input[type="checkbox"] {
            transform: scale(1.12);
        }

        .end-modal-content {
            text-align: center;
            line-height: 1.9;
            font-size: 15px;
        }

        .end-modal-content .big-result {
            font-size: 22px;
            font-weight: bold;
            margin: 10px 0;
        }

        @media (max-width: 900px) {
            .two-col,
            .selection-layout,
            .bottom-layout,
            .selection-info-row {
                grid-template-columns: 1fr;
            }
        }

        @media (max-width: 720px) {
            .resource-grid {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }

            .move-grid {
                grid-template-columns: repeat(3, minmax(0, 1fr));
            }

            .history-list {
                max-height: none;
            }
        }

        @media (max-width: 520px) {
            .move-grid {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
        }
