/* --- RESET & TYPOGRAPHY --- */
:root {
    /* DARK MODE PALETTE (Default) */
    --bg-body: #0e121a;
    --bg-sidebar: #0f141d;
    --bg-panel: #121826;
    --bg-surface: #182233;
    --bg-input: #1d2736;
    
    --text-primary: #f1f5f9;
    --text-secondary: #c6d1e0;
    --text-muted: #8b98ac;

    --border: rgba(148, 163, 184, 0.2);
    --border-light: rgba(148, 163, 184, 0.35);

    --primary: #1f6feb;
    --primary-hover: #1a5fd1;
    --primary-glow: rgba(31, 111, 235, 0.22);

    --success: #22c55e;
    --danger: #f87171;
    --accent: #3b82f6;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --shadow-sm: 0 1px 2px rgba(2, 6, 23, 0.25);
    --shadow-md: 0 8px 18px rgba(2, 6, 23, 0.3);
    --shadow-lg: 0 20px 40px rgba(2, 6, 23, 0.35);

    --font-main: 'Manrope', 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
    --font-display: 'Space Grotesk', 'Manrope', 'SF Pro Display', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'SFMono-Regular', 'Fira Code', Consolas, monospace;

    --nav-width: 72px;
}

/* LIGHT MODE OVERRIDES */
html[data-theme="light"] {
    --bg-body: #f6f8fb;
    --bg-sidebar: #ffffff;
    --bg-panel: #ffffff;
    --bg-surface: #f1f5f9;
    --bg-input: #e8eef6;

    --text-primary: #0b1220;
    --text-secondary: #334155;
    --text-muted: #5f6b7d;

    --border: rgba(148, 163, 184, 0.35);
    --border-light: rgba(148, 163, 184, 0.45);

    --primary: #1f6feb;
    --primary-hover: #1a5fd1;
    --primary-glow: rgba(31, 111, 235, 0.18);
    --accent: #2f81f7;
    
    --shadow-lg: 0 10px 22px rgba(15, 23, 42, 0.08), 0 3px 8px rgba(15, 23, 42, 0.05);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background-color: var(--bg-body);
    background-image:
        radial-gradient(1100px 700px at 0% -10%, rgba(31, 111, 235, 0.08), transparent 55%);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 15px;
    line-height: 1.55;
    letter-spacing: 0.1px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    height: 100vh;
    display: flex;
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

html[data-theme="light"] body {
    background-image:
        radial-gradient(1000px 700px at 0% -10%, rgba(31, 111, 235, 0.08), transparent 55%);
}

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font-family: var(--font-main); }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-glow);
    border-color: var(--primary);
}

/* --- ANIMATIONS --- */
@keyframes slideIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--primary-glow); } 70% { box-shadow: 0 0 0 6px rgba(0,0,0,0); } 100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); } }

/* Base: single-line select */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font-family: var(--font-main);
  font-size: 13px;
  line-height: 1.2;
  width: 100%;
  cursor: pointer;

  /* Visuals */
  background-color: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 40px 10px 12px; /* extra right space for arrow */

  /* Arrow uses currentColor so it auto-themes */
  background-image: url("data:image/svg+xml;utf8,\<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'>\<polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;

  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease, color .15s ease;
}

/* Hover/active/focus states */
select:hover {
  border-color: var(--border-strong, var(--primary));
}

select:active {
  box-shadow: inset 0 1px 0 rgba(0,0,0,.08);
}

select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Disabled */
select:disabled {
  cursor: not-allowed;
  opacity: .6;
}

/* Windows IE/Edge legacy arrow */
select::-ms-expand {
  display: none;
}

html[data-theme="light"] select {
  background-image: url("data:image/svg+xml;utf8,\<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'>\<polyline points='6 9 12 15 18 9'/></svg>");
}

/* Multiple select: remove the single-line arrow and adjust padding */
select[multiple] {
  background-image: none;
  padding-right: 12px;
  min-height: 120px;
  line-height: 1.3;
  overflow: auto;
}

/* Size variants (opt-in classes) */
select.select--sm { font-size: 12px; padding: 8px 36px 8px 10px; }
select.select--lg { font-size: 14px; padding: 12px 44px 12px 14px; }

/* High-contrast fallback for environments without --primary-glow */
@supports not (color: color(display-p3 1 1 1)) {
  select:focus {
    box-shadow: 0 0 0 2px rgba(0, 123, 255, .25);
  }
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-field {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input-field--sm {
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 8px;
}

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

.input-inline .input-field {
    flex: 1;
}

.color-input {
    width: 44px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    padding: 0;
    cursor: pointer;
}

.color-input::-webkit-color-swatch {
    border: none;
    border-radius: 8px;
}

.color-input::-webkit-color-swatch-wrapper {
    padding: 4px;
}

.range-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.range-row input[type="range"] {
    flex: 1;
}

.range-value {
    min-width: 44px;
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.hint {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

/* --- 1. GLOBAL NAVIGATION (POPOUT SIDEBAR) --- */
.global-nav {
    width: var(--nav-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);

    display: flex;
    flex-direction: column;

    /* key change: don’t switch align-items on hover */
    align-items: stretch;

    padding: 22px 0;
    z-index: 100;
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.25);
    position: fixed;
    overflow: hidden;

    transition: width 0.35s cubic-bezier(.4,0,.2,1);
    will-change: width;
    backdrop-filter: blur(6px);
}

/* expand */
.global-nav:hover,
.global-nav:has(:hover) {
    width: 220px;
}

/* brand (logo) – fixed layout so it never “moves” */
.nav-brand {
    width: 100%;
    height: 44px;
    margin-bottom: 28px;

    display: grid;
    grid-template-columns: var(--nav-width) 1fr;
    align-items: center;

    color: var(--primary);
    font-size: 24px;

    /* no padding-left/justify swapping */
}

.nav-brand i {
    justify-self: center;  /* always centered in the icon column */
}

/* nav links */
.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    flex: 1;
}

.nav-links li {
    width: 100%;
    margin-bottom: 8px;
}

/* nav items already use a stable grid, keep it that way */
.nav-item {
    width: 100%;
    height: 46px;

    display: grid;
    grid-template-columns: var(--nav-width) 1fr;
    align-items: center;

    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;

    border-radius: 12px;
    margin: 0 10px;
    padding-right: 10px;

    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-item i {
    justify-self: center;
    font-size: 18px;
    min-width: var(--nav-width);
    text-align: center;
}

button.nav-item {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    text-align: left;
}

.nav-item:hover {
    color: var(--text-primary);
    background-color: rgba(31, 111, 235, 0.12);
    transform: translateX(1px);
}

.nav-item.active {
    color: var(--text-primary);
    background: rgba(31, 111, 235, 0.16);
    box-shadow: inset 0 0 0 1px rgba(31, 111, 235, 0.28);
    border-right: 3px solid var(--primary);
}

/* text reveal – only animate opacity/transform, don’t move the whole row */
.link-text {
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.global-nav:hover .link-text,
.global-nav:has(:hover) .link-text {
    opacity: 1;
    transform: translateX(0);
}

.nav-footer {
    transition: all 0.35s;
    align-content: center;
    align-self: center;
    align-items: center;
    width: 40%;
    display: grid;
    justify-content: center;
    justify-items: center;
    grid-template-columns: 1fr;
    gap: 15px;
    padding: 0 8px 10px;
}

.global-nav:hover .nav-footer,
.global-nav:has(:hover) .nav-footer {
    transition: all 0.35s;
    grid-template-columns: repeat(2, 1fr);
    justify-content: center;
    justify-items: center;
}

.nav-footer .nav-item {
    margin: 0;
    height: 44px;
}

.nav-footer .link-text {
    display: none;
}

html[data-theme="light"] .global-nav {
    background: var(--bg-sidebar);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

/* --- THEME TOGGLE --- */
.theme-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 42px;
    height: 42px;
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}
.theme-btn:hover { background-color: var(--bg-surface); color: var(--primary); }

/* --- 2. MAIN APP SHELL --- */
.app-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: var(--nav-width, 64px);
    height: 100%;
    background-color: transparent;
}

.top-bar {
    height: 64px;
    border-bottom: 1px solid var(--border);
    background-color: rgba(18, 24, 38, 0.92);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    padding: 0 24px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 5;
}
.top-bar-inner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    background-color: var(--bg-surface);
    padding: 4px;
    border-radius: 999px;
    border: 1px solid var(--border);
}

.tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover { color: var(--text-primary); }

.tab-btn.active {
    background-color: var(--bg-panel);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    border-color: var(--border-light);
    font-weight: 600;
}

/* Content Area */
.content-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.tab-content {
    display: none;
    height: 100%;
    width: 100%;
    animation: slideIn 0.3s ease-out;
}
.tab-content.active { display: block; }

html[data-theme="light"] .top-bar {
    background-color: rgba(255, 255, 255, 0.92);
}

.page-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.2px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Tools page */
.tools-container {
    padding: 24px 28px 36px;
    max-width: 1200px;
    margin: 0 auto;
}

.tools-header {
    margin-bottom: 24px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.tool-widget {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.tool-widget:hover {
    transform: translateY(-1px);
    border-color: var(--border-light);
    box-shadow: 0 10px 22px rgba(2, 6, 23, 0.28);
}

.tool-preview {
    height: 150px;
    border-radius: 14px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.tool-preview-label {
    position: absolute;
    top: 12px;
    left: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: rgba(248, 250, 252, 0.86);
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(148, 163, 184, 0.3);
    padding: 4px 9px;
    border-radius: 999px;
}

.preview-studio {
    background:
                radial-gradient(circle at 20% 20%, rgba(31, 111, 235, 0.22), transparent 60%),
                linear-gradient(160deg, #111827, #171f2d);
}

.preview-map {
    background:
                radial-gradient(circle at 10% 10%, rgba(34, 197, 94, 0.22), transparent 60%),
                linear-gradient(160deg, #0f172a, #111826);
}

.preview-savestring {
    background:
                radial-gradient(circle at 15% 12%, rgba(34, 197, 94, 0.2), transparent 52%),
                radial-gradient(circle at 90% 88%, rgba(31, 111, 235, 0.24), transparent 48%),
                linear-gradient(160deg, #091421, #0d1a27 55%, #0a1522);
}

.preview-code {
    background:
                radial-gradient(circle at 18% 12%, rgba(31, 111, 235, 0.22), transparent 58%),
                radial-gradient(circle at 84% 82%, rgba(34, 197, 94, 0.24), transparent 54%),
                linear-gradient(160deg, #0c1220, #121b2a 56%, #0e1421);
}

.tool-preview-grid {
    position: absolute;
    inset: 18px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.15) 1px, transparent 1px);
    background-size: 18px 18px;
}

.tool-preview-hills {
    position: absolute;
    bottom: -10px;
    left: 0;
    right: 0;
    height: 70%;
    background: radial-gradient(circle at 20% 80%, rgba(34, 197, 94, 0.65), transparent 60%),
                radial-gradient(circle at 70% 80%, rgba(34, 197, 94, 0.55), transparent 60%),
                linear-gradient(180deg, rgba(15, 23, 42, 0) 0%, rgba(15, 23, 42, 0.7) 100%);
}

.tool-preview-binary {
    position: absolute;
    inset: 0;
    padding: 38px 14px 14px;
    display: grid;
    align-content: start;
    gap: 4px;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.2;
    color: rgba(134, 239, 172, 0.9);
    letter-spacing: 0.6px;
    text-shadow: 0 0 10px rgba(34, 197, 94, 0.18);
    background:
        linear-gradient(180deg, rgba(6, 12, 20, 0.2) 0%, rgba(6, 12, 20, 0.55) 100%),
        repeating-linear-gradient(
            to bottom,
            rgba(148, 163, 184, 0.05) 0,
            rgba(148, 163, 184, 0.05) 1px,
            transparent 1px,
            transparent 16px
        );
}

.tool-preview-binary span {
    white-space: nowrap;
    opacity: 0.84;
}

.tool-preview-binary span:nth-child(2n) {
    opacity: 0.66;
}

.tool-preview-code-lines {
    position: absolute;
    inset: 0;
    padding: 40px 14px 14px;
    display: grid;
    align-content: start;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.2;
    color: rgba(191, 219, 254, 0.92);
    letter-spacing: 0.2px;
    text-shadow: 0 0 8px rgba(59, 130, 246, 0.18);
    background:
        linear-gradient(180deg, rgba(6, 12, 20, 0.2) 0%, rgba(6, 12, 20, 0.55) 100%),
        repeating-linear-gradient(
            to bottom,
            rgba(148, 163, 184, 0.05) 0,
            rgba(148, 163, 184, 0.05) 1px,
            transparent 1px,
            transparent 16px
        );
}

.tool-preview-code-lines span {
    white-space: nowrap;
    opacity: 0.88;
}

.tool-preview-code-lines span:nth-child(2n) {
    opacity: 0.74;
}

.tool-meta {
    display: grid;
    gap: 6px;
}

.tool-title {
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-display);
}

.tool-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.tool-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tool-tags span {
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(148, 163, 184, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.25);
    padding: 4px 8px;
    border-radius: 999px;
}

/* --- 3. DESIGNER LAYOUT --- */
.designer-layout {
    display: flex;
    height: 100%;
}

.drawing-area {
    position: relative;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-body);
    background-image:
        radial-gradient(circle at 1px 1px, rgba(148, 163, 184, 0.12) 1px, transparent 1px);
    background-size: 26px 26px;
    overflow: auto;
    padding: 46px;
}

.canvas-shadow-wrapper {
    padding: 10px;
    background: linear-gradient(145deg, var(--bg-panel), var(--bg-surface));
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

/* Pixel Grid */
.pixel-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols, 16), var(--grid-cell, 34px));
    grid-template-rows: repeat(var(--grid-rows, 16), var(--grid-cell, 34px));
    width: max-content;
    height: max-content;
    background-color: var(--border); /* Grid line color */
    gap: var(--grid-gap, 1px);
    border: 1px solid var(--border);
}

.grid-cell {
    background-color: var(--bg-input); 
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 10px;
    user-select: none;
    cursor: crosshair;
}
.grid-cell.focused { box-shadow: inset 0 0 0 2px var(--text-muted); z-index: 2; }
.grid-cell.selected { box-shadow: inset 0 0 0 2px var(--accent); z-index: 1; }

/* Tool Sidebar */
.tool-sidebar {
    width: 300px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: none;
}

.sidebar-section {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
}

.sidebar-section h3 {
    margin: 0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 700;
    font-family: var(--font-display);
}

.import-controls {
    display: grid;
    gap: 10px;
    margin-bottom: 10px;
}

/* Tool Cards */
.tool-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.tool-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    font-size: 12px;
    color: var(--text-secondary);
    box-shadow: none;
}

.tool-card:hover { border-color: var(--border-light); color: var(--text-primary); transform: translateY(-1px); }
.tool-card input { display: none; }
.tool-card:has(input:checked) {
    background-color: rgba(31, 111, 235, 0.08);
    border-color: rgba(31, 111, 235, 0.5);
    color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(31, 111, 235, 0.28);
}

/* Palette */
.palette-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.palette-header h3 { margin: 0; }

.palette-toggle {
    min-width: 110px;
}

.palette-toggle .seg-btn {
    padding: 6px 8px;
    font-size: 11px;
}

.palette-grid {
    --palette-cols: 8;
    --palette-gap: 10px;
    display: grid;
    grid-template-columns: repeat(var(--palette-cols), minmax(0, 1fr));
    gap: var(--palette-gap);
    margin-bottom: 12px;
    padding: 12px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: none;
}

.palette-grid[data-palette="64"] { --palette-gap: 8px; }
.palette-grid[data-palette="32"] { --palette-gap: 10px; }

.color-btn {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    cursor: pointer;

    box-shadow:
        0 1px 0 rgba(255,255,255,0.04) inset,
        0 6px 12px rgba(0,0,0,0.18);

    transition:
        transform 0.16s ease,
        box-shadow 0.16s ease,
        border-color 0.16s ease;
}

.color-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(148, 163, 184, 0.4);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.08) inset,
        0 12px 20px rgba(0,0,0,0.22);
}

.color-btn:active {
    transform: translateY(0);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.06) inset,
        0 10px 18px rgba(0,0,0,0.18);
}

.color-btn:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 3px rgba(31, 111, 235, 0.22),
        0 14px 24px rgba(0,0,0,0.22);
    border-color: rgba(31, 111, 235, 0.55);
}

.color-btn.is-selected {
    border-color: rgba(31, 111, 235, 0.75);
    box-shadow:
        0 0 0 3px rgba(31, 111, 235, 0.18),
        0 12px 20px rgba(0,0,0,0.22);
}

.status-pill {
    font-size: 12px;
    line-height: 1;
    color: var(--text-secondary);
    text-align: center;

    padding: 8px 10px;
    border-radius: 999px;

    background: rgba(148, 163, 184, 0.14);
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: none;
    font-weight: 600;
}
.status-pill--mono {
    font-family: var(--font-mono);
    text-align: left;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-btn-group { display: flex; gap: 8px; margin-bottom: 12px; }
.icon-btn-group--center { justify-content: center; }
.icon-btn-group button {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 10px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

.icon-btn-group button:hover {
    border-color: var(--primary);
    color: var(--primary);
    background-color: var(--bg-input);
}

.d-pad-grid {
    display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr 1fr;
    width: 100px; margin: 0 auto 12px auto; gap: 4px;
}
.d-pad-grid button {
    background: var(--bg-input); border: none; color: var(--text-primary);
    border-radius: 4px; cursor: pointer;
}
.d-pad-grid button:hover { background: var(--border-light); }

/* --- BUTTONS --- */
button { font-family: var(--font-main); }

.btn-primary {
    background: var(--primary);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 6px 14px rgba(31, 111, 235, 0.25);
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 8px 18px rgba(31, 111, 235, 0.28); }

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    padding: 8px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { border-color: var(--border-light); background: var(--bg-input); }

.btn-success {
    background-color: var(--success);
    color: #ffffff; /* White text */
    border: none;
    border-radius: 14px;
    padding: 12px 24px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 18px rgba(16, 185, 129, 0.22);
    text-transform: none;
    letter-spacing: 0.2px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-success:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
    box-shadow: 0 10px 16px -3px rgba(16, 185, 129, 0.26);
}

.btn-success:active {
    transform: translateY(0);
}

.btn-sm { padding: 6px 10px; font-size: 12px; background: var(--bg-input); border: 1px solid var(--border); color: var(--text-primary); border-radius: 8px; cursor: pointer; }
.btn-sm:hover { background: var(--border-light); }

.btn-icon { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-surface); color: var(--text-primary); cursor: pointer; box-shadow: none; }
.btn-icon:hover { background: var(--bg-input); }
.btn-icon.danger:hover { color: var(--danger); border-color: var(--danger); }

.full-width { width: 100%; }

.footer-actions { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--border); }
.mini-actions { display: flex; justify-content: space-between; margin-top: 12px; }
.mini-actions button:not(.btn-danger-text) {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mini-actions button:not(.btn-danger-text):hover {
    border-color: var(--text-muted);
    background-color: var(--bg-input);
}

/* Ensure the danger/wipe button sits nicely next to them */
.mini-actions {
    display: flex;
    align-items: center;
    gap: 8px; /* Space between buttons */
}
.btn-danger-text { background: none; border: none; color: var(--danger); font-size: 12px; cursor: pointer; opacity: 0.8; }
.btn-danger-text:hover { opacity: 1; text-decoration: underline; }

/* --- 4. ENCODER & LISTS --- */
.split-layout { display: flex; height: 100%; }
.panel-left { width: 320px; border-right: 1px solid var(--border); padding: 20px; display: flex; flex-direction: column; background: var(--bg-panel); }
.panel-right { flex: 1; padding: 28px; overflow-y: auto; }
.scrollable-panel {
    overflow-y: auto;
    max-height: calc(100vh - 64px);
}

.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.panel-header h3 { margin: 0; color: var(--text-primary); font-size: 15px; font-family: var(--font-display); }
.btn-row { display: flex; gap: 8px; align-items: center; }

.modern-list {
    list-style: none; padding: 0; margin: 0 0 16px 0;
    border: 1px solid var(--border); border-radius: var(--radius-md);
    flex: 1; overflow-y: auto; background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
}
.modern-list li {
    padding: 0; border-bottom: 1px solid var(--border);
    font-size: 13px; color: var(--text-secondary); cursor: pointer;
    transition: all 0.15s ease;
}
.modern-list li:hover { background: rgba(31, 111, 235, 0.08); color: var(--text-primary); }
.modern-list li.selected { border-left: 3px solid var(--primary); background: rgba(31, 111, 235, 0.12); color: var(--text-primary); }

.file-item { position: relative; }
.file-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: transparent;
    border: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-align: left;
}
.file-row:focus-visible { outline: 2px solid rgba(31, 111, 235, 0.35); outline-offset: -2px; }
.file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-caret { opacity: 0.6; transition: transform 0.2s ease, opacity 0.2s ease; }
.file-item.menu-open .file-caret { transform: rotate(180deg); opacity: 1; }
.file-item.menu-open { padding-bottom: calc(var(--menu-height, 0px) + 8px); }
.file-menu {
    position: absolute;
    left: 10px;
    right: 10px;
    top: 44px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 6;
}
.file-item.menu-open .file-menu { display: grid; gap: 6px; }
.file-menu button {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}
.file-menu button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-surface);
}
.file-menu button:hover {
    background: rgba(31, 111, 235, 0.12);
    color: var(--text-primary);
    border-color: rgba(31, 111, 235, 0.4);
}
.file-menu button.danger { color: var(--danger); }
.file-menu button.danger:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.4);
}

.btn-stack { display: grid; gap: 8px; }

/* Preview modal */
.preview-card { width: min(520px, 92vw); }
.preview-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.preview-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(31, 111, 235, 0.35);
    background: rgba(31, 111, 235, 0.14);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}
.preview-title {
    margin: 10px 0 2px 0;
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    font-family: var(--font-display);
}
.preview-sub {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
}
.preview-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
}
.preview-grid {
    display: grid;
    grid-template-columns: repeat(var(--preview-cols, 16), 1fr);
    grid-template-rows: repeat(var(--preview-rows, 16), 1fr);
    gap: 2px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px;
    margin-top: 10px;
}
.preview-cell {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 3px;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-family: var(--font-mono);
}
.preview-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.setting-card { background: var(--bg-panel); border: 1px solid var(--border); padding: 16px; border-radius: var(--radius-md); box-shadow: none; }
.setting-card--stack { display: flex; flex-direction: column; gap: 8px; }
.input-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.setting-card .input-field { font-size: 12px; }
.grid-mode-list { display: grid; gap: 8px; }
.grid-mode-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-surface);
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
}
.grid-mode-option span { display: inline-flex; align-items: center; gap: 6px; }
.grid-mode-option input { margin: 0; accent-color: var(--primary); }
.grid-mode-option input:checked + span { color: var(--text-primary); }
.grid-mode-option:hover { border-color: var(--border-light); }

.designer-zoom-dock {
    position: absolute;
    left: 14px;
    bottom: 14px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-panel);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
    z-index: 3;
}

.designer-zoom-dock .btn-icon {
    width: 32px;
    height: 32px;
}

.grid-zoom-value {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 44px;
    text-align: center;
    font-family: var(--font-mono);
}

/* Toggle Switch */
.toggle-switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle-switch input { display: none; }
.toggle-switch .label-text { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.toggle-switch .label-text i { margin-right: 6px; }
.slider { width: 46px; height: 26px; background: var(--bg-input); border-radius: 20px; position: relative; transition: 0.3s; }
.slider:before { content: ""; position: absolute; height: 18px; width: 18px; left: 4px; bottom: 4px; background: white; border-radius: 50%; transition: 0.3s; }
input:checked + .slider { background: var(--success); }
input:checked + .slider:before { transform: translateX(20px); }

/* Progress Bar */
.usage-dashboard { background: var(--bg-panel); border: 1px solid var(--border); padding: 20px; border-radius: var(--radius-md); margin-bottom: 24px; box-shadow: var(--shadow-sm); }
.usage-header { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 10px; font-size: 13px; }
.progress-bar-bg { height: 8px; background: var(--bg-input); border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.5s ease; }
.usage-details { margin-top: 10px; font-size: 12px; color: var(--text-muted); max-height: 80px; overflow-y: auto; }
.usage-warnings {
    margin-top: 10px;
    font-size: 12px;
    color: var(--danger);
    line-height: 1.4;
    display: grid;
    gap: 6px;
}
.usage-warnings .warn-item { display: flex; gap: 8px; align-items: flex-start; }
.usage-warnings .warn-item i { margin-top: 2px; }

.export-tools {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}
.export-tools .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Console */
.console-wrapper { margin-top: 24px; }
.console-header { background: var(--bg-surface); padding: 10px 12px; font-size: 12px; border: 1px solid var(--border); border-bottom: none; border-radius: var(--radius-md) var(--radius-md) 0 0; font-weight: 600; }
textarea#console-output {
    width: 100%; height: 200px; background: #0b0f14; color: #22c55e;
    border: 1px solid var(--border); border-radius: 0 0 var(--radius-md) var(--radius-md);
    padding: 12px; font-family: var(--font-mono); font-size: 12px; resize: none; outline: none;
}

.output-area {
    width: 100%;
    min-height: 260px;
    background: #0b0f14;
    color: #e2e8f0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    resize: vertical;
    outline: none;
}

.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 6px 0;
}

.stat-row strong {
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* --- 5. CHAR MAP & LOGS --- */
.panel-full { padding: 30px; height: 100%; display: flex; flex-direction: column; }
.charmap-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px;
    overflow-y: auto; flex: 1; padding: 4px;
}
.char-entry {
    background: var(--bg-panel); border: 1px solid var(--border);
    padding: 10px; border-radius: var(--radius-sm); text-align: center;
}
.char-entry input { width: 100%; background: var(--bg-input); border: none; color: var(--text-primary); text-align: center; margin-top: 5px; padding: 4px; border-radius: 4px; }

#log-display { width: 100%; height: 100%; background: var(--bg-panel); border: none; padding: 20px; color: var(--text-muted); font-family: var(--font-mono); resize: none; }

/* Responsive layout polish */
@media (max-width: 1100px) {
    .tool-sidebar { width: 280px; }
    .panel-left { width: 280px; }
}

@media (max-width: 900px) {
    .designer-layout,
    .split-layout {
        flex-direction: column;
    }
    .tool-sidebar,
    .panel-left {
        width: 100%;
        border-left: none;
        border-right: none;
        box-shadow: none;
    }
    .panel-right { padding: 20px; }
    .drawing-area { padding: 20px; }
    .designer-zoom-dock {
        left: 10px;
        bottom: 10px;
    }
    .hero-section { padding: 32px 24px; }
    .hero-title { font-size: 36px; }
    .hero-subtitle { font-size: 16px; }
}

/* --- LANDING & ABOUT PAGE STYLES --- */

/* Hero Section */
.hero-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    padding: 40px 48px;
    background: radial-gradient(800px 500px at 10% 20%, rgba(31, 111, 235, 0.08) 0%, transparent 70%);
}

.hero-content {
    max-width: 640px;
    padding: 0;
    animation: slideIn 0.5s ease-out;
}

.badge-pill {
    display: inline-block;
    padding: 6px 10px;
    background: rgba(31, 111, 235, 0.12);
    color: var(--primary);
    border: 1px solid rgba(31, 111, 235, 0.35);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

#pre-release {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(38, 233, 129, 0.167) !important;
    color: rgb(82, 233, 137) !important;
    border: 1px solid rgba(0, 255, 94, 0.123) !important;
}

.hero-title {
    font-size: 44px;
    font-weight: 700;
    line-height: 1.1;
    margin: 0 0 18px 0;
    letter-spacing: -0.6px;
    color: var(--text-primary);
    font-family: var(--font-display);
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 17px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

.hero-actions {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-large {
    padding: 12px 26px;
    font-size: 15px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

/* About Page Container */
.content-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 44px 24px;
}


.about-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-lg);
}

.about-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
}

.about-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    font-family: var(--font-display);
}

.icon-box {
    width: 48px;
    height: 48px;
    background: rgba(31, 111, 235, 0.12);
    color: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.prose {
    color: var(--text-secondary);
    line-height: 1.8;
}

.prose h3 {
    color: var(--text-primary);
    margin-top: 30px;
    margin-bottom: 10px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
}

.prose h3 i { color: var(--accent); }

.prose p { margin-bottom: 16px; }

.docs-tabbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.docs-tab-btn {
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.docs-tab-btn:hover {
    border-color: var(--border-light);
    color: var(--text-primary);
}

.docs-tab-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 6px 16px var(--primary-glow);
}

.docs-tab-panel {
    display: none;
}

.docs-tab-panel.active {
    display: block;
}

.docs-grid {
    display: grid;
    gap: 14px;
}

.docs-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
}

.docs-card h4 {
    margin: 0 0 8px 0;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-display);
}

.lead-text {
    font-size: 18px;
    color: var(--text-primary);
    font-weight: 500;
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 40px 0;
}

.tech-stack {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.tech-stack span {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    border: 1px solid var(--border);
}

/* --- GITHUB BUTTON STYLES --- */
.about-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

.repo-action {
    width: 100%;
    display: flex;
    justify-content: center;
}

.btn-github {
    background-color: #24292f; /* GitHub Black */
    color: #ffffff !important;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-github:hover {
    background-color: #1a1e22;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
    border-color: var(--primary); /* subtle blue glow on hover */
}

.btn-github i {
    font-size: 20px;
}

/* Light Mode Override for Github Button */
html[data-theme="light"] .btn-github {
    background-color: #24292f;
    color: white;
}

/* DISCORD BUTTON STYLES */

.btn-discord {
    background-color: #5865f2; /* Discord Blue */
    color: #ffffff !important;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-discord:hover {
    background-color: #4752c4;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
    border-color: var(--primary); /* subtle blue glow on hover */
}

.btn-discord i {
    font-size: 20px;
}

/* Light Mode Override for Discord Button */
html[data-theme="light"] .btn-discord {
    background-color: #5865f2;
    color: white;
}

/* --- TUTORIAL SYSTEM --- */
.tutorial-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.75s cubic-bezier(0.4, 0, 0.2, 1);
}

.tutorial-overlay.side-layout {
    justify-content: flex-start;
    padding-left: 65%;         
}

@media (max-width: 1200px) {
    .tutorial-overlay.side-layout {
        align-items: flex-end;
        justify-content: center;
        padding-bottom: 40px;
    }
}

.tutorial-overlay.active { display: flex; animation: fadeIn 0.3s ease; }

.tutorial-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.tutorial-progress {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
    margin-bottom: 10px;
    font-weight: 700;
}

#tut-title { margin-bottom: 15px; font-size: 20px; color: var(--text-primary); }
#tut-text { color: var(--text-secondary); line-height: 1.6; margin-bottom: 25px; min-height: 80px; }

.tutorial-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tut-nav { display: flex; gap: 10px; }

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Highlight Effect for UI Elements */
.tut-highlight {
    position: relative;
    z-index: 10000 !important;
    box-shadow: 0 0 0 4px var(--primary), 0 0 20px var(--primary-glow) !important;
    pointer-events: none;
}
/* --- Selection segmented control & helpers --- */
.segmented {
  display: flex;
  gap: 0;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.seg-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 10px;
  font-weight: 600;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.seg-btn:hover { color: var(--text-primary); background: var(--bg-surface); }
.seg-btn.active {
  background: var(--bg-panel);
  color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.action-row--center { justify-content: center; }

.hint-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 11px;
}
.hint-pill kbd {
  font-family: var(--font-mono);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  padding: 0 6px;
  border-radius: 4px;
  line-height: 18px;
}

/* Force-toggle feedback (flash red + shake) */
.toggle-switch.toggle-error { animation: toggleShake 0.55s ease; }
.toggle-switch.toggle-error .slider {
    animation: toggleFlash 0.55s ease;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
}
.toggle-switch.toggle-error .label-text { animation: toggleTextFlash 0.55s ease; }

@keyframes toggleShake {
    0% { transform: translateX(0); }
    15% { transform: translateX(-4px); }
    30% { transform: translateX(4px); }
    45% { transform: translateX(-3px); }
    60% { transform: translateX(3px); }
    75% { transform: translateX(-2px); }
    100% { transform: translateX(0); }
}

@keyframes toggleFlash {
    0% { background: var(--bg-input); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
    25% { background: #ef4444; box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.25); }
    60% { background: #ef4444; box-shadow: 0 0 0 10px rgba(239, 68, 68, 0.0); }
    100% { background: var(--bg-input); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes toggleTextFlash {
    0% { color: var(--text-primary); }
    25% { color: #ef4444; }
    60% { color: #ef4444; }
    100% { color: var(--text-primary); }
}

/* Toasts */
.toast-root {
    position: fixed;
    right: 18px;
    bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 99999;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    width: min(420px, calc(100vw - 36px));
    display: grid;
    grid-template-columns: 36px 1fr 34px;
    align-items: center;
    gap: 12px;
    padding: 12px 12px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    transform: translateY(8px) scale(0.98);
    opacity: 0;
    overflow: hidden;
}

.toast-show { animation: toastIn 220ms cubic-bezier(.2,.9,.2,1) forwards; }
.toast-hide { animation: toastOut 200ms ease forwards; }

.toast-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.10);
}

.toast-error .toast-icon { background: rgba(239, 68, 68, 0.14); }
.toast-success .toast-icon { background: rgba(34, 197, 94, 0.14); }

.toast-text {
    font-size: 13px;
    line-height: 1.35;
    color: rgba(226, 232, 240, 0.95);
}

.toast-close {
    background: transparent;
    border: none;
    color: rgba(226, 232, 240, 0.7);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease, color 0.15s ease;
}
.toast-close:hover {
    background: rgba(148, 163, 184, 0.12);
    color: rgba(226, 232, 240, 0.95);
}

.toast-bar {
    grid-column: 1 / -1;
    height: 3px;
    background: rgba(148, 163, 184, 0.18);
    position: relative;
    overflow: hidden;
}
.toast-bar::before {
    content: "";
    position: absolute;
    inset: 0;
    transform-origin: left;
    animation: toastBar linear forwards;
    animation-duration: var(--toast-duration, 3200ms);
    background: rgba(148, 163, 184, 0.55);
}
.toast-error .toast-bar::before { background: rgba(239, 68, 68, 0.7); }
.toast-success .toast-bar::before { background: rgba(34, 197, 94, 0.7); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(10px) scale(0.98); }
}
@keyframes toastBar {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* Scrollbar Styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
/* ==============================
   MODERN ENHANCEMENTS (2026)
   ============================== */

/* Motion tokens */
:root {
  --ease-spring: cubic-bezier(.2, .8, .2, 1);
  --dur-fast: 160ms;
  --dur-med: 360ms;
  --dur-slow: 800ms;
  --ring: 0 8px 30px rgba(0,0,0,.25);
}

.grain-overlay {
  display: none;
}

/* Page enter/exit transitions */
html {
  view-transition-name: root; /* enables native view transitions in supporting browsers */
}
.page-enter {
  animation: pageIn var(--dur-med) var(--ease-spring) both;
}
.page-exit {
  animation: pageOut var(--dur-med) ease both;
}
@keyframes pageIn {
  from { opacity: 0; filter: blur(2px); transform: translateY(4px); }
  to   { opacity: 1; filter: blur(0);   transform: translateY(0); }
}
@keyframes pageOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(.98); }
}

/* Shimmer removed for a cleaner, professional feel */

/* Floating orbs background for hero */
.hero-section {
  position: relative;
  overflow: hidden;
}
.hero-bg {
  display: none;
}

/*
Source - https://stackoverflow.com/a/71778215
Posted by developwoof, modified by community. See post 'Timeline' for change history
Retrieved 2026-01-30, License - CC BY-SA 4.0
*/

.background {
  display: none;
}

.orb {
  display: none;
}

/* Parallax lift on move */
/*
.parallax-lift {
  will-change: transform;
  transition: transform var(--dur-fast) var(--ease-spring);
}
.parallax-lift[data-active="true"] { transform: translate3d(var(--tx,0), var(--ty,0), 0) scale(1.01); }
*/
/* Magnetic buttons */
/*
.magnet { position: relative; display: inline-block; }
.magnet .magnet-target {
  transition: transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-fast);
  will-change: transform;
  box-shadow: var(--shadow-md);
}
.magnet[data-active="true"] .magnet-target { transform: translate3d(var(--mx,0), var(--my,0), 0); box-shadow: var(--shadow-lg); }
*/

/* Nav icon motion intentionally minimal */

/* Cursor ring */
.cursor-ring {
  display: none;
}
.cursor-ring[data-down="true"] { display: none; }

/* === Reveal on scroll (GPU-friendly) === */
.reveal-up { opacity: 0; transform: translateY(6px); transition: opacity .4s var(--ease-spring), transform .4s var(--ease-spring); will-change: transform, opacity; }
.reveal-up.is-visible { opacity: 1; transform: translateY(0); }

/* Tilt on badges */
.tech-stack span {
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.tech-stack span:hover { border-color: var(--border-light); }

/* Easter egg: subtle bounce for .badge-pill on hover */
.badge-pill { transition: none; transform: none; }
.badge-pill:hover { transform: none; }

/* Theme toggle: no flourish */
.theme-btn { transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease; }
.theme-btn:active { transform: none; }

/* About page: mini timeline style under headers */
.prose h3 {
  position: relative;
  padding-left: 14px;
}
.prose h3::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--accent);
  transform: translateY(-50%);
  box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.15);
}

/* Minimal modal styling */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 10000;
  animation: fadeIn 160ms ease-out;
}
.modal-overlay.closing { animation: fadeOut 160ms ease-in forwards; }

.modal-card {
  width: min(420px, 92vw);
  background: var(--bg-panel);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 18px 18px 14px;
}
.modal-title { margin: 0 0 8px 0; font-size: 16px; font-weight: 700; }
.modal-message { margin: 0 0 16px 0; color: var(--text-secondary); font-size: 13px; line-height: 1.5; }
.modal-input {
  width: 100%;
  padding: 10px 12px;
  margin: 0 0 14px 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.modal-input::placeholder { color: var(--text-muted); }
.modal-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal-actions .btn-danger { background-color: var(--danger); }
.modal-actions .btn-danger:hover { filter: brightness(1.05); }

/* Project dashboard modal */
.project-modal {
  width: min(1080px, 95vw);
  padding: 20px;
}
.project-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.project-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.project-title { margin: 0 0 4px 0; font-size: 18px; font-weight: 800; }
.project-sub { margin: 0; color: var(--text-secondary); font-size: 13px; }
.project-close {
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  width: 36px; height: 36px;
  border-radius: 12px;
  cursor: pointer;
}
.project-body {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.1fr);
  gap: 18px;
}
.project-list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}
.project-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-surface);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.project-card:hover { border-color: var(--border-light); transform: translateY(-1px); }
.project-card.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-glow); }
.project-thumb {
  width: 100%;
  aspect-ratio: 1.3;
  border-radius: 8px;
  background: var(--bg-input);
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 12px;
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-meta { display: flex; flex-direction: column; gap: 2px; }
.project-name { font-weight: 700; font-size: 13px; color: var(--text-primary); }
.project-updated { font-size: 11px; color: var(--text-muted); }
.project-detail {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.project-preview {
  width: 100%;
  aspect-ratio: 1.6;
  border-radius: 10px;
  background: var(--bg-input);
  overflow: hidden;
}
.project-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-field { display: grid; gap: 6px; }
.project-field textarea { min-height: 80px; resize: vertical; }
.project-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.snapshot-list {
  display: grid;
  gap: 8px;
  max-height: 200px;
  overflow: auto;
  padding-right: 4px;
}
.snapshot-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-panel);
}
.snapshot-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--bg-input);
  overflow: hidden;
  flex: 0 0 auto;
}
.snapshot-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.snapshot-meta { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.snapshot-actions { display: flex; gap: 6px; }

@media (max-width: 900px) {
  .project-body { grid-template-columns: 1fr; }
}

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes fadeOut { to { opacity: 0 } }


/* Terms gate modal */
.tos-card {
  width: min(880px, 94vw);
  padding: 18px 18px 14px;
}
.tos-head{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}
.tos-kicker{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.tos-title{ margin: 0 0 6px 0; font-size: 18px; font-weight: 800; }
.tos-sub{ margin: 0; color: var(--text-secondary); font-size: 13px; line-height: 1.5; }

.tos-close{
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  width: 36px; height: 36px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform var(--dur-fast,160ms) var(--ease-spring, ease), background 160ms ease;
}
.tos-close:hover{ background: var(--bg-surface); transform: translateY(-1px); }
.tos-close:active{ transform: translateY(0); }

.tos-body{
  margin-top: 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.06);
  border-radius: var(--radius-lg);
  padding: 14px 14px;
  max-height: min(62vh, 520px);
  overflow: auto;
  outline: none;
}
.tos-body h3{
  margin: 0 0 8px 0;
  font-size: 13px;
  letter-spacing: .2px;
}
.tos-body p{ margin: 0 0 10px 0; color: var(--text-secondary); font-size: 13px; line-height: 1.55; }
.tos-body ul{ margin: 0 0 12px 18px; color: var(--text-secondary); font-size: 13px; line-height: 1.55; }
.tos-body li{ margin: 6px 0; }
.tos-body code{
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.10);
  color: var(--text-primary);
}
.tos-sep{
  border: none;
  height: 1px;
  background: var(--border);
  margin: 12px 0;
  opacity: .9;
}
.tos-note{
  background: rgba(31, 111, 235, 0.1);
  border: 1px solid rgba(31, 111, 235, 0.25);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text-secondary);
}
.tos-end{
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  opacity: .9;
}

.tos-actions{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.tos-btns{
  display:flex;
  gap: 8px;
  align-items:center;
}
.tos-agree:disabled{
  opacity: .55;
  cursor: not-allowed;
  filter: saturate(.7);
}

.tos-identity { margin-top: 12px; display: grid; gap: 6px; }
.tos-label { font-size: 12px; color: var(--text-primary); font-weight: 600; }
.tos-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-main);
  outline: none;
}
.tos-input:focus { border-color: rgba(31, 111, 235, 0.6); box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.15); }
.tos-hint { font-size: 12px; color: var(--text-muted); }

/* Allow normal page scrolling on legal pages */
body.legal-page {
  overflow: auto !important;
  height: auto !important;
}

body.legal-page .app-shell,
body.legal-page .content-wrapper {
  height: auto !important;
  overflow: visible !important;
}

/* Parallax lift */
.parallax-lift {
  transform: translate3d(var(--tx, 0px), var(--ty, 0px), 0);
  transition: transform 160ms ease;
  will-change: transform;
}

/* Magnetic wrapper (move the wrapper, not the button, so hover transforms still work) */
.magnet {
  display: inline-block;
  transform: translate3d(var(--mx, 0px), var(--my, 0px), 0);
  transition: transform 120ms ease;
  will-change: transform;
}

/* Custom cursor ring */
.cursor-ring {
  position: fixed;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.55);
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: difference;
  transform: translate3d(-999px, -999px, 0) translate(-50%, -50%);
  transition: width 120ms ease, height 120ms ease, border-color 120ms ease;
}

.cursor-ring[data-down="true"] {
  width: 18px;
  height: 18px;
  border-color: rgba(255,255,255,0.85);
}

@media (prefers-reduced-motion: reduce) {
  .parallax-lift, .magnet, .cursor-ring { transition: none; }
}

.home-binary-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
  mix-blend-mode: screen;
}

/* bump these up one layer so binary sits behind */
.home-particle-canvas { z-index: 1; }
.home-hero .hero-bg { z-index: 2; }
.home-hero .hero-content { z-index: 3; }
