:root {
    --primary: #00d2ff;
    --primary-dim: rgba(0, 210, 255, 0.1);
    --secondary: #3a7bd5;
    --bg-dark: #0b0e14;
    --panel-bg: rgba(22, 27, 34, 0.95);
    --text-main: #e6edf3;
    --text-muted: #8b949e;
    
    --success: #238636;
    --danger: #f85149;
    --warning: #d29922;
    
    --metal: #9ca3af;
    --crystal: #79c0ff;
    --deuterium: #56d364;

    /* FONT STANDARD V3 */
    --font-tech: 'Rajdhani', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }

/* ─── Accessibility defaults ────────────────────────────────────────── */
:focus-visible {
    outline: 3px solid rgba(0, 210, 255, 0.95);
    outline-offset: 3px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: 12px;
    top: 12px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    text-decoration: none;
    transform: translateY(-200%);
    transition: transform 0.2s ease;
    z-index: 9999;
}
.skip-link:focus {
    transform: translateY(0);
}

html {
    height: 100%;
}

body {
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at 50% 0%, #1c2333 0%, #0b0e14 70%);
    color: var(--text-main);
    font-family: var(--font-body);
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* Decorative layer (fixed: no flex layout impact) */
.background-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 10% 20%, rgba(0, 210, 255, 0.1) 0%, transparent 20%),
                radial-gradient(circle at 90% 80%, rgba(255, 215, 0, 0.05) 0%, transparent 20%);
    z-index: -1;
}

/* Sticky footer shell: grows with content, footer sits at viewport bottom when short */
.page-shell {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 20px;
    padding-bottom: 0;
    box-sizing: border-box;
}

/* Container allargato per coerenza con gli altri tool */
.container { 
    max-width: 1400px; 
    margin: 0 auto; 
    position: relative; 
    z-index: 2; 
    padding-bottom: 40px;
    flex: 1 1 auto;
    width: 100%;
}

/* HEADER AGGIORNATO */
.header-section { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.header-left { display: flex; align-items: center; gap: 15px; } /* Logo e Home a sinistra */
.header-right { display: flex; align-items: center; gap: 15px; } /* Donazione e Lingua a destra */

.main-title { font-family: var(--font-tech); font-size: 2.2rem; font-weight: 700; letter-spacing: 2px; margin: 0; background: linear-gradient(to bottom, #ffffff, #a5b4fc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.highlight { color: var(--primary); -webkit-text-fill-color: var(--primary); }
.v-tag { font-size: 0.4em; background: var(--primary-dim); border: 1px solid var(--primary); color: var(--primary); -webkit-text-fill-color: var(--primary); padding: 2px 6px; border-radius: 4px; vertical-align: middle; margin-left: 10px; font-weight: 600; }

.home-btn { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; background: rgba(0, 212, 255, 0.1); border: 1px solid var(--primary); color: var(--primary); border-radius: 8px; font-size: 1.2rem; transition: 0.3s; box-shadow: 0 0 10px var(--primary-dim); text-decoration: none; }
.home-btn:hover { background: var(--primary); color: #000; box-shadow: 0 0 20px var(--primary); transform: translateY(-2px); }

/* TASTO DONAZIONE HEADER */
.btn-donate-header {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 15px;
    background: rgba(255, 215, 0, 0.05);
    border: 1px solid #ffd700; color: #ffd700; 
    border-radius: 50px; text-decoration: none;
    font-family: var(--font-tech); font-weight: 700; font-size: 0.8rem;
    letter-spacing: 1px; transition: all 0.3s ease;
}
.btn-donate-header:hover {
    background: #ffd700; color: #000;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

/* LINGUA */
.lang-bar { display: flex; align-items: center; }
.lang-select { 
    background: #000; border: 1px solid var(--primary); color: var(--text-muted); 
    padding: 6px 12px; font-family: var(--font-tech); font-weight: 700; font-size: 0.9rem; 
    border-radius: 4px; outline: none; cursor: pointer; transition: 0.3s; 
}
.lang-select:hover, .lang-select:focus { border-color: var(--primary); color: white; box-shadow: 0 0 10px var(--primary-dim); }
.lang-select option { background-color: #0a0b10; color: white; }

/* PANELS */
.glass-panel { background: var(--panel-bg); border: 1px solid rgba(255, 255, 255, 0.1); backdrop-filter: blur(10px); border-radius: 12px; padding: 20px; margin-bottom: 20px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); position: relative; }
.step-badge { position: absolute; top: -10px; left: 20px; background: var(--bg-dark); border: 1px solid var(--primary); color: var(--primary); width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--font-tech); font-weight: bold; box-shadow: 0 0 10px var(--primary-dim); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding-left: 10px; }
.panel-head h3 { margin: 0; font-family: var(--font-tech); font-size: 1.1rem; color: var(--primary); text-transform: uppercase; letter-spacing: 1px; }
.head-flex { display: flex; align-items: center; gap: 10px; }

/* ===== Cards toolbar (expand / image share) ===== */
.cards-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    padding-right: 10px;
}

.cards-toolbar-sep {
    width: 1px;
    height: 22px;
    background: rgba(255,255,255,0.14);
    opacity: 0.8;
}

.cards-tool-btn,
.cards-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.28);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.cards-tool-btn:hover,
.cards-icon-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 210, 255, 0.35);
    box-shadow: 0 0 0 3px rgba(0, 210, 255, 0.08), 0 0 18px rgba(0, 210, 255, 0.14);
}

.cards-tool-btn:active,
.cards-icon-btn:active {
    transform: translateY(0);
    opacity: 0.92;
}

.cards-tool-btn:disabled,
.cards-icon-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.cards-tool-btn i,
.cards-icon-btn i {
    font-size: 1rem;
}

.cards-tool-btn--forum {
    width: auto;
    padding: 0 16px;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    background: rgba(0, 210, 255, 0.10);
    border-color: rgba(0, 210, 255, 0.30);
    color: #00d2ff;
    white-space: nowrap;
}
.cards-tool-btn--forum:hover {
    background: rgba(0, 210, 255, 0.18);
    border-color: rgba(0, 210, 255, 0.55);
    color: #fff;
}

.cards-icon-wa { background: rgba(37, 211, 102, 0.12); border-color: rgba(37, 211, 102, 0.25); color: #eafff1; }
.cards-icon-wa:hover { box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.10), 0 0 18px rgba(37, 211, 102, 0.18); border-color: rgba(37, 211, 102, 0.55); }

.cards-icon-tg { background: rgba(0, 136, 204, 0.12); border-color: rgba(0, 136, 204, 0.25); color: #e9f7ff; }
.cards-icon-tg:hover { box-shadow: 0 0 0 3px rgba(0, 136, 204, 0.10), 0 0 18px rgba(0, 136, 204, 0.18); border-color: rgba(0, 136, 204, 0.55); }

.cards-icon-discord { background: rgba(88, 101, 242, 0.12); border-color: rgba(88, 101, 242, 0.25); color: #eef0ff; }
.cards-icon-discord:hover { box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.10), 0 0 18px rgba(88, 101, 242, 0.18); border-color: rgba(88, 101, 242, 0.55); }

#cards-stage { position: relative; }

/* ===== Cards modal ===== */
.cards-modal {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: none;
}
.cards-modal[aria-hidden="false"] { display: block; }

.cards-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.68);
    backdrop-filter: blur(4px);
}

.cards-modal-window {
    position: absolute;
    left: 12px;
    right: 12px;
    top: 12px;
    bottom: 12px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(10, 12, 18, 0.92);
    box-shadow: 0 22px 70px rgba(0,0,0,0.55);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.cards-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.22);
}

.cards-modal-title {
    font-family: var(--font-tech);
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--primary);
}

.cards-modal-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.cards-modal-body {
    padding: 16px;
    overflow: auto;
}

body.cards-modal-open { overflow: hidden !important; }

/* ===== Share output modal (preview + snippets) ===== */
.shareout-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
}
.shareout-modal[aria-hidden="false"] { display: block; }

.shareout-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.68);
    backdrop-filter: blur(4px);
}

.shareout-window {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: min(980px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(10, 12, 18, 0.92);
    box-shadow: 0 22px 70px rgba(0,0,0,0.55);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.shareout-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.22);
}

.shareout-title {
    font-family: var(--font-tech);
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--primary);
}

.shareout-body {
    padding: 14px;
    overflow: auto;
    display: grid;
    gap: 14px;
}

.shareout-preview {
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 14px;
    background: rgba(0,0,0,0.20);
    padding: 12px;
}

.shareout-preview img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.30);
}

.shareout-snips { display: grid; gap: 12px; }
.shareout-row { display: grid; gap: 8px; }
.shareout-lab {
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.shareout-field {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: stretch;
}

.shareout-field input,
.shareout-field textarea {
    width: 100%;
    min-width: 0;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(0,0,0,0.35);
    color: #e6edf3;
    padding: 10px 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.85rem;
    outline: none;
}

.shareout-field textarea {
    min-height: 92px;
    resize: vertical;
}

@media (max-width: 480px) {
    .shareout-preview img { max-height: 200px; }
    .shareout-field { grid-template-columns: 1fr; }
}

/* CONFIG */
.config-bar { padding: 15px 20px; }
.config-content { display: flex; align-items: center; width: 100%; justify-content: center; gap: 40px; }
.config-group { display: flex; align-items: center; gap: 15px; }
.c-label { font-weight: bold; color: var(--text-muted); font-size: 0.9rem; text-transform: uppercase; }
.v-sep { width: 1px; height: 25px; background: rgba(255,255,255,0.1); }
.toggle-switch { display: flex; background: rgba(0,0,0,0.3); border-radius: 4px; padding: 2px; border: 1px solid rgba(255,255,255,0.1); }
.toggle-switch input { display: none; }
.toggle-switch label { padding: 6px 15px; cursor: pointer; font-size: 0.85rem; border-radius: 3px; transition: 0.3s; color: var(--text-muted); }
.toggle-switch input:checked + label { background: var(--primary-dim); color: var(--primary); font-weight: bold; border: 1px solid var(--primary); margin: -1px; }

/* INPUT */
.unified-input-container { position: relative; margin-bottom: 20px; }
textarea#unified-input {
    width: 100%;
    height: 110px;
    border-radius: 10px;
    color: var(--primary);
    padding: 14px 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.86rem;
    resize: none;
    transition: 0.3s;
    border: 1px solid rgba(0, 210, 255, 0.18);
    background:
        linear-gradient(135deg, rgba(0, 210, 255, 0.06), rgba(255,255,255,0.02)),
        rgba(5, 8, 14, 0.95);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.04),
        0 8px 18px rgba(0,0,0,0.35);
}

textarea#unified-input:focus {
    outline: none;
    border-color: rgba(0, 210, 255, 0.55);
    box-shadow:
        0 0 0 3px rgba(0, 210, 255, 0.08),
        0 0 18px rgba(0, 210, 255, 0.14),
        inset 0 1px 0 rgba(255,255,255,0.04);
}
.memory-indicators { display: flex; gap: 10px; align-items: center; }
.mem-badge { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: var(--text-muted); padding: 4px 10px; border-radius: 4px; font-size: 0.75rem; font-weight: bold; font-family: var(--font-tech); transition: 0.3s; display: flex; align-items: center; gap: 5px; }
.mem-badge.active { background: rgba(35, 134, 54, 0.2); border-color: var(--success); color: var(--success); box-shadow: 0 0 10px rgba(35, 134, 54, 0.2); }
.btn-icon-small { background: transparent; border: none; color: var(--danger); cursor: pointer; font-size: 0.9rem; margin-left: 5px; opacity: 0.7; transition: 0.2s; }
.btn-icon-small:hover { opacity: 1; transform: scale(1.1); }

/* FEEDBACK MSG */
.input-feedback { 
    position: absolute; top: 50%; left: 25px; transform: translateY(-50%); 
    font-size: 1.1rem; font-weight: 900; text-transform: uppercase; letter-spacing: 1px; font-family: var(--font-tech);
    opacity: 0; transition: opacity 0.5s; pointer-events: none; text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}
.feedback-success { color: var(--success); opacity: 1; }
.feedback-error { color: var(--danger); opacity: 1; }

.btn-main { width: 100%; padding: 15px; background: linear-gradient(90deg, var(--secondary) 0%, var(--primary) 100%); border: none; border-radius: 6px; color: #000; font-family: var(--font-tech); font-weight: 900; font-size: 1.1rem; cursor: pointer; text-transform: uppercase; transition: 0.3s; }
.btn-main:hover { transform: translateY(-2px); box-shadow: 0 0 20px rgba(0, 210, 255, 0.5); }

/* SUMMARY */
.summary-strip { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; margin-bottom: 20px; }
.summary-strip > .summary-strip-extra { grid-column: 1 / -1; }
.sum-item { background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); padding: 8px; border-radius: 6px; text-align: center; }
.sum-label { display: block; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
.sum-val { font-family: var(--font-tech); font-size: 1.1rem; font-weight: bold; color: white; }

/* CARDS */
.cards-grid { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 25px; justify-content: center; }

.player-card { 
    flex: 0 1 420px;
    min-width: 280px;
    background: linear-gradient(160deg, rgba(22,27,34,1) 0%, rgba(30,35,45,1) 100%); 
    border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; transition: 0.3s;
    overflow: visible; position: relative; z-index: 1;
}
.player-card:hover { transform: translateY(-3px); border-color: var(--primary); z-index: 10; }

.card-header { background: rgba(0,0,0,0.3); padding: 10px 15px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.05); border-radius: 7px 7px 0 0; }
.card-footer { padding: 10px; text-align: center; background: rgba(0,0,0,0.2); border-top: 1px solid rgba(255,255,255,0.05); border-radius: 0 0 7px 7px; }

.p-name { font-family: var(--font-tech); color: white; font-size: 1rem; font-weight: bold; }
.status-badge { font-size: 0.7rem; font-weight: bold; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; }
.status-rec { background: rgba(35, 134, 54, 0.2); color: #7ee787; border: 1px solid #238636; }
.status-pay { background: rgba(218, 54, 51, 0.2); color: #ff7b72; border: 1px solid #da3633; }
.status-even { color: var(--text-muted); border: 1px solid var(--text-muted); }
.card-body { padding: 12px 15px; font-size: 0.85rem; }

/* DATA ROWS & TOOLTIP */
.data-row { display: flex; justify-content: space-between; margin-bottom: 6px; border-bottom: 1px dashed rgba(255,255,255,0.1); padding-bottom: 2px; }
.data-row:last-child { border: none; }
.d-label { color: #8b949e; }
.d-val { font-weight: bold; font-family: monospace; }


.tooltip-container { position: relative; display: inline-flex; align-items: center; cursor: help; }
.tooltip-container:hover .custom-tooltip { display: block; opacity: 1; pointer-events: none; }
.custom-tooltip {
    display: none; opacity: 0; transition: opacity 0.2s;
    position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%);
    background: #0d1117; border: 1px solid var(--primary); color: white;
    padding: 8px 10px; border-radius: 6px; font-size: 0.75rem;
    z-index: 100; box-shadow: 0 5px 15px rgba(0,0,0,0.5); width: max-content; min-width: 140px;
}
.custom-tooltip::after {
    content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px;
    border-width: 5px; border-style: solid; border-color: var(--primary) transparent transparent transparent;
}
.tt-row { display: grid; grid-template-columns: 40px 1fr; gap: 10px; margin-bottom: 2px; align-items: center; }
.tt-val { font-weight: bold; font-family: monospace; text-align: right; }
.info-icon { font-size: 0.65em; color: var(--secondary); margin-right: 4px; opacity: 0.7; }

.res-breakdown { background: rgba(0,0,0,0.3); padding: 8px; border-radius: 6px; margin-top: 8px; }
.res-breakdown-title { text-align: center; margin-bottom: 3px; font-size: 0.75rem; font-weight: bold; color: var(--text-muted); text-transform: uppercase; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 2px;}
.res-row { display: flex; justify-content: space-between; margin-bottom: 2px; font-family: monospace; font-size: 0.85rem;}
.c-met { color: var(--metal); } .c-crys { color: var(--crystal); } .c-deut { color: var(--deuterium); }


.bal-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; }
.bal-val { font-family: var(--font-tech); font-size: 1.2rem; font-weight: bold; }
.text-ok { color: var(--success); text-shadow: 0 0 10px rgba(35, 134, 54, 0.4); }
.text-err { color: var(--danger); text-shadow: 0 0 10px rgba(218, 54, 51, 0.4); }

/* LAYOUT */
.split-layout { display: flex; gap: 20px; }
.split-col { flex: 1; min-width: 0; }
.transport-grid { display: flex; flex-direction: column; gap: 12px; }
.transport-block { background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.1); border-radius: 6px; padding: 10px; }

/* TRANSPORT TITLES COLOR */
.block-met .trans-title { color: var(--metal); border-bottom-color: rgba(156, 163, 175, 0.3); }
.block-crys .trans-title { color: var(--crystal); border-bottom-color: rgba(121, 192, 255, 0.3); }
.block-deut .trans-title { color: var(--deuterium); border-bottom-color: rgba(86, 211, 100, 0.3); }

.trans-title {
    font-family: var(--font-tech); color: var(--text-main); font-size: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 6px; margin-bottom: 8px;
    display: flex; align-items: center; gap: 10px;
}

/* TRANSPORT ROUTES - SLEEK FLEX */
.trade-route {
    display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.03); 
    padding: 6px 10px; margin-bottom: 4px; border-radius: 3px; font-family: monospace; font-size: 0.85rem; border-left: 3px solid #555; transition: 0.2s;
}
.trade-route:hover { background: rgba(255,255,255,0.06); }
.r-name { color: white; font-weight: bold; min-width: 30%; }
.r-name:last-child { text-align: right; }
.r-amt { font-weight: bold; color: var(--primary); text-align: center; flex: 1; }
.r-arr { color: var(--text-muted); font-size: 0.7em; margin: 0 5px; }
.route-met { border-left-color: var(--metal); } .route-crys { border-left-color: var(--crystal); } .route-deut { border-left-color: var(--deuterium); }

.box-label { font-size: 0.8rem; font-weight: bold; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; }
.result-box { background: #05070a; border: 1px solid rgba(255,255,255,0.1); color: var(--text-muted); font-family: monospace; padding: 10px; border-radius: 6px; font-size: 0.75rem; min-height: 180px; max-height: 420px; height: auto; overflow-y: auto; margin-bottom: 10px; }

/* ACTION BUTTONS GRID */
.action-buttons-grid { display: flex; gap: 10px; margin-bottom: 10px; }
.btn-copy { flex: 2; padding: 12px; background: var(--success); border: none; border-radius: 6px; color: white; font-weight: bold; cursor: pointer; font-family: var(--font-tech); transition: 0.3s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-copy:hover { filter: brightness(1.1); box-shadow: 0 0 10px rgba(35, 134, 54, 0.4); }

/* SOCIAL BUTTONS */
.btn-share { flex: 1; border: none; border-radius: 6px; color: white; font-size: 1.2rem; cursor: pointer; transition: 0.3s; display: flex; align-items: center; justify-content: center; }
.btn-wa { background: #25D366; }
.btn-wa:hover { box-shadow: 0 0 10px #25D366; }
.btn-tg { background: #0088cc; }
.btn-tg:hover { box-shadow: 0 0 10px #0088cc; }

/* TICKET BUTTON */
.btn-ticket { 
    width: 100%; 
    padding: 12px; 
    background: linear-gradient(90deg, #ff8c00, #ff4500); 
    border: none; 
    border-radius: 6px; 
    color: white; 
    font-weight: 800; 
    cursor: pointer; 
    font-family: var(--font-tech); 
    transition: 0.3s; 
    font-size: 0.9rem; 
    display: flex; align-items: center; justify-content: center; gap: 8px; 
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.btn-ticket:hover { 
    filter: brightness(1.2); 
    box-shadow: 0 0 15px rgba(255, 69, 0, 0.4); 
    transform: translateY(-1px);
}


/* ===== MANUAL HARVEST UI ===== */
.manual-harvest-block {
    margin-top: 10px;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(0, 210, 255, 0.16);
    background:
        linear-gradient(180deg, rgba(0, 210, 255, 0.06) 0%, rgba(255,255,255,0.02) 100%),
        rgba(4, 8, 14, 0.72);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.04),
        0 8px 24px rgba(0,0,0,0.18);
}

/* ===== Inline options panel (API / external recs / manual harvest) ===== */
.dev-inline-panel {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.78rem;
    line-height: 1.4;
    border: 1px solid rgba(0, 210, 255, 0.18);
    background:
        linear-gradient(135deg, rgba(0, 210, 255, 0.06), rgba(255,255,255,0.02)),
        rgba(5, 8, 14, 0.95);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.04),
        0 8px 18px rgba(0,0,0,0.5);
}

.dev-inline-text {
    margin-bottom: 8px;
    color: var(--text-muted);
}

.dev-inline-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    opacity: 0.96;
    font-size: 0.78rem;
}

.dev-inline-toggle + .dev-inline-toggle {
    margin-top: 6px;
}

.dev-inline-toggle input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
}

/* Buttons consistent with inline panel */
.dev-inline-btn {
    cursor: pointer;
    padding: 9px 12px;
    border-radius: 10px;
    font-weight: 700;
    font-family: var(--font-body);
    letter-spacing: 0.2px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(0,0,0,0.25);
    color: var(--text-main);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.dev-inline-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 210, 255, 0.35);
    box-shadow: 0 0 0 3px rgba(0, 210, 255, 0.08), 0 0 18px rgba(0, 210, 255, 0.14);
}
.dev-inline-btn:active { transform: translateY(0); opacity: 0.92; }

.dev-inline-btn--primary {
    background: rgba(0, 210, 255, 0.18);
    border-color: rgba(0, 210, 255, 0.30);
    color: #eafaff;
}
.dev-inline-btn--primary:hover {
    background: rgba(0, 210, 255, 0.26);
    border-color: rgba(0, 210, 255, 0.55);
}

/* Cookie consent banner for API decode (same palette as inline panel) */
.cookie-api-modal {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 99999;
}

.cookie-api-modal__row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.cookie-api-modal__icon {
    font-size: 18px;
    line-height: 1;
    margin-top: 2px;
}
.cookie-api-modal__title {
    font-weight: 800;
    letter-spacing: 0.2px;
    margin-bottom: 6px;
    color: var(--text-main);
}
.cookie-api-modal__body {
    font-size: 0.8rem;
    opacity: 0.92;
    line-height: 1.4;
    margin-bottom: 10px;
    white-space: pre-line;
    color: var(--text-muted);
}
.cookie-api-modal__actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.manual-harvest-block .res-breakdown-title {
    margin-bottom: 10px;
    padding-bottom: 6px;
    letter-spacing: 0.6px;
}

.mh-grid {
    display: grid;
    gap: 8px;
}

.mh-cell {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}

.mh-lab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    font-family: var(--font-tech);
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    text-shadow: 0 0 10px rgba(255,255,255,0.06);
}

.mh-input {
    width: 100%;
    min-width: 0;
    height: 34px;
    padding: 0 11px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.10);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(0,0,0,0.22) 100%),
        rgba(8, 12, 18, 0.95);
    color: #f4f8ff;
    font-family: var(--font-tech);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.mh-input:hover {
    border-color: rgba(0, 210, 255, 0.30);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(0,0,0,0.20) 100%),
        rgba(10, 15, 22, 0.98);
}

.mh-input:focus {
    border-color: var(--primary);
    box-shadow:
        0 0 0 3px rgba(0, 210, 255, 0.10),
        0 0 18px rgba(0, 210, 255, 0.14);
    transform: translateY(-1px);
}

.mh-input::placeholder {
    color: rgba(230, 237, 243, 0.34);
}

.mh-hint {
    margin-top: 8px;
    color: #a9b4c1;
    font-size: 0.75rem;
    line-height: 1.35;
    text-align: center;
    opacity: 0.92;
}

.manual-controls {
    display: flex;
    justify-content: center;
    margin: -6px 0 18px;
}

.btn-update-split {
    min-width: 240px;
    padding: 12px 18px;
    border: 1px solid rgba(0, 210, 255, 0.28);
    border-radius: 10px;
    background: linear-gradient(90deg, rgba(58,123,213,0.92) 0%, rgba(0,210,255,0.92) 100%);
    color: #041018;
    font-family: var(--font-tech);
    font-size: 0.95rem;
    font-weight: 900;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    box-shadow: 0 10px 24px rgba(0, 210, 255, 0.15);
}

.btn-update-split:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
    box-shadow: 0 0 18px rgba(0, 210, 255, 0.22);
}

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


@media (max-width: 768px) {
    .config-content { flex-direction: column; gap: 15px; }
    .v-sep { width: 100%; height: 1px; }
    .split-layout { flex-direction: column; }
    .trade-route { flex-wrap: wrap; text-align: center; justify-content: center; gap: 5px; }
    .r-name { width: 100%; text-align: center !important; }
    .r-arr { display: none; }
    .mh-cell { grid-template-columns: 20px minmax(0, 1fr); gap: 6px; }
    .mh-input { height: 32px; font-size: 0.9rem; }
    .btn-update-split { width: 100%; min-width: 0; }
    .cards-tool-btn,
    .cards-icon-btn { width: 40px; height: 40px; border-radius: 12px; }
}

/* ── 360–480px tweaks ─────────────────────────────────────── */
@media (max-width: 480px) {
    .page-shell { padding: 10px; padding-bottom: 0; }

    .container { width: 100%; }

    .header-section { flex-direction: column; gap: 10px; }
    .header-right { flex-wrap: wrap; gap: 8px; }

    .summary-strip { grid-template-columns: 1fr; gap: 8px; }

    .player-card { min-width: 0; flex: 1 1 100%; }

    .cards-grid { flex-direction: column; }

    .config-content { flex-direction: column; gap: 10px; align-items: flex-start; }
    .v-sep { width: 100%; height: 1px; }
}

/* ═══════════════════════════════════════════════════════════
   GENUINE MOBILE UI — body.ui-mobile
   Applied regardless of viewport size when toggle is active.
   ═══════════════════════════════════════════════════════════ */

/* Layout */
body.ui-mobile .page-shell { padding-left: 10px !important; padding-right: 10px !important; }
body.ui-mobile .container { padding: 0 !important; }
body.ui-mobile .cards-grid { flex-direction: column !important; gap: 12px !important; }
body.ui-mobile .split-layout { flex-direction: column !important; gap: 12px !important; }
body.ui-mobile .config-content { flex-direction: column !important; gap: 12px !important; }
body.ui-mobile .v-sep { width: 100% !important; height: 1px !important; }

/* Summary strip — compact 3-col with bigger numbers */
body.ui-mobile .summary-strip {
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 8px !important;
  margin-bottom: 16px !important;
}
body.ui-mobile .sum-item {
  padding: 12px 6px !important;
  border-radius: 10px !important;
}
body.ui-mobile .sum-val {
  font-size: 1.6rem !important;
  line-height: 1.1 !important;
  display: block !important;
}
body.ui-mobile .sum-label {
  font-size: 0.6rem !important;
  margin-bottom: 4px !important;
}

/* Player cards — full-width, more prominent */
body.ui-mobile .player-card {
  min-width: 0 !important;
  flex: 1 1 100% !important;
  border-radius: 14px !important;
  border-width: 2px !important;
}
body.ui-mobile .card-header {
  padding: 14px 16px !important;
}
body.ui-mobile .p-name {
  font-size: 1.25rem !important;
}
body.ui-mobile .status-badge {
  font-size: 0.85rem !important;
  padding: 5px 10px !important;
}
body.ui-mobile .card-body {
  padding: 14px 16px !important;
}
body.ui-mobile .data-row {
  padding: 8px 0 !important;
  margin-bottom: 6px !important;
}
body.ui-mobile .d-label {
  font-size: 0.85rem !important;
}
body.ui-mobile .d-val {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
}

/* Textarea input — taller for easier touch editing */
body.ui-mobile textarea {
  height: 130px !important;
  font-size: 0.95rem !important;
  padding: 14px !important;
}

/* Result box (text report) */
body.ui-mobile .result-box {
  font-size: 0.95rem !important;
  padding: 16px !important;
  border-radius: 12px !important;
  line-height: 1.7 !important;
}

/* Action buttons — full-width stack */
body.ui-mobile .action-buttons-grid {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  margin-top: 12px !important;
}
body.ui-mobile .btn-wa,
body.ui-mobile .btn-tg {
  width: 100% !important;
  min-height: 48px !important;
  border-radius: 12px !important;
  font-size: 1rem !important;
}

/* Config bar (step 1) — inline toggle switches bigger */
body.ui-mobile .config-bar {
  padding: 14px 16px !important;
}
body.ui-mobile .c-label {
  font-size: 1rem !important;
  font-weight: 700 !important;
}
body.ui-mobile .toggle-switch label {
  padding: 10px 18px !important;
  font-size: 0.95rem !important;
}

/* Memory indicators */
body.ui-mobile .memory-indicators {
  flex-wrap: wrap !important;
  gap: 6px !important;
}
body.ui-mobile .mem-badge {
  font-size: 0.85rem !important;
  padding: 8px 12px !important;
}

/* Panel head title */
body.ui-mobile .panel-head h3 {
  font-size: 1.1rem !important;
}

/* ===== Memory badges tooltip ===== */
.mem-badge {
  position: relative;
}

.mem-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 50;
  min-width: 220px;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(15, 18, 25, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-size: 12px;
  line-height: 1.35;
}

.mem-badge:hover .mem-tooltip {
  display: block;
}

.mem-tooltip-title {
  font-weight: 700;
  margin-bottom: 6px;
  opacity: 0.95;
}

.mem-tooltip-lines {
  max-height: 180px;
  overflow: auto;
  padding-right: 4px;
}

.mem-tooltip-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.95;
}
