/* ==========================================================================
   YGG Portal - shared design system (dark navy + gold)
   Used by every PHP page under /ragnarok. Component classes are prefixed
   "ygg-" so they never collide with the header V3 or page-specific CSS.
   ========================================================================== */

:root {
    color-scheme: dark;
    --bg: #0b1120;
    --bg-2: #0f1729;
    --panel: #141e33;
    --card: #172338;
    --raise: #1e2c46;
    --line: #2c3c58;
    --line-soft: #223049;
    --gold: #f2c873;
    --gold-2: #e5a52a;
    --text: #e9edf5;
    --muted: #a8b4c9;
    --dim: #8392ab;
    --ok: #8ee2b3;
    --ok-bg: rgba(46, 160, 90, .13);
    --err: #ffbcbc;
    --err-bg: rgba(220, 70, 70, .13);
    --info: #f1dcab;
    --info-bg: rgba(242, 200, 115, .09);
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 14px 40px rgba(0, 0, 0, .35);
    --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    --font-display: Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body.ygg {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse at 50% -10%, rgba(54, 82, 135, .35), transparent 60%),
        var(--bg);
    color: var(--text);
    font: 15px/1.55 var(--font);
}

body.ygg a { color: var(--gold); }
body.ygg a:hover { color: #fff; }
body.ygg :focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.ygg-skip {
    position: absolute; left: -9999px; top: 0; z-index: 10000;
    background: var(--gold); color: #1a1204 !important; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.ygg-skip:focus { left: 0; }

.ygg-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header V3 additions (active state + small screens) ---------- */
#ygg-v3-nav a.is-active { color: var(--gold) !important; }
#ygg-v3-nav a.is-active::after {
    content: ""; display: block; height: 2px; margin-top: 4px; border-radius: 2px; background: var(--gold);
}
.ygg-emblem-link { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; border-radius: 50%; }
@media (max-width: 640px) {
    #ygg-v3-nav {
        overflow-x: auto;
        white-space: nowrap;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    #ygg-v3-nav::-webkit-scrollbar { display: none; }
}

/* ---------- Account / breadcrumb bar ---------- */
.ygg-bar { background: rgba(9, 15, 29, .92); border-bottom: 1px solid var(--line-soft); }
.ygg-bar__inner {
    max-width: 1200px; margin: 0 auto; padding: 10px 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 10px 18px; flex-wrap: wrap;
}
.ygg-crumbs { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--dim); }
.ygg-crumbs a { color: var(--muted) !important; text-decoration: none; }
.ygg-crumbs a:hover { color: var(--gold) !important; }
.ygg-crumbs [aria-current] { color: var(--text); }
.ygg-userbox { display: flex; align-items: center; gap: 10px; }
.ygg-userbox__name { display: inline-flex; align-items: center; gap: 8px; color: var(--text) !important; text-decoration: none; font-weight: 600; font-size: 14px; }
.ygg-avatar {
    display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
    background: var(--raise); border: 1px solid #3a4a6b; color: var(--gold); font-weight: 700; font-size: 13px;
}
.ygg-inline { display: inline; margin: 0; }

/* ---------- Layout ---------- */
.ygg-main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 32px 20px 56px; }
.ygg-main--narrow { max-width: 760px; }
.ygg-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 28px; flex-wrap: wrap; margin-bottom: 24px; }
.ygg-title { margin: 0 0 6px; font: 700 34px/1.15 var(--font-display); color: var(--gold); letter-spacing: .01em; }
.ygg-sub { margin: 0; max-width: 60ch; color: var(--muted); }
.ygg-h2 { margin: 0 0 4px; font-size: 20px; color: #fff; }
.ygg-h3 { margin: 0 0 4px; font-size: 16px; color: #fff; }
.ygg-muted { color: var(--muted); }
.ygg-dim { color: var(--dim); font-size: 13px; }

.ygg-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ygg-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ygg-span-2 { grid-column: span 2; }
@media (max-width: 760px) {
    .ygg-grid--2 { grid-template-columns: 1fr; }
    .ygg-span-2 { grid-column: auto; }
}

/* ---------- Cards ---------- */
.ygg-card {
    background: linear-gradient(165deg, var(--card), var(--bg-2));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    min-width: 0;
}
a.ygg-card { display: block; color: inherit !important; text-decoration: none; transition: border-color .15s; }
a.ygg-card:hover { border-color: #5d7096; }
.ygg-card__label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
.ygg-stat { font-size: 28px; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; line-height: 1.2; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ygg-stat img { width: 34px; height: 34px; object-fit: contain; }
.ygg-card__foot { margin-top: 14px; font-size: 13px; color: var(--gold); }

.ygg-badge {
    display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .05em;
    border: 1px solid rgba(142, 226, 179, .45); background: var(--ok-bg); color: var(--ok);
}
.ygg-badge--off { border-color: #3a4a6b; background: rgba(255, 255, 255, .04); color: var(--dim); }
.ygg-badge--warn { border-color: rgba(242, 200, 115, .45); background: var(--info-bg); color: var(--info); }

/* ---------- Definition rows ---------- */
.ygg-rows { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; font-size: 14px; }
.ygg-rows dt { color: var(--dim); }
.ygg-rows dd { margin: 0; text-align: right; overflow-wrap: anywhere; }

/* ---------- Buttons ---------- */
.ygg-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 42px; padding: 10px 18px; border: 0; border-radius: var(--radius-sm);
    font: 700 14px/1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
    color: #1a1204 !important;
    background: linear-gradient(180deg, #f8d584, var(--gold-2));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 6px 16px rgba(229, 165, 42, .18);
    transition: filter .15s;
}
.ygg-btn:hover:not(:disabled) { filter: brightness(1.07); color: #1a1204 !important; }
.ygg-btn:disabled, .ygg-btn[aria-disabled="true"] { background: #232d44; color: #8a96b0 !important; box-shadow: none; cursor: not-allowed; }
.ygg-btn--block { width: 100%; }
.ygg-btn--sm { min-height: 34px; padding: 7px 14px; font-size: 13px; }
.ygg-btn--ghost { background: transparent; border: 1px solid #4a5a7e; color: #d6deef !important; box-shadow: none; }
.ygg-btn--ghost:hover:not(:disabled) { border-color: var(--gold); color: var(--gold) !important; filter: none; }
.ygg-btn.is-loading { pointer-events: none; opacity: .75; }

/* ---------- Forms ---------- */
.ygg-form { display: grid; gap: 16px; }
.ygg-field { display: grid; gap: 6px; }
.ygg-field > label, .ygg-label { font-weight: 600; font-size: 14px; color: #dbe2ef; }
.ygg-hint { font-size: 12px; color: var(--dim); }
.ygg-input, .ygg-select {
    width: 100%; min-height: 44px; padding: 10px 12px;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: #0d1626; color: var(--text); font: 15px var(--font);
}
.ygg-input::placeholder { color: var(--dim); }
.ygg-input:focus, .ygg-select:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
.ygg-input[aria-invalid="true"] { border-color: #dc4646; }
.ygg-radios { display: flex; gap: 20px; flex-wrap: wrap; }
.ygg-radios label, .ygg-check { display: inline-flex; align-items: flex-start; gap: 8px; font-weight: 400; cursor: pointer; }
.ygg-radios input, .ygg-check input { accent-color: var(--gold-2); width: 18px; height: 18px; margin: 2px 0 0; flex: none; }
.ygg-form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 8px; }
.ygg-honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.ygg-section-title { margin: 8px 0 0; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); font: 700 16px var(--font-display); color: var(--gold); }

/* ---------- Alerts ---------- */
.ygg-alert {
    margin: 0 0 18px; padding: 13px 16px; border: 1px solid #3a4a6b; border-left-width: 4px; border-radius: 10px;
    background: #16213a; color: #d4dbea; line-height: 1.5;
}
.ygg-alert--ok   { background: var(--ok-bg);  border-color: rgba(46, 160, 90, .55);  color: #b4f0c8; }
.ygg-alert--info { background: var(--info-bg); border-color: rgba(242, 200, 115, .45); color: var(--info); }
.ygg-alert--err  { background: var(--err-bg); border-color: rgba(220, 70, 70, .55);  color: var(--err); }
.ygg-alert ul { margin: 6px 0 0; padding-left: 20px; }

/* ---------- Empty state ---------- */
.ygg-empty { padding: 44px 20px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--panel); color: var(--muted); }
.ygg-empty strong { display: block; font-size: 18px; color: #fff; margin-bottom: 6px; }

/* ---------- Tables (stack on small screens) ---------- */
.ygg-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.ygg-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ygg-table th, .ygg-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.ygg-table th { background: var(--panel); color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.ygg-table tr:last-child td { border-bottom: 0; }
.ygg-num { text-align: right !important; font-variant-numeric: tabular-nums; }
.ygg-pos { color: var(--ok); } .ygg-neg { color: #ff9d8a; }
@media (max-width: 640px) {
    .ygg-table thead { display: none; }
    .ygg-table, .ygg-table tbody, .ygg-table tr, .ygg-table td { display: block; width: 100%; }
    .ygg-table tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
    .ygg-table td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 6px 14px; text-align: right; }
    .ygg-table td::before { content: attr(data-label); color: var(--dim); text-align: left; font-size: 13px; }
}

/* ---------- Pagination ---------- */
.ygg-pager { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
.ygg-pager span { color: var(--muted); font-size: 14px; padding: 0 6px; }

/* ---------- Account panel: side tabs ---------- */
.ygg-panel { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 24px; align-items: start; }
.ygg-tabs { position: sticky; top: 16px; display: grid; gap: 4px; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.ygg-tabs a {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--muted) !important; text-decoration: none; font-weight: 600; font-size: 14px; border: 1px solid transparent;
}
.ygg-tabs a:hover { background: var(--raise); color: #fff !important; }
.ygg-tabs a[aria-current="page"] { background: rgba(242, 200, 115, .1); border-color: rgba(242, 200, 115, .35); color: var(--gold) !important; }
.ygg-tabs .ygg-ico { width: 20px; text-align: center; opacity: .9; }
@media (max-width: 860px) {
    .ygg-panel { grid-template-columns: 1fr; }
    .ygg-tabs { position: static; display: flex; overflow-x: auto; scrollbar-width: thin; }
    .ygg-tabs a { white-space: nowrap; flex: none; }
}

/* ---------- Character cards ---------- */
.ygg-char { display: grid; gap: 12px; }
.ygg-char__top { display: flex; align-items: center; gap: 12px; }
.ygg-char__ico { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 10px; background: #0d1626; border: 1px solid var(--line); color: var(--gold); font-size: 20px; }
.ygg-char__name { margin: 0; font-size: 17px; color: #fff; overflow-wrap: anywhere; }
.ygg-char__job { margin: 0; color: var(--muted); font-size: 13px; }
.ygg-char__top .ygg-badge { margin-left: auto; }
.ygg-levels { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ygg-levels div { background: #0d1626; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 8px 10px; }
.ygg-levels span { display: block; font-size: 12px; color: var(--dim); }
.ygg-levels strong { font-size: 18px; color: #fff; }

/* ---------- Login card ---------- */
.ygg-auth { max-width: 440px; margin: 10px auto 0; }
.ygg-auth .ygg-card { padding: 28px; }
.ygg-auth__links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 14px; margin-top: 16px; }

/* ---------- Footer ---------- */
.ygg-footer { border-top: 1px solid var(--line-soft); background: rgba(8, 13, 25, .9); color: var(--dim); font-size: 13px; }
.ygg-footer__inner { max-width: 1200px; margin: 0 auto; padding: 22px 20px; display: flex; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.ygg-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.ygg-footer a { color: var(--muted) !important; text-decoration: none; }
.ygg-footer a:hover { color: var(--gold) !important; }

@media (max-width: 560px) {
    .ygg-main { padding: 22px 16px 44px; }
    .ygg-title { font-size: 28px; }
    .ygg-card { padding: 18px; }
    .ygg-bar__inner { padding: 10px 16px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* "PLAY ONLINE" in the main navigation (opens the Play in Browser window on the homepage) */
#ygg-v3-nav a.ygg-nav-play {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px !important; border-radius: 999px;
    color: #03200f !important; background: linear-gradient(180deg, #5cf0a0, #2fcf7a 55%, #18a35c);
    box-shadow: 0 6px 18px rgba(61, 220, 132, .35); animation: yggNavPlay 2.6s ease-in-out infinite;
}
#ygg-v3-nav a.ygg-nav-play::after { display: none !important; }
#ygg-v3-nav a.ygg-nav-play:hover { filter: brightness(1.07); }
#ygg-v3-nav a.ygg-nav-play span { font-size: .8em; }
@keyframes yggNavPlay { 50% { box-shadow: 0 6px 26px rgba(61, 220, 132, .7); } }
@media (prefers-reduced-motion: reduce) { #ygg-v3-nav a.ygg-nav-play { animation: none; } }
