/* ============================================================
   CC LITE — CARD BUILDER — Styles
   Card frame modeled on the full game's card builder
   (225 x 340 base, title bar, icon column down the left).
   ============================================================ */

* { box-sizing: border-box; }

body {
    margin: 0; padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a2e; color: #eee;
    min-height: 100vh;
}

/* --- Auth gate --- */
.auth-gate {
    position: fixed; inset: 0; z-index: 10000;
    display: flex; align-items: center; justify-content: center;
    background: #1a1a2e;
}
.auth-card {
    background: #16213e; border-radius: 16px; padding: 2.5rem;
    max-width: 380px; width: 90%; text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.auth-card h1 { color: #e2c044; margin: 0 0 .25rem; font-size: 1.6rem; font-family: 'Georgia', serif; }
.auth-card .subtitle { color: #aaa; margin: 0 0 1.5rem; font-size: .9rem; }
.auth-input {
    width: 100%; padding: .6rem .8rem; border: 1px solid #333;
    border-radius: 8px; background: #0f1629; color: #eee;
    font-size: .95rem; margin-bottom: .8rem;
}
.auth-input:focus { outline: none; border-color: #e2c044; }
.auth-error { color: #f44; margin: 0 0 .8rem; font-size: .85rem; }
.btn-full { width: 100%; }

/* --- Buttons --- */
.btn {
    display: inline-block; padding: .55rem 1.2rem; border: none;
    border-radius: 8px; font-size: .85rem; cursor: pointer;
    font-weight: 600; transition: all .15s;
    text-decoration: none; text-align: center;
}
.btn-primary { background: #e2c044; color: #1a1a2e; }
.btn-primary:hover { background: #d4a82a; }
.btn-secondary { background: #3a506b; color: #eee; }
.btn-secondary:hover { background: #4a6a8b; }
.btn-danger { background: #c0392b; color: #fff; }
.btn-danger:hover { background: #e74c3c; }
.btn-sm { padding: .35rem .8rem; font-size: .78rem; }
.btn-xs { padding: .15rem .45rem; font-size: .72rem; border-radius: 5px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* --- Header --- */
.app-header {
    background: #16213e; padding: .8rem 1.5rem;
    display: flex; align-items: center; gap: 1rem;
    border-bottom: 2px solid #e2c044;
    flex-wrap: wrap;
}
.app-header h1 { color: #e2c044; font-size: 1.25rem; margin: 0; font-family: 'Georgia', serif; }
.app-header .header-actions {
    display: flex; gap: .5rem; margin-left: auto; align-items: center; flex-wrap: wrap;
}
.save-indicator { font-size: .75rem; font-weight: 600; transition: opacity .4s; }
.save-indicator.state-saved   { color: #27ae60; }
.save-indicator.state-saving  { color: #e2c044; }
.save-indicator.state-unsaved { color: #e2c044; }
.save-indicator.state-error   { color: #e74c3c; }

/* --- Views --- */
.view-panel { display: none; }
.view-panel.active { display: block; }

/* --- Card List --- */
.card-list { padding: 1.5rem; max-width: 1200px; margin: 0 auto; }
.card-list-header h2 { margin: 0 0 .3rem; color: #e2c044; }
.card-list-header .hint { color: #888; font-size: .8rem; margin: 0 0 .4rem; }
.card-summary { color: #e2c044; font-size: .82rem; font-weight: 600; margin: 0 0 1.2rem; }
.card-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}
.card-tile {
    background: #16213e; border-radius: 12px; padding: 1rem;
    border: 1px solid #2a2a4a; cursor: pointer;
    transition: all .15s; text-align: center;
}
.card-tile:hover { border-color: #e2c044; transform: translateY(-2px); }
.card-tile .tile-preview { display: flex; justify-content: center; margin-bottom: .6rem; }
.card-tile h3 {
    margin: 0 0 .15rem; color: #eee; font-size: .92rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-tile .tile-aspect { font-size: .74rem; font-weight: 600; margin-bottom: .5rem; }
.card-tile .tile-actions { display: flex; gap: .35rem; justify-content: center; flex-wrap: wrap; }
.card-grid .empty-msg { color: #888; grid-column: 1/-1; text-align: center; padding: 2rem 0; }

/* --- The card itself (shared list + editor; sizes set inline) --- */
.lite-card {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,.35);
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    /* width/height/border/background set inline from the aspect */
}
.lite-card-title {
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,.5);
    text-align: center; line-height: 1.1;
    padding: 0 8%;
    overflow: hidden;
    /* height/font-size/background set inline */
}
.lite-card-art {
    position: relative; flex: 1; min-height: 0;
    background: rgba(0,0,0,.12);
    overflow: hidden;
}
.lite-card-art img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
}
.lite-card-era {
    position: absolute;
    display: flex; align-items: center; justify-content: center;
    background: rgba(16,16,26,.78); color: #e2c044;
    border: 1px solid rgba(226,192,68,.9); border-radius: 50%;
    font-family: Georgia, serif; font-weight: 700; line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,.5);
    z-index: 2;
}
.lite-card-art .art-placeholder {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: rgba(0,0,0,.35);
}
.lite-card-text {
    color: #222; text-align: center; line-height: 1.25;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    /* padding/font-size/max-height set inline */
}
.timing-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5em;
    height: 1.5em;
    margin-right: .35em;
    vertical-align: -0.35em;
    font-style: normal;
    font-weight: 700;
    color: #7a5b12;
    background: rgba(226,192,68,.35);
    border-radius: 50%;
    border: 1px solid rgba(122,91,18,.45);
    flex: 0 0 auto;
}
.lite-card-aspect {
    position: absolute;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,.4);
    z-index: 3;
    line-height: 1;
}
.lite-card-footer.has-flavor .flavor-line {
    font-style: italic;
    font-family: Georgia, serif;
    line-height: 1.2;
    padding: 0 .5em;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.lite-card-footer {
    display: flex; align-items: center; justify-content: center;
    gap: .3em; font-weight: 700;
    /* height/background/color/font-size set inline */
}

/* Victory Points badge — gold 8-point starburst, top-right corner.
   Deliberately distinct from the circular aspect win-slots on the left. */
.lite-card-vp {
    position: absolute;
    z-index: 6;
    background: linear-gradient(160deg, #f5d76e, #d4a82a);
    clip-path: polygon(50% 0%, 61% 20%, 83% 12%, 80% 35%, 100% 50%, 80% 65%,
                       83% 88%, 61% 80%, 50% 100%, 39% 80%, 17% 88%, 20% 65%,
                       0% 50%, 20% 35%, 17% 12%, 39% 20%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #1a1a2e;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,.45));
    pointer-events: none;
    /* size/position set inline */
}
.lite-card-vp .vp-num { font-weight: 900; line-height: 1; }
.lite-card-vp .vp-label {
    font-weight: 800; line-height: 1; letter-spacing: .5px;
    opacity: .8; margin-top: 1px;
}

/* Win-condition icon slots down the left side (like CC main) */
.lite-card-icons {
    position: absolute;
    display: flex; flex-direction: column;
    z-index: 5;
    /* top/left/gap set inline */
}
.lite-card-slot {
    border-radius: 50%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 5px rgba(0,0,0,.45);
    /* size/background/border/color set inline */
}
.lite-card-slot .slot-symbol { line-height: 1; }
.lite-card-slot .slot-value { font-weight: 800; line-height: 1; }
.lite-card-slot .slot-icon { display: block; max-width: 74%; object-fit: contain; }
.lite-card-aspect img { width: 72%; height: 72%; object-fit: contain; }
.lite-card-footer .footer-icon { object-fit: contain; vertical-align: middle; }

/* --- UV Card Print Sheets modal --- */
.sheet-card { max-width: 560px; max-height: 92vh; overflow-y: auto; }
.sheet-card .section-hint { color: #99a; font-size: .8rem; line-height: 1.45; margin: 0 0 .8rem; }
.sheet-settings-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: .5rem .7rem; margin-bottom: .8rem;
}
.sheet-settings-grid label {
    display: flex; flex-direction: column; gap: .2rem;
    font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: #99a;
}
.sheet-settings-grid input {
    background: #0f1630; border: 1px solid #2a2a4a; border-radius: 6px;
    color: #eee; padding: .3rem .4rem; font-size: .85rem; width: 100%;
}
.sheet-total { font-size: .85rem; color: #8fc97f; margin-bottom: 1rem; line-height: 1.5; }
.sheet-total.over { color: #e07a6a; font-weight: 700; }

/* --- Editor layout --- */
.editor-layout { display: flex; gap: 0; min-height: calc(100vh - 60px); }
.editor-left {
    flex: 1; padding: 1rem; overflow-y: auto;
    display: flex; flex-direction: column; align-items: center;
}
.editor-right {
    width: 400px; min-width: 400px;
    background: #16213e; border-left: 1px solid #2a2a4a;
    padding: 1rem; overflow-y: auto;
    max-height: calc(100vh - 60px);
}
.card-name-bar {
    display: flex; align-items: center; gap: .5rem;
    margin-bottom: 1rem; width: 100%; max-width: 560px;
}
.card-name-input {
    flex: 1; background: transparent; border: none; border-bottom: 2px solid #333;
    color: #e2c044; font-size: 1.2rem; font-weight: 700;
    padding: .3rem .5rem; font-family: 'Georgia', serif;
}
.card-name-input:focus { outline: none; border-bottom-color: #e2c044; }
.card-preview-area {
    display: flex; justify-content: center; padding: 1rem 0 2rem;
}

/* --- Panel sections --- */
.panel-section {
    border: 1px solid #2a2a4a; border-radius: 10px;
    padding: .8rem; margin-bottom: 1rem; background: #131c36;
}
.panel-section h3 {
    margin: 0 0 .6rem; color: #e2c044; font-size: .8rem;
    text-transform: uppercase; letter-spacing: 1px;
}
.panel-section .section-hint { color: #778; font-size: .72rem; margin: -.3rem 0 .6rem; line-height: 1.4; }

.editor-field { margin-bottom: .8rem; }
.editor-field:last-child { margin-bottom: 0; }
.editor-field label {
    display: block; color: #aaa; font-size: .72rem;
    text-transform: uppercase; letter-spacing: 1px;
    margin-bottom: .3rem;
}
.editor-field input[type="text"],
.editor-field input[type="number"],
.editor-field textarea,
.editor-field select {
    width: 100%; padding: .5rem .7rem;
    background: #0f1629; border: 1px solid #333;
    color: #eee; border-radius: 6px; font-size: .85rem;
}
.editor-field textarea { resize: vertical; min-height: 60px; font-family: inherit; }
.editor-field input:focus, .editor-field textarea:focus, .editor-field select:focus {
    outline: none; border-color: #e2c044;
}

.image-btn-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.image-status { color: #778; font-size: .72rem; }

/* Slot config rows */
.slot-config-row {
    display: flex; gap: .4rem; align-items: center; margin-bottom: .45rem;
}
.slot-config-row select {
    flex: 1; min-width: 0; padding: .4rem .5rem;
    background: #0f1629; border: 1px solid #333;
    color: #eee; border-radius: 6px; font-size: .82rem;
}
.slot-config-row input[type="number"] {
    width: 64px; padding: .4rem .4rem;
    background: #0f1629; border: 1px solid #333;
    color: #eee; border-radius: 6px; font-size: .82rem;
}

.no-aspects-warning {
    background: rgba(192, 57, 43, .15); border: 1px solid #c0392b;
    border-radius: 8px; padding: .7rem .8rem;
    color: #f0b6ae; font-size: .8rem; line-height: 1.45; margin-bottom: 1rem;
}
.no-aspects-warning a { color: #e2c044; }

/* --- Toasts --- */
.toast-container {
    position: fixed; top: 1.5rem; left: 50%; transform: translateX(-50%);
    z-index: 9999; display: flex; flex-direction: column; align-items: center; gap: .5rem;
}
.toast {
    padding: .7rem 1.2rem; border-radius: 8px; font-size: .85rem;
    animation: toastIn .3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,.4);
}
.toast-success { background: #27ae60; color: #fff; }
.toast-error { background: #c0392b; color: #fff; }
.toast-info { background: #2980b9; color: #fff; }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Confirm modal --- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 9998;
    background: rgba(10, 12, 26, .72);
    display: flex; align-items: center; justify-content: center;
}
.modal-card {
    background: #16213e; border: 1px solid #2a2a4a; border-radius: 14px;
    padding: 1.4rem 1.6rem; max-width: 420px; width: 92%;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.modal-card h3 { margin: 0 0 .5rem; color: #e2c044; font-size: 1.05rem; }
.modal-card p { margin: 0 0 1.2rem; color: #ccc; font-size: .88rem; line-height: 1.45; }
.modal-actions { display: flex; gap: .6rem; justify-content: flex-end; }

/* --- Responsive --- */
@media (max-width: 980px) {
    .editor-layout { flex-direction: column; }
    .editor-right { width: 100%; min-width: auto; border-left: none;
        border-top: 1px solid #2a2a4a; max-height: none; }
}

/* --- Card list search/filter/sort (2026-08-05) --- */
.card-controls { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: 0 0 1rem; }
.card-controls input[type=search] { flex: 1; min-width: 200px; background: #0f1630;
    border: 1px solid #2a2a4a; border-radius: 8px; color: #eee; padding: .45rem .6rem; }
.card-controls select { background: #0f1630; border: 1px solid #2a2a4a; border-radius: 8px;
    color: #eee; padding: .45rem .5rem; font-size: .85rem; }
.card-controls .cf-count { color: #e2c044; font-size: .8rem; font-weight: 700; }
