* {
    box-sizing: border-box;
}

:root {
    --bg: #eef2f7;
    --bg-soft: #f7f9fc;
    --card: #ffffff;
    --card-2: #f9fbfe;
    --border: #dbe3ec;
    --border-strong: #cfd8e3;
    --text: #111827;
    --muted: #66778f;
    --accent: #ff4500;
    --accent-2: #0b57d0;
    --success: #16a34a;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --pixel-size: 14px;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Inter, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(255, 69, 0, 0.10), transparent 24%),
        radial-gradient(circle at top right, rgba(11, 87, 208, 0.08), transparent 20%),
        linear-gradient(180deg, #f4f7fb 0%, #edf2f8 100%);
}

body {
    overflow-x: hidden;
}

.page-shell {
    min-height: 100vh;
    padding: 24px;
}

.app-shell {
    max-width: 1560px;
    margin: 0 auto;
    background: rgba(255,255,255,0.50);
    border: 1px solid rgba(255,255,255,0.55);
    border-radius: 32px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
    overflow: hidden;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 24px 28px;
    background: rgba(255,255,255,0.72);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ff5a1f, #ff4500);
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.04em;
    box-shadow: 0 14px 28px rgba(255, 69, 0, 0.20);
    flex-shrink: 0;
}

.brand-copy h1 {
    margin: 0;
    font-size: 30px;
    letter-spacing: -0.04em;
    font-weight: 800;
    color: #141922;
}

.brand-copy p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 15px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.88);
    color: #314155;
    font-size: 15px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.meta-chip strong {
    color: #0f172a;
    font-size: 15px;
}

.online-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.10);
}

.refresh-btn {
    height: 46px;
    border: 0;
    border-radius: 999px;
    padding: 0 20px;
    background: linear-gradient(135deg, #ff5a1f, #ff4500);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 14px 24px rgba(255, 69, 0, 0.18);
    transition: transform 0.12s ease, opacity 0.12s ease;
}

.refresh-btn:hover {
    transform: translateY(-1px);
    opacity: 0.96;
}

.workspace {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 22px;
    padding: 22px;
}

.sidebar,
.main-area {
    min-width: 0;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.hero-card,
.stats-card,
.info-card,
.canvas-shell,
.palette-dock {
    padding: 22px;
}

.hero-card {
    background:
        linear-gradient(135deg, rgba(255, 69, 0, 0.06), rgba(11, 87, 208, 0.04)),
        #ffffff;
}

.hero-label {
    display: inline-block;
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 69, 0, 0.08);
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.hero-card h2,
.canvas-header h2,
.palette-head h2,
.info-card h2 {
    margin: 0;
    font-size: 24px;
    letter-spacing: -0.03em;
}

.hero-card p,
.canvas-header p,
.palette-head p {
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.6;
}

.stats-card {
    display: grid;
    gap: 12px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--card-2);
}

.stat-row span {
    color: #566881;
}

.stat-row strong {
    color: #0f172a;
    font-size: 17px;
}

.info-card ul {
    margin: 14px 0 0;
    padding-left: 18px;
    color: #54657d;
    line-height: 1.75;
}

.main-area {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.canvas-shell {
    padding: 18px;
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.canvas-stage {
    min-height: 680px;
    max-height: calc(100vh - 270px);
    overflow: auto;
    padding: 18px;
    border-radius: 24px;
    background:
        linear-gradient(180deg, #eef3f8, #e6ecf3);
    border: 1px solid var(--border-strong);
}

.board {
    display: grid;
    gap: 1px;
    width: max-content;
    padding: 12px;
    margin: 0 auto;
    border-radius: 18px;
    background: #d4dbe4;
    border: 1px solid #c5ced9;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.45);
}

.pixel {
    width: var(--pixel-size);
    height: var(--pixel-size);
    border: 0;
    border-radius: 2px;
    background: #ffffff;
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.10s ease, filter 0.10s ease;
}

.pixel:hover {
    transform: scale(1.05);
    box-shadow: inset 0 0 0 1px rgba(255, 69, 0, 0.65);
    filter: brightness(0.98);
}

.palette-dock {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,253,0.98));
}

.palette-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.selected-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    color: #4f627a;
}

.selected-preview {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid var(--border);
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.28);
}

.selected-row code {
    padding: 6px 10px;
    border-radius: 12px;
    background: #f3f6fa;
    color: #111827;
    border: 1px solid var(--border);
    font-size: 14px;
}

.palette {
    display: grid;
}

.palette-wide {
    grid-template-columns: repeat(8, minmax(0, 56px));
    gap: 12px;
    justify-content: flex-start;
}

.color-btn {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.40);
}

.color-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.10);
}

.color-btn.active {
    border-color: #0f172a;
    box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.08);
}

.canvas-stage::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.canvas-stage::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.35);
    border-radius: 999px;
}

.canvas-stage::-webkit-scrollbar-track {
    background: rgba(148, 163, 184, 0.10);
    border-radius: 999px;
}

@media (max-width: 1220px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .workspace {
        grid-template-columns: 1fr;
    }

    .canvas-stage {
        min-height: 520px;
        max-height: 72vh;
    }
}

@media (max-width: 760px) {
    .page-shell {
        padding: 12px;
    }

    .topbar,
    .workspace {
        padding: 16px;
    }

    .brand-copy h1 {
        font-size: 24px;
    }

    .meta-chip,
    .refresh-btn {
        width: 100%;
        justify-content: center;
    }

    .palette-wide {
        grid-template-columns: repeat(4, minmax(0, 56px));
    }

    .canvas-stage {
        min-height: 420px;
    }
}