* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Theme tokens — landing-derived amber accent (theme unification 2026-07-28).
   Chrome only: canvas/game colors (default base blue, zone colors, terrain
   component types) are deliberately NOT tokenized and stay as they were. */
:root {
    --accent: #e2a63d;
    --accent-rgb: 226, 166, 61;
    --accent-strong: #c98f2d;
    --accent-text: #15181a;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #1a1a1a;
    color: #e0e0e0;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    max-width: 100vw;
}

/* Header */
.header {
    background-color: #2a2a2a;
    padding: 0.5rem 1rem;
    border-bottom: 2px solid #3a3a3a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 100;
}

/* Accessible visually-hidden: present in DOM for crawlers/screen readers,
   invisible on screen. Clip technique (NOT display:none, which Google discounts). */
.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    transition: color 0.2s ease;
}

.app-title:hover {
    color: var(--accent);
}

.header-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-nav-link {
    color: #e0e0e0;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.header-nav-link:hover {
    color: var(--accent);
    background-color: rgba(var(--accent-rgb), 0.1);
}

.header-nav-link.active {
    color: var(--accent);
    background-color: rgba(var(--accent-rgb), 0.15);
}

/* User Menu */
.user-menu-container {
    position: relative;
}

.user-menu-trigger {
    cursor: pointer;
}

.user-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: #2a2a2a;
    border: 2px solid #3a3a3a;
    border-radius: 6px;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    overflow: hidden;
}

.user-menu-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    color: #e0e0e0;
    text-decoration: none;
    background: none;
    border: none;
    text-align: left;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.user-menu-item:hover {
    background-color: #3a3a3a;
    color: var(--accent);
}

.user-menu-item:first-child {
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.user-menu-item:last-child {
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* Toolbar */
.toolbar {
    background-color: #252525;
    border: 2px solid #3a3a3a;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    min-height: 40px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    row-gap: 0.4rem;
    margin-bottom: 0.75rem;
    position: relative;
    z-index: 50;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    min-width: 0;
}

.toolbar-section-map {
    margin-left: auto;
    padding-left: 0.5rem;
    flex-shrink: 0;
}

.toolbar-section-title {
    font-size: 0.6rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-right: 0.35rem;
    flex-shrink: 0;
}

.toolbar-section-title:not(:first-child) {
    margin-left: 0.4rem;
    padding-left: 0.5rem;
    border-left: 1px solid #3a3a3a;
}

.toolbar-controls {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
    min-width: 0;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.5rem;
    background-color: #2a2a2a;
    border: 2px solid #3a3a3a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    flex-shrink: 0;
}

.toolbar-btn:hover {
    background-color: #3a3a3a;
    border-color: var(--accent);
    transform: translateY(-1px);
}

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

.toolbar-btn.active {
    background-color: rgba(var(--accent-rgb), 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

/* LOS button uses the selected color when active */
#toolbar-los-btn.active {
    background-color: rgba(var(--accent-rgb), 0.15);
    border-color: #3a3a3a;
}

#toolbar-los-btn.active:hover {
    background-color: rgba(var(--accent-rgb), 0.2);
    border-color: var(--accent);
}

.toolbar-btn-icon-only {
    min-width: auto;
    padding: 0.35rem 0.5rem;
}

.toolbar-btn-icon-only span {
    display: none;
}

.toolbar-btn-mixed {
    opacity: 0.6;
    border-style: dashed;
}

.toolbar-label-input {
    background: #2d2d2d;
    border: 1px solid #555;
    border-radius: 3px;
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    width: 60px;
    outline: none;
    flex-shrink: 0;
}
.toolbar-label-input:focus {
    border-color: var(--accent);
}
.toolbar-label-input::placeholder {
    color: #666;
}

.toolbar-height-control {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.toolbar-height-label {
    font-size: 11px;
    color: #999;
    user-select: none;
    white-space: nowrap;
}
.toolbar-height-slider-wrap {
    position: relative;
    width: 110px;
    height: 18px;
    display: flex;
    align-items: center;
}
.toolbar-height-ticks {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.toolbar-height-tick {
    position: absolute;
    top: 50%;
    width: 2px;
    height: 8px;
    margin-left: -1px;
    transform: translateY(-50%);
    background: #888;
    border-radius: 1px;
}
.toolbar-height-slider {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    width: 100%;
    height: 4px;
    background: #3a3a3a;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    margin: 0;
}
.toolbar-height-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: grab;
}
.toolbar-height-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
}
.toolbar-height-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--accent);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: grab;
}
.toolbar-height-slider.mixed::-webkit-slider-thumb {
    background: #666;
    border-color: #aaa;
    opacity: 0.45;
}
.toolbar-height-slider.mixed::-moz-range-thumb {
    background: #666;
    border-color: #aaa;
    opacity: 0.45;
}
.toolbar-height-input {
    width: 52px;
    padding: 2px 4px;
    font-size: 11px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 3px;
    color: #e0e0e0;
    text-align: center;
    outline: none;
}
.toolbar-height-input:focus {
    border-color: var(--accent);
}
.toolbar-height-input::placeholder {
    color: #666;
}

.toolbar-radius-selector {
    display: flex;
    gap: 0.2rem;
    align-items: center;
}

.toolbar-btn-small {
    padding: 0.25rem 0.45rem;
    font-size: 0.7rem;
    min-width: auto;
}

.toolbar-btn-small.active {
    background-color: rgba(var(--accent-rgb), 0.15);
    border-color: var(--accent);
}

#toolbar-radius-btn.active {
    background-color: rgba(var(--accent-rgb), 0.15);
    border-color: var(--accent);
}

#toolbar-measure-btn.active,
#toolbar-measure-btn-unit.active {
    background-color: rgba(var(--accent-rgb), 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

.toolbar-btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 1);
    color: rgba(239, 68, 68, 1);
}

#toolbar-color-btn,
#toolbar-radius-color-btn,
#toolbar-measurement-color-btn {
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    min-width: auto;
}

#toolbar-color-btn:hover,
#toolbar-radius-color-btn:hover,
#toolbar-measurement-color-btn:hover {
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-1px) scale(1.02);
}

.toolbar-btn svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.toolbar-btn span {
    white-space: nowrap;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background-color: #252525;
    padding: 1rem;
    overflow-y: auto;
    border-right: 2px solid #3a3a3a;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.sidebar section {
    margin-bottom: 1.25rem;
}

.sidebar h2 {
    font-size: 1.1rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: #fff;
    border-bottom: 1px solid #3a3a3a;
    padding-bottom: 0.35rem;
    padding-top: 0;
}

.section-header-with-categories {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.section-header-with-categories h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.selectors-wrapper {
    position: relative;
}

#selectors-container {
    margin-left: 0;
    padding-left: 0;
    position: relative;
}

.category-buttons-fixed {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

#selectors-container .selector-section:first-of-type {
    position: relative;
    margin-left: 0;
    padding-left: 0;
}

#selectors-container .selector-section:first-of-type h2 {
    margin-left: 0;
    padding-left: 0;
    text-align: left;
    position: static;
}

#selectors-container .selector-section {
    margin-left: 0;
    padding-left: 0;
}

#selectors-container .selector-section h2 {
    margin-left: 0;
    padding-left: 0;
    text-align: left;
    position: static;
}

/* Apply same left alignment to all selector-section h2 elements (including Base Sizes) */
.selector-section h2 {
    margin-left: 0;
    padding-left: 0;
    text-align: left;
    position: static;
}

.category-buttons {
    display: flex;
    gap: 0.3rem;
}

.category-btn, .edition-btn, .disp-btn {
    padding: 0.3rem 0.5rem;
    background-color: #2a2a2a;
    border: 2px solid #3a3a3a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
}

.category-btn:hover, .edition-btn:hover, .disp-btn:hover {
    border-color: var(--accent);
    background-color: #2f3a4a;
    transform: translateY(-1px);
}

.category-btn.active, .edition-btn.active, .disp-btn.active {
    background-color: rgba(var(--accent-rgb), 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

.selector-section {
    margin-bottom: 1.25rem;
    margin-left: 0;
    padding-left: 0;
    display: block;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    padding-bottom: 0.5rem;
    text-align: center;
    color: #888;
    font-size: 0.85rem;
    border-top: 1px solid #3a3a3a;
}

.sidebar-footer a {
    color: #fff;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.sidebar-footer a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.selector-dropdown {
    width: 100%;
    padding: 0.6rem;
    background-color: #2a2a2a;
    border: 2px solid #3a3a3a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.selector-dropdown:hover {
    border-color: var(--accent);
}

.selector-dropdown:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.2);
}

.current-selection {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background-color: #2a2a2a;
    border-radius: 4px;
    border-left: 3px solid var(--accent);
}

.selection-label {
    font-weight: 500;
    color: #aaa;
}

.selection-value {
    color: #fff;
    font-weight: 600;
}

/* Base Sizes Grid */
.base-sizes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.base-size-item {
    padding: 0.45rem;
    background-color: #2a2a2a;
    border: 2px solid #3a3a3a;
    border-radius: 4px;
    color: #e0e0e0;
    text-align: center;
    font-size: 0.85rem;
    cursor: grab;
    transition: all 0.2s;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none; /* Allow our custom pointer handling */
}

.base-size-item:hover {
    border-color: var(--accent);
    background-color: #2f3a4a;
    transform: translateY(-1px);
}

.base-size-item:active {
    cursor: grabbing;
    transform: translateY(0);
}

.base-size-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

/* Shape Selector (New UI) */
.shape-selector-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.shape-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background-color: #2a2a2a;
    border: 2px solid #3a3a3a;
    border-radius: 6px;
    padding: 0.4rem;
}

.shape-size-dropdown {
    flex: 1;
    min-width: 0;
    padding: 0.4rem 0.3rem;
    background-color: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.75rem;
    cursor: pointer;
}

.shape-size-dropdown:hover {
    border-color: var(--accent);
}

.shape-size-dropdown:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.2);
}

.shape-qty-input {
    width: 42px;
    padding: 0.4rem 0.2rem;
    background-color: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.75rem;
    text-align: center;
}

.shape-qty-input:hover {
    border-color: var(--accent);
}

.shape-qty-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.2);
}

/* Hide spinner buttons on number input */
.shape-qty-input::-webkit-outer-spin-button,
.shape-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}
.shape-qty-input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.shape-drag-button,
.custom-size-drag-button {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1a1a1a;
    border: 2px solid #3a3a3a;
    border-radius: 6px;
    cursor: grab;
    transition: all 0.2s;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.shape-drag-button:hover,
.custom-size-drag-button:hover {
    border-color: var(--accent);
    background-color: #2f3a4a;
    transform: scale(1.05);
}

.shape-drag-button:active,
.custom-size-drag-button:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.shape-drag-button.dragging,
.custom-size-drag-button.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.shape-drag-button svg,
.custom-size-drag-button svg {
    width: 24px;
    height: 24px;
}

/* Battlefield */
.battlefield-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background-color: #1e1e1e;
    padding: 0.5rem;
    overflow: auto;
    position: relative;
}

/* Snap to Grid Toggle */
.toolbar-btn-snap {
    position: relative;
}

.toolbar-btn-snap input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toolbar-btn-snap .toolbar-btn-content {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.toolbar-btn-snap input[type="checkbox"]:checked ~ .toolbar-btn-content {
    color: var(--accent);
}

.toolbar-btn-snap:has(input[type="checkbox"]:checked) {
    background-color: rgba(var(--accent-rgb), 0.15);
    border-color: var(--accent);
}

.battlefield-wrapper {
    width: 100%;
    height: 0;
    flex: 1;
    min-height: 0;
    background-color: #2a2a2a;
    border: 2px solid #3a3a3a;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none; /* Prevent default touch behaviors like scrolling */
    overflow: hidden;
}

.battlefield-svg {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    touch-action: none; /* Prevent default touch behaviors */
    user-select: none; /* Prevent text selection on drag */
    -webkit-user-select: none;
}


/* Base Modal */
.base-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 1rem;
}

/* Generic Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: #2a2a2a;
    border: 2px solid #3a3a3a;
    border-radius: 8px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    /* Never exceed the viewport; scroll inside instead (body scroll is locked while open) */
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
}

.modal-content h2 {
    margin: 0 0 0.5rem 0;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
}

.modal-content .auth-subtitle {
    margin: 0 0 1.5rem 0;
    color: #aaa;
    font-size: 0.95rem;
    text-align: center;
}

.modal-content p {
    margin: 0 0 1.5rem 0;
    color: #e0e0e0;
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: center;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #fff;
}

.button {
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    border: 2px solid transparent;
}

.button-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: var(--accent-text);
    font-weight: 600;
    border-color: var(--accent);
}

.button-primary:hover {
    background: linear-gradient(135deg, var(--accent-strong) 0%, var(--accent) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.4);
}

.button-secondary {
    background: transparent;
    color: #e0e0e0;
    border-color: #3a3a3a;
}

.button-secondary:hover {
    background: #3a3a3a;
    border-color: var(--accent);
    color: var(--accent);
}

/* Subscription Gate Modal */
.subscription-gate-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    backdrop-filter: blur(6px);
}

.subscription-gate-content {
    max-width: 440px;
    text-align: center;
}

.subscription-gate-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    text-align: left;
}

.subscription-gate-features li {
    padding: 0.4rem 0;
    color: #ccc;
    font-size: 0.95rem;
}

.subscription-gate-features li::before {
    content: '\2713';
    color: var(--accent);
    font-weight: bold;
    margin-right: 0.75rem;
}

/* Auth Pages */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: #1a1a1a;
}

.auth-card {
    background: #2a2a2a;
    border: 2px solid #3a3a3a;
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.auth-card h1 {
    margin: 0 0 0.5rem 0;
    color: #fff;
    font-size: 2rem;
    font-weight: 600;
    text-align: center;
}

.auth-subtitle {
    text-align: center;
    color: #aaa;
    margin: 0 0 2rem 0;
    font-size: 0.95rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    color: #e0e0e0;
    font-size: 0.9rem;
    font-weight: 500;
}

.form-input {
    padding: 0.75rem;
    background: #1a1a1a;
    border: 2px solid #3a3a3a;
    border-radius: 6px;
    color: #fff;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
}

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

.form-input::placeholder {
    color: #666;
}

.password-input-wrapper {
    position: relative;
    display: flex;
}

.password-input-wrapper .form-input {
    flex: 1;
    padding-right: 2.75rem;
}

.password-toggle {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    color: #666;
    cursor: pointer;
    transition: color 0.2s ease;
}

.password-toggle:hover {
    color: #e0e0e0;
}

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

.auth-error {
    background: rgba(255, 66, 77, 0.1);
    border: 1px solid rgba(255, 66, 77, 0.3);
    border-radius: 6px;
    padding: 0.75rem;
    color: #ff6b6b;
    font-size: 0.9rem;
    text-align: center;
}

.auth-success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    background: rgba(var(--accent-rgb), 0.1);
    border: 3px solid var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--accent);
    font-weight: bold;
}

.auth-help-text {
    color: #aaa;
    font-size: 0.9rem;
    text-align: center;
    margin: 0.5rem 0;
}

.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.auth-submit {
    width: 100%;
    margin-top: 0.5rem;
}

.auth-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #3a3a3a;
    text-align: center;
}

.auth-footer p {
    margin: 0;
    color: #aaa;
    font-size: 0.9rem;
}

.auth-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.auth-link:hover {
    color: #6bb3ff;
    text-decoration: underline;
}

.forgot-password-link {
    text-align: right;
    font-size: 0.85rem;
    margin-top: -0.5rem;
}

/* Account Page */
.account-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #3a3a3a;
}

.account-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.account-section h2 {
    margin: 0 0 1rem 0;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 600;
}

.account-section h3 {
    margin: 0 0 1rem 0;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
}

.account-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.account-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: rgba(26, 26, 26, 0.5);
    border-radius: 6px;
}

.account-label {
    color: #aaa;
    font-size: 0.9rem;
    font-weight: 500;
}

.account-value {
    color: #e0e0e0;
    font-size: 0.9rem;
}

.account-warning {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 6px;
}

.account-warning p {
    margin: 0 0 0.5rem 0;
    color: #ffc107;
    font-size: 0.9rem;
}

.account-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.subscription-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}

.subscription-active {
    background: rgba(var(--accent-rgb), 0.2);
    color: var(--accent);
    border: 1px solid rgba(var(--accent-rgb), 0.3);
}

.subscription-canceled {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.subscription-past_due {
    background: rgba(255, 66, 77, 0.2);
    color: #ff6b6b;
    border: 1px solid rgba(255, 66, 77, 0.3);
}

/* Account Modal Styles */
.account-modal-content {
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.account-modal-content h2 {
    margin: 0 0 1.5rem 0;
    color: #fff;
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
}

.account-status-verified {
    color: var(--accent);
    font-weight: 600;
}

.account-status-unverified {
    color: #ff6b6b;
    font-weight: 600;
}

.account-logout-btn {
    background: rgba(255, 66, 77, 0.1) !important;
    border-color: #ff424d !important;
    color: #ff6b6b !important;
}

.account-logout-btn:hover {
    background: rgba(255, 66, 77, 0.2) !important;
    border-color: #ff6b6b !important;
    color: #ff8a8a !important;
}

.base-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 9999;
}

.base-modal-content {
    background-color: #2a2a2a;
    border: 2px solid var(--accent);
    border-radius: 8px;
    padding: 1rem;
    min-width: 200px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.9);
    position: relative;
    z-index: 10001;
}

.base-size-selector-content {
    min-width: 400px;
    max-width: 600px;
}

.base-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #3a3a3a;
    padding-bottom: 0.75rem;
}

.base-modal-header h3 {
    margin: 0;
    color: #fff;
    font-size: 1.1rem;
}

.base-modal-close {
    background: none;
    border: none;
    color: #e0e0e0;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.base-modal-close:hover {
    background-color: #3a3a3a;
}

.base-modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.base-modal-btn {
    background-color: #3a3a3a;
    border: 2px solid #4a4a4a;
    border-radius: 6px;
    padding: 0.75rem;
    cursor: pointer;
    color: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    min-width: 50px;
    min-height: 50px;
}

.base-modal-btn:hover {
    background-color: #4a4a4a;
    border-color: var(--accent);
    transform: translateY(-2px);
}

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

.base-modal-btn-danger:hover {
    background-color: #5a2a2a;
    border-color: #ff4a4a;
}

.base-modal-btn.active {
    background-color: #2a4a6a;
    border-color: var(--accent);
}

.base-sizes-grid-modal {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    max-height: 50vh;
    overflow-y: auto;
}

.base-size-item-modal {
    padding: 0.75rem;
    background-color: #1a1a1a;
    border: 2px solid #3a3a3a;
    border-radius: 4px;
    color: #e0e0e0;
    text-align: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.base-size-item-modal:hover {
    border-color: var(--accent);
    background-color: #2f3a4a;
    transform: translateY(-1px);
}

.base-size-item-modal:active {
    transform: translateY(0);
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .sidebar {
        width: 250px;
    }
    
    .base-sizes-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.35rem;
    }
    
    .toolbar {
        padding: 0.4rem 0.75rem;
    }
    
    .toolbar-controls {
        gap: 0.35rem;
    }
    
    .toolbar-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .toolbar-btn svg {
        width: 12px;
        height: 12px;
    }
    
    .toolbar-btn-icon-only {
        padding: 0.3rem 0.45rem;
    }
}

/* Shortcuts Popup */
.shortcuts-popup {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(145deg, #2a2a2a 0%, #1e1e1e 100%);
    border: 1px solid #444;
    border-radius: 12px;
    padding: 0;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    min-width: 280px;
    max-width: 360px;
    overflow: hidden;
    animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.shortcuts-popup.hidden {
    display: none;
}

.shortcuts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: rgba(var(--accent-rgb), 0.1);
    border-bottom: 1px solid #444;
}

.shortcuts-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    margin: 0;
}

.shortcuts-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.shortcuts-close:hover {
    color: #fff;
}

.shortcuts-content {
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.shortcut-group {
    margin-bottom: 0;
}

.shortcut-group h4 {
    font-size: 0.65rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.3rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid #333;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.2rem 0;
    font-size: 0.75rem;
    gap: 0.5rem;
}

.shortcut-item span {
    color: #ccc;
    text-align: right;
    flex: 1;
    font-size: 0.7rem;
}

.shortcut-item kbd {
    flex-shrink: 0;
}

kbd {
    display: inline-block;
    background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
    border: 1px solid #555;
    border-radius: 4px;
    padding: 0.1rem 0.3rem;
    font-family: 'SF Mono', Monaco, 'Consolas', monospace;
    font-size: 0.65rem;
    color: #e0e0e0;
    box-shadow: 0 2px 0 #222;
    margin: 0 0.1rem;
    white-space: nowrap;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .shortcuts-popup {
        bottom: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
    }
    
    .shortcuts-content {
        grid-template-columns: 1fr;
        gap: 0.4rem;
        padding: 0.4rem 0.6rem;
    }
    
    .shortcut-group h4 {
        font-size: 0.6rem;
        margin-bottom: 0.25rem;
    }
    
    .shortcut-item {
        padding: 0.15rem 0;
        font-size: 0.7rem;
    }
    
    .shortcut-item span {
        font-size: 0.65rem;
    }
    
    kbd {
        font-size: 0.6rem;
        padding: 0.08rem 0.25rem;
    }
    
    .app-title {
        font-size: 1.2rem;
    }
    
    .header {
        padding: 0.4rem 0.75rem;
        position: relative;
        z-index: 100;
    }
    
    .main-content {
        flex-direction: column-reverse;
        justify-content: flex-end;
    }
    
    .sidebar {
        width: 100%;
        max-height: none;
        border-right: none;
        border-top: 2px solid #3a3a3a;
        padding: 0.35rem 0.5rem;
        overflow-y: auto;
        display: grid;
        grid-template-columns: 3fr 2fr;
        gap: 0 0.5rem;
        align-items: start;
    }

    .sidebar > section:first-child {
        grid-column: 1;
        grid-row: 1;
        margin-bottom: 0;
    }

    .sidebar > .selectors-wrapper {
        grid-column: 2;
        grid-row: 1;
    }

    .sidebar > *:nth-child(n+3) {
        grid-column: 1 / -1;
    }

    .sidebar section {
        margin-bottom: 0.25rem;
    }

    .sidebar h2 {
        font-size: 0.7rem;
        margin-bottom: 0.15rem;
        cursor: default;
        user-select: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.1rem 0;
        border-bottom: none;
    }

    /* Remove collapse arrows */
    .sidebar h2::after {
        display: none;
    }

    /* Override collapse hiding — always visible */
    .selector-section.collapsed .selector-dropdown {
        display: block;
    }

    .selector-section.collapsed .base-sizes-grid {
        display: grid;
    }

    .selector-section.collapsed .shape-selector-container {
        display: flex;
    }

    .section-header-with-categories {
        gap: 0.25rem;
    }

    .category-buttons {
        gap: 0.2rem;
    }

    .category-btn {
        padding: 0.2rem 0.3rem;
        font-size: 0.65rem;
    }

    .selector-section {
        margin-bottom: 0.3rem;
    }

    .selector-section:last-of-type {
        margin-bottom: 0;
    }

    .sidebar-footer {
        grid-column: 1 / -1;
        padding: 0.3rem 0.25rem;
        font-size: 0.6rem;
    }

    .selector-dropdown {
        padding: 0.3rem;
        font-size: 0.8rem;
    }

    .base-sizes-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 0.2rem;
    }

    .base-size-item {
        padding: 0.2rem 0.1rem;
        font-size: 0.6rem;
    }

    .shape-selector-container {
        gap: 0.2rem;
        margin-top: 0.15rem;
    }

    .shape-row {
        padding: 0.2rem;
        gap: 0.2rem;
        border-width: 1px;
        border-radius: 4px;
    }

    .shape-size-dropdown {
        padding: 0.2rem 0.15rem;
        font-size: 0.65rem;
    }

    .shape-qty-input {
        width: 28px;
        padding: 0.2rem 0.1rem;
        font-size: 0.65rem;
    }

    .shape-drag-button,
    .custom-size-drag-button {
        width: 26px;
        height: 26px;
        border-width: 1px;
        border-radius: 4px;
    }

    .shape-drag-button svg,
    .custom-size-drag-button svg {
        width: 16px;
        height: 16px;
    }
    
    .battlefield-container {
        flex: 0 1 auto;
        min-height: auto;
        padding: 0.15rem 0.2rem;
        position: relative;
        display: flex;
        flex-direction: column;
        overflow: visible;
    }
    
    .toolbar {
        padding: 0.35rem 0.5rem;
        margin-bottom: 0;
        margin-top: 0.5rem;
        flex-shrink: 0;
        width: 100%;
        box-sizing: border-box;
        z-index: 50;
        order: 2;
        flex-wrap: wrap;
        row-gap: 0.35rem;
        overflow: visible;
    }
    
    /* Hide section titles entirely on mobile — icons speak for themselves, tooltips give names */
    .toolbar-section-title {
        display: none;
    }

    .toolbar-section-title:not(:first-child) {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
    }
    
    .toolbar-controls {
        gap: 0.3rem;
    }
    
    .toolbar-btn {
        padding: 0.28rem 0.45rem;
        font-size: 0.65rem;
        gap: 0.25rem;
    }
    
    .toolbar-btn svg {
        width: 11px;
        height: 11px;
    }
    
    .toolbar-btn span {
        display: none; /* Hide text labels on mobile, keep icons only */
    }

    /* The Snap button wraps its SVG in .toolbar-btn-content (a span) — restore it so the icon still shows */
    .toolbar-btn .toolbar-btn-content {
        display: flex;
        align-items: center;
        gap: 0.3rem;
    }

    .toolbar-btn-icon-only span {
        display: none; /* Already hidden */
    }
    
    .toolbar-btn-small {
        padding: 0.22rem 0.38rem;
        font-size: 0.65rem;
    }
    
    .battlefield-wrapper {
        flex: 0 0 auto;
        width: 100%;
        height: auto;
        aspect-ratio: var(--board-aspect);
        min-height: 0;
        order: 1;
        margin-bottom: 0;
    }
    
    /* Make base size modal more compact on mobile */
    .base-size-selector-content {
        min-width: 85vw;
        max-width: 90vw;
        padding: 0.5rem;
    }
    
    .base-modal-header {
        margin-bottom: 0.75rem;
        padding-bottom: 0.4rem;
    }
    
    .base-modal-header h3 {
        font-size: 0.9rem;
    }
    
    .base-sizes-grid-modal {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.3rem;
        max-height: 50vh;
    }
    
    .base-size-item-modal {
        padding: 0.5rem 0.2rem;
        font-size: 0.7rem;
    }

    /* ─────────────────────────────────────────────────────────────
       PRD-001: scrollable homepage + single-column sidebar + bigger
       touch targets. These come LAST in the 768px block so they win
       over the cramped fit-to-one-screen rules above. Desktop (≥769px)
       is untouched.
       ───────────────────────────────────────────────────────────── */

    /* Page scrolls instead of being crammed into one viewport */
    .main-content {
        overflow: visible;
        justify-content: flex-start;
    }

    .battlefield-container {
        overflow: visible;
    }

    /* Mobile: Base Sizes (left) and the match selectors (right) sit
       side-by-side UNDER the map, so dispositions are reachable without
       scrolling past a full-width Base Sizes panel. The child placement
       (col 1 / col 2 / full-width below) is defined in the grid block above.
       The 11e disposition lists collapse to one column (see .e11e-disp-grid
       below) so they don't clip in the narrower right column. */
    .sidebar {
        display: grid;
        grid-template-columns: 3fr 2fr;
        gap: 0 0.5rem;
        align-items: start;
        max-height: none;
        overflow: visible;
    }

    /* Narrow right column: stack the two disposition lists vertically so
       each button keeps the full column width instead of clipping. */
    .e11e-disp-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    /* Right column rhythm: kill the dead gap under the edition switch and
       let the 11e setup sit tight up against it. */
    .sidebar > .selectors-wrapper .edition-switch {
        margin-bottom: 0.4rem;
    }
    .sidebar > .selectors-wrapper .e11e {
        padding: 2px 6px 0;
    }
    /* Edition toggle: slightly leaner so it doesn't dominate the column. */
    .sidebar > .selectors-wrapper .edition-btn {
        min-height: 32px;
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }
    /* The 11e mission box is a desktop card (translucent panel + border).
       In the narrow mobile column it reads as a stray floating rectangle of
       a different shade. Flatten it so the right column is one clean surface
       on the #252525 sidebar — like the plain dropdown column used to be. */
    .sidebar > .selectors-wrapper .e11e-missions {
        background: transparent;
        border-color: transparent;
        padding: 2px 0;
    }
    /* Keep the sections from jamming together. */
    .sidebar > .selectors-wrapper .e11e-section {
        margin-bottom: 0.6rem;
    }

    /* Board keeps a sensible height; controls scroll into view below it */
    .battlefield-wrapper {
        position: relative;
        max-height: 72vh;
    }

    /* Comfortable tap targets (≥ ~40px) */
    .selector-dropdown {
        padding: 0.5rem;
        font-size: 0.9rem;
        min-height: 40px;
    }

    .category-btn,
    .edition-btn {
        min-height: 38px;
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .base-sizes-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.3rem;
    }

    .base-size-item {
        min-height: 42px;
        padding: 0.4rem 0.2rem;
        font-size: 0.7rem;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .shape-size-dropdown {
        padding: 0.4rem 0.3rem;
        font-size: 0.8rem;
        min-height: 38px;
    }

    .shape-qty-input {
        width: 44px;
        padding: 0.4rem 0.2rem;
        font-size: 0.8rem;
        min-height: 38px;
    }

    .shape-drag-button,
    .custom-size-drag-button {
        width: 40px;
        height: 40px;
        border-radius: 6px;
    }

    .shape-drag-button svg,
    .custom-size-drag-button svg {
        width: 20px;
        height: 20px;
    }

    /* Mobile-only reset-view control for the pinch-zoomed board */
    .board-reset-view-btn {
        position: absolute;
        top: 8px;
        right: 8px;
        z-index: 20;
        padding: 0.4rem 0.7rem;
        font-size: 0.75rem;
        font-weight: 600;
        color: #fff;
        background: rgba(26, 26, 26, 0.85);
        border: 1px solid var(--accent);
        border-radius: 6px;
        cursor: pointer;
        backdrop-filter: blur(4px);
        min-height: 36px;
    }

    /* Modals: comfortable padding + content always reachable (internal
       scroll) while the page scroll is locked behind the overlay. Covers
       Login/Signup and the first-visit popup (both use .modal-content). */
    .modal-content {
        padding: 1.25rem;
        max-height: 90vh;
        max-height: 90dvh;
        overflow-y: auto;
    }

    .modal-content .button,
    .auth-card .button,
    .auth-card .auth-submit {
        min-height: 44px;
    }

    /* Account / checkout cards */
    .auth-card {
        padding: 1.5rem;
    }

    /* Keep the user-menu dropdown inside the screen on small phones */
    .user-menu-dropdown {
        right: 8px;
        max-width: calc(100vw - 16px);
    }
}

/* Responsive - Very Small Mobile */
@media (max-width: 480px) {
    .app-title {
        font-size: 1rem;
    }
    
    .header-nav-link {
        font-size: 0.8rem;
        padding: 0.3rem 0.5rem;
    }
    
    .base-sizes-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 0.2rem;
    }
    
    .base-size-item {
        padding: 0.25rem 0.1rem;
        font-size: 0.6rem;
    }
    
    .toolbar-section-title {
        display: none; /* Hide section titles on very small screens */
    }
    
    .toolbar-btn {
        padding: 0.3rem;
        min-width: 32px;
        min-height: 32px;
        justify-content: center;
    }
    
    .toolbar-btn-icon-only {
        padding: 0.3rem;
    }
}

/* Responsive - Extra Small Screens (< 360px) */
@media (max-width: 360px) {
    .header {
        padding: 0.3rem 0.5rem;
    }
    
    .app-title {
        font-size: 0.9rem;
    }
    
    .header-nav-link {
        font-size: 0.75rem;
        padding: 0.25rem 0.4rem;
    }
    
    .sidebar {
        padding: 0.25rem 0.4rem;
        max-height: 25vh;
    }

    .sidebar h2 {
        font-size: 0.65rem;
    }

    .category-btn {
        padding: 0.15rem 0.25rem;
        font-size: 0.6rem;
    }

    .selector-dropdown {
        padding: 0.25rem;
        font-size: 0.75rem;
    }

    .base-sizes-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 0.15rem;
    }

    .base-size-item {
        padding: 0.15rem 0.05rem;
        font-size: 0.5rem;
    }

    .shape-row {
        padding: 0.15rem;
        gap: 0.15rem;
    }

    .shape-drag-button,
    .custom-size-drag-button {
        width: 22px;
        height: 22px;
    }

    .shape-drag-button svg,
    .custom-size-drag-button svg {
        width: 14px;
        height: 14px;
    }

    .shape-qty-input {
        width: 24px;
        font-size: 0.6rem;
    }

    .shape-size-dropdown {
        font-size: 0.55rem;
        padding: 0.1rem;
    }
    
    .toolbar {
        padding: 0.3rem 0.4rem;
    }
    
    .toolbar-btn {
        padding: 0.25rem;
        min-width: 30px;
        min-height: 30px;
    }
    
    .toolbar-btn svg {
        width: 10px;
        height: 10px;
    }
    
    .base-size-selector-content {
        min-width: 92vw;
        padding: 0.4rem;
    }
    
    .base-modal-header h3 {
        font-size: 0.85rem;
    }
    
    .base-sizes-grid-modal {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.25rem;
    }
    
    .base-size-item-modal {
        padding: 0.4rem 0.15rem;
        font-size: 0.65rem;
    }
}

/* ──────────────────────────────────────────────
   List Page — My Layouts, My Boards
   ────────────────────────────────────────────── */

.list-page {
    flex: 1;
    background: #1a1a1a;
    color: #ccc;
    padding: 24px;
}

.list-page-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.list-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 12px;
}

.list-page-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.list-page-title {
    margin: 0;
    font-size: 24px;
    color: #fff;
    font-weight: 600;
}

.list-page-subtitle {
    margin: 4px 0 0 0;
    color: #aaa;
    font-size: 14px;
}

.list-page-back {
    color: #888;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.list-page-back:hover {
    color: var(--accent);
}

.list-page-action {
    padding: 8px 16px;
    background: var(--accent);
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.list-page-action:hover {
    background: #3a8eef;
}

/* Status / empty states */
.list-page-status {
    text-align: center;
    padding: 48px;
    color: #888;
}

.list-page-empty {
    text-align: center;
    padding: 48px;
    background: #2a2a2a;
    border-radius: 8px;
    border: 1px solid #3a3a3a;
}

.list-page-empty h3 {
    margin: 0 0 8px 0;
    color: #fff;
    font-size: 20px;
}

.list-page-empty p {
    margin: 0;
    color: #aaa;
}

.list-page-empty-link {
    display: inline-block;
    margin-top: 16px;
    padding: 10px 24px;
    background: var(--accent);
    color: var(--accent-text);
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: background 0.2s;
}

.list-page-empty-link:hover {
    background: #3a8eef;
}

/* Card grid */
.list-page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* Cards */
.list-card {
    background: #2a2a2a;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #3a3a3a;
    transition: border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.list-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.15);
}

.list-card-preview {
    padding: 8px;
    background: #2d2d2d;
    display: flex;
    justify-content: center;
}

.list-card-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.list-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 16px;
    flex: 1;
}

.list-card-name {
    font-weight: 600;
    color: #fff;
    font-size: 14px;
    margin-bottom: 4px;
}

.list-card-name-lg {
    font-weight: 600;
    color: #fff;
    font-size: 18px;
    margin: 0 0 8px 0;
}

.list-card-meta {
    font-size: 11px;
    color: #888;
    margin-bottom: 8px;
}

.list-card-meta-line {
    font-size: 13px;
    color: #aaa;
    margin: 0;
}

.list-card-meta-line-dim {
    font-size: 13px;
    color: #888;
    margin: 4px 0 0 0;
}

/* Card buttons */
.list-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
}

.list-card-btn {
    padding: 6px 10px;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 4px;
    color: #ccc;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.list-card-btn:hover {
    background: #3a3a3a;
    border-color: #555;
}

.list-card-btn-primary {
    flex: 1;
    min-width: 60px;
    padding: 6px;
    background: var(--accent);
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.list-card-btn-primary:hover {
    background: #3a8eef;
}

.list-card-btn-accent {
    padding: 6px 10px;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 4px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.list-card-btn-accent:hover {
    background: rgba(var(--accent-rgb), 0.1);
    border-color: var(--accent);
}

.list-card-btn-danger {
    padding: 6px 10px;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 4px;
    color: #cc4444;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.list-card-btn-danger:hover {
    background: rgba(204, 68, 68, 0.15);
    border-color: #cc4444;
}

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

/* ──────────────────────────────────────────────
   Hamburger Menu (Header)
   ────────────────────────────────────────────── */

.header-nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #e0e0e0;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 4px;
    transition: background 0.2s;
}

.header-nav-toggle:hover {
    background: rgba(var(--accent-rgb), 0.1);
}

/* ──────────────────────────────────────────────
   Responsive — List Pages + Hamburger
   ────────────────────────────────────────────── */

@media (max-width: 768px) {
    /* Hamburger menu */
    .header-nav-toggle {
        display: block;
    }

    .header-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #2a2a2a;
        border-bottom: 2px solid #3a3a3a;
        flex-direction: column;
        padding: 8px 0;
        gap: 0;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        z-index: 99;
    }

    .header-links.open {
        display: flex;
    }

    .header-links .header-nav-link,
    .header-links .user-menu-container,
    .header-links .button {
        width: 100%;
        padding: 10px 16px;
        border-radius: 0;
        text-align: left;
        box-sizing: border-box;
    }

    .header-links .button.button-primary {
        background: none;
        border: none;
        color: var(--accent);
        font-weight: 600;
        font-size: 0.9rem;
        padding: 10px 16px;
        text-align: left;
    }

    /* List page */
    .list-page {
        padding: 16px;
    }

    .list-page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .list-page-header-left {
        margin-bottom: 8px;
    }

    .list-page-action {
        width: 100%;
        text-align: center;
    }

    .list-page-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (max-width: 480px) {
    .list-page {
        padding: 12px;
    }

    .list-page-title {
        font-size: 20px;
    }

    .list-page-grid {
        grid-template-columns: 1fr;
    }

    .list-card-body {
        padding: 10px;
    }

    .list-card-link {
        padding: 12px;
    }

    .list-card-name-lg {
        font-size: 16px;
    }
}

@media (max-width: 360px) {
    .list-page {
        padding: 8px;
    }

    .list-page-header {
        margin-bottom: 16px;
    }
}

/* ── First-visit welcome modal ── */

.first-visit-modal {
    max-width: 540px;
    text-align: center;
    padding: 1.5rem;
}

.fv-media {
    border-radius: 6px;
    overflow: hidden;
    margin: -0.5rem -0.5rem 1rem;
    background: #1a1a1a;
}

.fv-media video,
.fv-media img {
    width: 100%;
    display: block;
    border-radius: 6px;
}

.fv-title {
    font-size: 1.3rem !important;
    font-weight: 700;
    color: #fff !important;
    margin-bottom: 0.25rem !important;
}

.fv-subtitle {
    color: #999 !important;
    font-size: 0.9rem !important;
    margin-bottom: 1rem !important;
}

.fv-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    text-align: left;
}

.fv-tier {
    background: #222;
    border-radius: 6px;
    padding: 0.75rem;
    border: 1px solid #333;
}

.fv-tier-pro {
    border-color: rgba(212, 175, 55, 0.3);
}

.fv-tier-heading {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    margin: 0 0 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #333;
}

.fv-heading-pro {
    color: #d4af37;
    border-bottom-color: rgba(212, 175, 55, 0.25);
}

.fv-price {
    font-weight: 400;
    opacity: 0.65;
    font-size: 0.8rem;
}

.fv-tier-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.fv-tier-list li {
    padding: 0.25rem 0;
    font-size: 0.8rem;
    color: #ccc;
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
}

.fv-inherited {
    opacity: 0.4;
}

.fv-check {
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
    font-size: 0.75rem;
    margin-top: 1px;
    opacity: 0.6;
}

.fv-check-pro {
    color: #d4af37;
    opacity: 1;
}

/* First-visit primary follows the standard amber primary (theme unification
   2026-07-28; the old green override clashed with the accent border). */
.fv-btn-primary {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.fv-btn-secondary {
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.5rem;
}

.fv-btn-secondary:hover {
    color: #fff;
}

@media (max-width: 600px) {
    .first-visit-modal {
        padding: 1rem;
    }

    /* Stack the Free / Pro comparison so it isn't cramped on phones */
    .fv-comparison {
        grid-template-columns: 1fr;
    }

    .fv-title {
        font-size: 1.1rem !important;
    }
}

/* ========== Editor Mobile Responsive ========== */

/* Desktop defaults */
.editor-mobile-panel {
    display: none;
}

.editor-tab-bar {
    display: none;
}

.editor-tab {
    flex: 1;
    padding: 8px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #888;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.15s ease;
}

.editor-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.editor-tab:hover:not(.active) {
    color: #bbb;
}

.editor-tab-content {
    overflow-y: auto;
}

/* Editor Mobile (<= 768px) */
@media (max-width: 768px) {
    .editor-body {
        flex-direction: column !important;
    }

    .editor-canvas-wrapper {
        flex: 0 0 auto !important;
        width: 100% !important;
        aspect-ratio: var(--board-aspect);
    }

    .editor-mobile-panel {
        display: flex;
        flex-direction: column;
        border-top: 1px solid #333;
    }

    .editor-tab-bar {
        display: flex;
        background: #222;
        border-bottom: 1px solid #333;
    }

    .editor-tab-content {
        max-height: 35vh;
    }

    .editor-toolbar {
        gap: 6px !important;
        padding: 6px 8px !important;
        overflow-x: auto;
        flex-wrap: nowrap !important;
    }

    .editor-toolbar .etb-label {
        display: none;
    }

    .editor-toolbar-name {
        width: 100px !important;
    }

    .editor-toolbar-dims input {
        width: 40px !important;
    }

    .editor-palette {
        width: 100% !important;
        border-right: none !important;
    }

    .editor-properties {
        width: 100% !important;
        border-left: none !important;
    }
}

/* Editor Very Small Mobile (<= 480px) */
@media (max-width: 480px) {
    .editor-toolbar-name {
        width: 80px !important;
    }

    .editor-toolbar-dims input {
        width: 32px !important;
    }

    .editor-tab-content {
        max-height: 30vh;
    }
}

/* --- Army List Import --- */
.base-sizes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.base-sizes-header h2 {
    flex: 1;
    margin: 0;
}

.import-army-btn {
    background: #2a2a2a;
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 12px;
    padding: 0.15rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-right: 0.5rem;
}

.import-army-btn:hover {
    background: var(--accent);
    color: var(--accent-text);
}

.import-army-modal {
    max-width: 640px;
    width: 92%;
    max-height: 85vh;
    overflow-y: auto;
}

.import-army-textarea {
    width: 100%;
    min-height: 180px;
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #e0e0e0;
    padding: 0.6rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.82rem;
    resize: vertical;
    box-sizing: border-box;
    margin-top: 0.5rem;
}

.import-army-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.import-army-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.import-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.import-preview-table th,
.import-preview-table td {
    text-align: left;
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid #3a3a3a;
    color: #ddd;
}

.import-preview-table th {
    color: #888;
    font-weight: 500;
    background: #1e1e1e;
}

.import-preview-table tr:last-child td {
    border-bottom: none;
}

.import-skip-list td {
    color: #c88;
}

/* =====================================================================
   11e match setup (Edition11eSetup) + V2 "Condensed" treatment.
   Promoted from the /harness V2 A/B test: side-by-side dispositions,
   collapse-to-summary, Layout on top, tighter rhythm. Same features.
   ===================================================================== */

.e11e {
    padding: 8px 10px;
}
.e11e-section {
    margin-bottom: 0.7rem;
}
.e11e-eyebrow {
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #8f8f93;
    margin-bottom: 5px;
}

/* Layout A/B/C row (top) */
.e11e-variant-row {
    display: flex;
    gap: 6px;
}
.e11e-variant-btn {
    flex: 1;
}
.e11e-variant-btn:disabled {
    opacity: 0.5;
    cursor: default;
}
.e11e-random {
    width: 100%;
    margin-top: 7px;
}
/* Layout row now sits below the disposition summary — add a separating gap */
.e11e-layout-section {
    margin-top: 0.7rem;
}

/* THE condensing move: two disposition columns side-by-side */
.e11e-disp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.e11e-disp-col-label {
    font-size: 10px;
    color: #999;
    margin-bottom: 4px;
}
.e11e-disp-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.e11e-disp-btn {
    width: 100%;
    text-align: left;
    padding: 4px 6px;
    font-size: 10.5px;
    border-width: 1px;
    border-radius: 5px;
}

/* Resolved missions — clearer per-player labelling; doubles as the resting
   state + click-to-edit affordance when the pickers are collapsed. */
.e11e-missions {
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    border-radius: 6px;
}
.e11e-missions-clickable {
    cursor: pointer;
    border-color: #3a3a3a;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}
.e11e-missions-clickable:hover {
    border-color: var(--accent);
    background-color: rgba(var(--accent-rgb), 0.08);
}
.e11e-missions-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9ad;
    margin-bottom: 6px;
}
.e11e-missions-edit {
    font-weight: 600;
    color: #8f8f93;
    letter-spacing: 0;
    text-transform: none;
}
.e11e-mission {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-top: 3px;
}
.e11e-mission-player {
    flex-shrink: 0;
    min-width: 56px;
    white-space: nowrap;
    font-size: 10.5px;
    color: #888;
}
.e11e-mission-name {
    font-size: 12px;
    line-height: 1.25;
    font-weight: 600;
    color: #fff;
}

/* ---- V2 "Condensed" rail/base-size/toolbar treatment ---- */
/* Desktop only: this fixed width must NOT apply at ≤768px, where the sidebar
   goes full-width below the map (otherwise the side-by-side grid content
   overflows the 280px background box and spills onto the page bg). */
@media (min-width: 769px) {
    .sidebar {
        width: 280px;
    }
}
.shape-selector-container {
    gap: 0.35rem;
    margin-top: 0.35rem;
}
.shape-row {
    padding: 0.3rem;
    gap: 0.3rem;
    border-width: 1px;
}
.shape-drag-button,
.custom-size-drag-button {
    width: 30px;
    height: 30px;
    border-width: 1px;
}
.shape-drag-button svg,
.custom-size-drag-button svg {
    width: 20px;
    height: 20px;
}
.selector-section {
    margin-bottom: 0.9rem;
}

/* ─────────────────────────────────────────────────────────────
   PRD-001: shared prose-page padding (Legal + Giveaways). Desktop
   keeps the original 2rem; mobile tightens it so the ~720px column
   isn't cramped on a phone.
   ───────────────────────────────────────────────────────────── */
.legal-prose {
    padding: 2rem 2rem 4rem;
}

@media (max-width: 768px) {
    .legal-prose {
        padding: 1.25rem 1rem 3rem;
    }
}
