/* ==========================================================================
   Creators Game League — design system
   One stylesheet, served locally. Light and dark mode. No external fonts.
   ========================================================================== */

:root {
    --bg:            #faf8f5;
    --surface:       #ffffff;
    --surface-2:     #f4f1ec;
    --text:          #1d1b18;
    --muted:         #6d6a63;
    --hint:          #918d85;
    --border:        #e7e3db;
    --border-strong: #d6d1c7;

    --accent:        #cf5a34;
    --accent-strong: #b0461f;
    --accent-tint:   #fbeee7;

    --success:       #1f7a5a;
    --success-tint:  #e6f3ee;
    --warning:       #a76b0c;
    --warning-tint:  #fbefd8;
    --danger:        #b3352e;
    --danger-tint:   #fbe9e7;

    --radius:  8px;
    --radius-lg: 12px;
    --shadow-focus: 0 0 0 3px var(--accent-tint);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:            #16161a;
        --surface:       #202024;
        --surface-2:     #26262b;
        --text:          #ecebe6;
        --muted:         #a4a19a;
        --hint:          #7d7a73;
        --border:        #33333a;
        --border-strong: #45454d;

        --accent:        #e5744e;
        --accent-strong: #f0906d;
        --accent-tint:   #33221b;

        --success:       #5cc79e;
        --success-tint:  #17302a;
        --warning:       #e0a94a;
        --warning-tint:  #322817;
        --danger:        #e88a82;
        --danger-tint:   #331e1c;

        --shadow-focus:  0 0 0 3px rgba(229, 116, 78, 0.25);
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
h2 { font-size: 18px; font-weight: 600; margin: 0 0 4px; }
h3 { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
p  { margin: 0 0 1rem; }
a  { color: var(--accent-strong); }

.muted { color: var(--muted); }
.hint  { color: var(--hint); font-size: 13px; font-weight: 400; }
.meta  { color: var(--muted); font-size: 13px; }

/* ---- top bar ------------------------------------------------------------ */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 22px; }
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.brand-mark-lg { width: 46px; height: 46px; font-size: 17px; border-radius: 12px; }
.mainnav { display: flex; gap: 16px; }
.mainnav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.mainnav a:hover { color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-name { font-size: 14px; color: var(--muted); }
.inline-form { margin: 0; display: inline; }

/* ---- layout ------------------------------------------------------------- */
.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 28px 20px 64px;
}
.page-head { margin-bottom: 20px; }
.page-head-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}
.section-head { margin-top: 32px; margin-bottom: 12px; }
.backlink { display: inline-block; margin-bottom: 8px; font-size: 14px; text-decoration: none; }
.note {
    background: var(--surface-2);
    border-radius: var(--radius);
    padding: 12px 14px;
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 8px;
}

/* ---- cards -------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}
.form-card { max-width: 560px; }

/* ---- auth --------------------------------------------------------------- */
.auth-wrap { min-height: 60vh; display: flex; align-items: center; justify-content: center; }
.auth-card { width: 100%; max-width: 380px; }
.auth-head { text-align: center; margin-bottom: 20px; }
.auth-head .brand-mark-lg { margin-bottom: 12px; }
.auth-head h1 { margin-bottom: 2px; }

/* ---- forms -------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.field-row { display: flex; gap: 16px; }
.field-row .field { flex: 1; }
.field-error { color: var(--danger); font-size: 13px; }

input, select, textarea {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
textarea { height: auto; min-height: 84px; padding: 10px 12px; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--shadow-focus);
}
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }

/* ---- buttons ------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.12s ease, border-color 0.12s ease, transform 0.05s ease;
}
.btn:hover  { background: var(--surface-2); }
.btn:active { transform: scale(0.985); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--danger-tint); border-color: var(--danger); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---- alerts ------------------------------------------------------------- */
.alert {
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert-danger  { background: var(--danger-tint);  color: var(--danger);  border-color: var(--danger); }
.alert-success { background: var(--success-tint); color: var(--success); border-color: var(--success); }

/* ---- lists (rows) ------------------------------------------------------- */
.list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
}
.list-row:last-child { border-bottom: none; }
a.list-row:hover { background: var(--surface-2); }
.list-row.static { cursor: default; }
.list-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list-title { font-weight: 500; font-size: 15px; }
.row-actions { display: flex; align-items: center; gap: 8px; }

/* ---- tiles / badges ----------------------------------------------------- */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}
.tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
}
.tile-link { text-decoration: none; color: var(--text); transition: border-color 0.12s ease; }
.tile-link:hover { border-color: var(--accent); }
.tag {
    display: inline-block;
    margin-top: 10px;
    font-size: 12px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--surface-2);
    color: var(--muted);
}

/* ---- pills -------------------------------------------------------------- */
.pill { font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.pill-success { background: var(--success-tint); color: var(--success); }
.pill-accent  { background: var(--accent-tint);  color: var(--accent-strong); }
.pill-warning { background: var(--warning-tint); color: var(--warning); }

/* ---- empty state -------------------------------------------------------- */
.empty-state { text-align: center; padding: 48px 16px; }
.empty-state.small { padding: 28px 16px; }
.empty-state .btn { margin-top: 12px; }

/* ---- responsive --------------------------------------------------------- */
@media (max-width: 560px) {
    .field-row { flex-direction: column; gap: 16px; }
    .topbar-name { display: none; }
    .page-head-row { flex-direction: column; align-items: flex-start; gap: 12px; }
}
