:root {
    --green: #1a6b3c;
    --green-dark: #0f4d2a;
    --green-light: #e8f5ec;
    --green-medium: #2d8a56;
    --red: #c0392b;
    --red-light: #ff6b6b;
    --gold: #d4a843;
    --bg: #f4f6f8;
    --text: #1a2332;
    --text-light: #5a6577;
    --border: #dde1e6;
    --white: #ffffff;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.06);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ───── Header ───── */
header {
    background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 100%);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--white);
}

.brand-suits {
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    opacity: 0.85;
}

.brand-name {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.brand-tagline {
    font-size: 0.8rem;
    opacity: 0.6;
    font-weight: 400;
    letter-spacing: 0.02em;
}

.suit-red { color: #ff8a80; }
.suit-black { color: rgba(255,255,255,0.75); }

/* ───── Hero ───── */
.hero {
    text-align: center;
    padding: 2.5rem 2rem 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.hero h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--green-dark);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.hero p {
    font-size: 1rem;
    color: var(--text-light);
    line-height: 1.6;
}

/* ───── CCG Container ───── */
.ccg-container {
    max-width: 520px;
    margin: 1.5rem auto 2rem;
    padding: 0 1rem;
}

/* ───── Cards ───── */
.card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 2rem;
}

.card h2 {
    font-size: 1.15rem;
    color: var(--green-dark);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--green-light);
    font-weight: 600;
}

.upload-card {
    border: 1px solid var(--border);
}

/* ───── Buttons ───── */
.btn {
    display: inline-block;
    padding: 0.7rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    text-align: center;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--green);
    color: var(--white);
}
.btn-primary:hover { background: var(--green-dark); box-shadow: 0 2px 8px rgba(26,107,60,0.3); }

.btn-secondary {
    background: var(--green-light);
    color: var(--green-dark);
    font-weight: 500;
}
.btn-secondary:hover { background: #d0ecd8; }

.btn-download {
    background: var(--green);
    color: var(--white);
    font-size: 1.05rem;
    padding: 0.9rem 2.5rem;
    font-weight: 600;
}
.btn-download:hover { background: var(--green-dark); box-shadow: 0 2px 8px rgba(26,107,60,0.3); }

.btn-full {
    display: block;
    width: 100%;
    padding: 0.85rem;
    font-size: 1rem;
}

/* ───── Forms ───── */
label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.88rem;
    color: var(--text);
}

input[type="text"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--white);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(26,107,60,0.1);
}

.form-group { margin-bottom: 1.4rem; }

.form-hint {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: 0.35rem;
}

/* ───── File drop zone ───── */
.file-drop {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fafbfc;
}

.file-drop:hover, .file-drop.dragover {
    border-color: var(--green);
    background: var(--green-light);
}

.file-drop.has-file {
    border-color: var(--green);
    border-style: solid;
    background: var(--green-light);
}

.file-drop input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
}

.file-drop-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.file-drop-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.file-drop-hint {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* ───── How it works ───── */
.how-it-works {
    margin-top: 2rem;
    padding: 0 0.5rem;
}

.how-it-works h3 {
    font-size: 0.95rem;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1rem;
    text-align: center;
}

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

.step {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.step-num {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--green-light);
    color: var(--green-dark);
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-text {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.4;
}

.step-text strong {
    color: var(--text);
}

/* ───── Flash messages ───── */
.flash-messages { margin-bottom: 1rem; }

.flash {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.flash.error {
    background: #fef2f2;
    color: var(--red);
    border: 1px solid #fecaca;
}

.flash.success {
    background: var(--green-light);
    color: var(--green-dark);
    border: 1px solid #b8dfc6;
}

/* ───── Beta note ───── */
.beta-note {
    margin-top: 1.5rem;
    padding: 0.75rem 1rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #92400e;
    line-height: 1.5;
}

/* ───── Spinner / processing overlay ───── */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--green-light);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

.processing-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.processing-overlay.active { display: flex; }

.processing-card {
    background: var(--white);
    border-radius: 16px;
    padding: 2.5rem 3rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
}

.processing-overlay .message {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--green-dark);
    margin-top: 1.2rem;
}

.processing-overlay .sub {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    line-height: 1.5;
}

.progress-bar {
    margin-top: 1.2rem;
    height: 4px;
    background: var(--green-light);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--green);
    border-radius: 2px;
    animation: progress-indeterminate 2s ease-in-out infinite;
    width: 30%;
}

@keyframes progress-indeterminate {
    0% { margin-left: 0; }
    50% { margin-left: 70%; }
    100% { margin-left: 0; }
}

/* ───── Error detail ───── */
.error-detail {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    font-family: "SF Mono", Monaco, Consolas, monospace;
    font-size: 0.8rem;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
    margin-top: 0.75rem;
    max-height: 200px;
    overflow-y: auto;
}

/* ───── Success icon ───── */
.success-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* ───── Result actions ───── */
.result-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* ───── Main content ───── */
main {
    flex: 1;
    padding: 0;
    width: 100%;
}

/* ───── Footer ───── */
footer {
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: 0.78rem;
    color: var(--text-light);
    border-top: 1px solid var(--border);
    background: var(--white);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.footer-brand {
    font-weight: 600;
    color: var(--green-dark);
}

.footer-sep {
    opacity: 0.3;
}

/* ───── Suit symbols in text ───── */
.suit-s::before { content: "\2660"; }
.suit-h::before { content: "\2665"; color: var(--red); }
.suit-d::before { content: "\2666"; color: var(--red); }
.suit-c::before { content: "\2663"; }

/* ───── Two-column layout (kept for EPBot/DDS) ───── */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* ───── HTMX loading indicator (kept for EPBot/DDS) ───── */
.htmx-indicator {
    display: none;
    text-align: center;
    padding: 2rem;
    color: var(--green-dark);
}

.htmx-request .htmx-indicator { display: block; }
.htmx-request.htmx-indicator { display: block; }

/* ───── Compass grid (kept for EPBot/DDS) ───── */
.compass-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.compass-north { grid-column: 2; }
.compass-south { grid-column: 2; }
.compass-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ───── Tools grid (kept for future use) ───── */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.tool-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 2rem;
    text-align: center;
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.tool-card .icon { font-size: 2.5rem; margin-bottom: 1rem; }
.tool-card h3 { font-size: 1.1rem; color: var(--green-dark); margin-bottom: 0.5rem; }
.tool-card p { font-size: 0.9rem; color: var(--text-light); line-height: 1.5; margin-bottom: 1.5rem; flex: 1; }

/* ───── Responsive ───── */
@media (max-width: 768px) {
    .two-col { grid-template-columns: 1fr; }
    .tools-grid { grid-template-columns: 1fr; }
    .header-top { padding: 0.8rem 1rem; }
    .brand-tagline { display: none; }
    .card { padding: 1.5rem; }
    .hero { padding: 2rem 1rem 0.5rem; }
    .hero h2 { font-size: 1.3rem; }
    .compass-grid { grid-template-columns: 1fr; }
    .compass-north, .compass-south { grid-column: 1; }
    .compass-center { display: none; }
    .processing-card { margin: 0 1rem; padding: 2rem; }
}

@media (max-width: 480px) {
    .header-top { padding: 0.6rem 0.8rem; }
    .brand-name { font-size: 1.1rem; }
    .brand-suits { display: none; }
    .ccg-container { padding: 0 0.5rem; }
    .card { padding: 1.2rem; }
}
