@charset "utf-8";

/* ─────────────────────────────────────────────────────────────────
   Crystaria Online — Crystal Dark Theme
   Fonts : Cinzel (headings/buttons) · IM Fell English (body)
   Palette: deep void bg · crystal-grey text · gold & amethyst accents
   ───────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=IM+Fell+English:ital@0;1&family=Exo+2:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&display=swap');

/* ───── Reset / Base ───── */
* {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    color: #cccccc;
    background-color: #07060f;
    background-image:
        radial-gradient(ellipse 130% 50% at 50% 0%,   #10103c 0%, transparent 65%),
        radial-gradient(ellipse 60%  30% at 85% 100%, #080f1c 0%, transparent 60%);
    font-family: 'IM Fell English', Georgia, 'Times New Roman', serif;
    font-size: 90%;
    line-height: 1.55;
}

/* ───── Links ───── */
a {
    color: #c9a020;
    text-decoration: none;
}

a:hover {
    color: #e8c84a;
    text-decoration: none;
}

a:active {
    color: #f0d060;
}

/* ───── Headings ───── */
h1, h2, h3, h4 {
    font-family: 'Cinzel', Georgia, serif;
    color: #c9a020;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin: 0.4em 0 0.2em;
}

/* ───── Tables ───── */
table {
    background-color: #1e1a2a;   /* amethyst-dark grid lines */
    border: 1px solid #2a2a3a;
    border-collapse: separate;
    border-spacing: 1px;
}

td {
    background-color: #0d0d0d;
    color: #cccccc;
    padding: 3px 6px;
    vertical-align: top;
}

td:hover {
    background-color: #0f0c1a;
}

/* ───── Typography ───── */
strong, b {
    color: #c9a020;
    font-family: 'Cinzel', Georgia, serif;
}

em, i {
    color: #9090a8;
    font-style: italic;
}

u {
    text-decoration: underline;
}

/* Legacy <font> tags — inherit colour="" overrides */
font {
    font-family: inherit;
    font-size: inherit;
}

/* ───── Form Controls — Text / Password ───── */
input,
input[type="text"],
input[type="password"] {
    color: #aab0cc;
    background-color: #08070e;
    border: 1px solid #2a2a3a;
    padding: 2px 6px;
    font-family: 'IM Fell English', Georgia, serif;
    font-size: 1em;
    outline: none;
    -webkit-transition: border-color 0.15s ease, box-shadow 0.15s ease;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
input[type="text"]:focus,
input[type="password"]:focus {
    border-color: #c9a020;
    -webkit-box-shadow: 0 0 5px rgba(201, 160, 32, 0.35);
    box-shadow: 0 0 5px rgba(201, 160, 32, 0.35);
}

/* ───── Buttons ───── */
input[type="button"],
input[type="submit"] {
    color: #cccccc;
    background-color: #0d0a18;
    background-image: -webkit-linear-gradient(top, #14102a 0%, #0a0814 100%);
    background-image: linear-gradient(to bottom, #14102a 0%, #0a0814 100%);
    border: 1px solid #c9a020;
    padding: 3px 12px;
    cursor: pointer;
    font-family: 'Cinzel', Georgia, serif;
    font-size: 0.85em;
    letter-spacing: 0.04em;
    outline: none;
    -webkit-transition: all 0.15s ease;
    transition: all 0.15s ease;
}

input[type="button"]:hover,
input[type="submit"]:hover {
    background-image: -webkit-linear-gradient(top, #1e1840 0%, #12102a 100%);
    background-image: linear-gradient(to bottom, #1e1840 0%, #12102a 100%);
    border-color: #e8c84a;
    color: #e8c84a;
}

input[type="button"]:active,
input[type="submit"]:active {
    background-image: -webkit-linear-gradient(top, #0a0814 0%, #14102a 100%);
    background-image: linear-gradient(to bottom, #0a0814 0%, #14102a 100%);
}

/* ───── Select ───── */
select {
    color: #aab0cc;
    background-color: #08070e;
    border: 1px solid #2a2a3a;
    padding: 2px 5px;
    font-family: 'IM Fell English', Georgia, serif;
    font-size: 1em;
    outline: none;
    cursor: pointer;
    -webkit-transition: border-color 0.15s ease;
    transition: border-color 0.15s ease;
}

select:focus {
    border-color: #c9a020;
}

/* ───── Textarea ───── */
textarea {
    color: #aab0cc;
    background-color: #08070e;
    border: 1px solid #2a2a3a;
    padding: 5px 7px;
    font-family: 'IM Fell English', Georgia, serif;
    font-size: 1em;
    line-height: 1.5;
    outline: none;
    resize: vertical;
    -webkit-transition: border-color 0.15s ease, box-shadow 0.15s ease;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea:focus {
    border-color: #c9a020;
    -webkit-box-shadow: 0 0 5px rgba(201, 160, 32, 0.35);
    box-shadow: 0 0 5px rgba(201, 160, 32, 0.35);
}

/* ───── Main wrapper ───── */
#wrapper {
    position: absolute;
    top: 5px;
    width: 100%;
}

/* ───── Navigation bar (top of game UI) ───── */
#navBar {
    width: 100%;
    background: linear-gradient(to bottom, #110e20 0%, #0c0a18 100%);
    border-bottom: 1px solid #2a1e4a;
    padding: 4px 8px;
    text-align: center;
    box-sizing: border-box;
    line-height: 1.6;
    /* Dropdown menus need to escape the bar's vertical extent.  Without
       this the .nav-menu would be clipped behind the wrapper boundary. */
    position: relative;
    overflow: visible;
    z-index: 100;
}

/* ───── Game UI areas ───── */

#statMenu, #equipMenu {
    padding: 2px;
}

#displayArea {
    padding: 2px;
}

#infoArea {
    padding: 2px;
}

#moveMenu {
    padding: 2px;
}

#mapMenu {
    padding: 4px;
    font-family: monospace;
    font-size: 0.85em;
    /* cosmetic frame — display stays block so it fills its container on mobile */
    background: #050410;
    border: 1px solid #251f44;
    border-radius: 6px;
    box-shadow:
        0 0 0 1px #0a0818,
        0 0 16px rgba(40,25,80,0.5),
        inset 0 0 24px rgba(0,0,0,0.6);
    position: relative;
}

/* ─────────────────────────────────────────────────────────────────
   Chatroom — Exo 2 typeface, message-row layout
   ───────────────────────────────────────────────────────────────── */

#chatRoom {
    height: 420px;
    overflow-y: auto;
    padding: 3px 2px 4px;
    font-family: 'Exo 2', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0.84em;
    font-weight: 400;
    line-height: 1.52;
    scroll-behavior: smooth;
}

/* ── Individual message rows ──────────────────────────────────── */
.chat-msg {
    display: block;
    padding: 3px 8px 3px 7px;
    border-left: 2px solid transparent;
    border-radius: 2px;
    -webkit-transition: background 0.08s ease;
    transition: background 0.08s ease;
    word-break: break-word;
}

.chat-msg:hover {
    background: rgba(255, 255, 255, 0.028);
}

/* System events: achievements, PvP kills, announcements */
.chat-msg-system {
    border-left-color: #2a1e40;
    background: rgba(40, 25, 70, 0.12);
}

.chat-msg-system:hover {
    background: rgba(55, 35, 90, 0.22);
}

/* Highlighted announcements (rare/legendary achievements, tournament wins) */
.chat-msg-announce {
    border-left-color: #c9a020;
    background: rgba(201, 160, 32, 0.06);
}

.chat-msg-announce:hover {
    background: rgba(201, 160, 32, 0.10);
}

/* ── Timestamp (player messages only — system rows omit it) ── */
.chat-msg-time {
    display: inline-block;
    min-width: 34px;   /* fits HH:MM */
    color: #2e2848;
    font-size: 0.74em;
    font-weight: 300;
    font-family: 'Exo 2', monospace;
    letter-spacing: 0.01em;
    margin-right: 6px;
    user-select: none;
    -webkit-user-select: none;
    vertical-align: baseline;
}

/* ── Usernames within messages ─────────────────────────────── */
#chatRoom strong,
#chatRoom b {
    font-family: 'Exo 2', 'Segoe UI', sans-serif;
    font-weight: 600;
    color: inherit;        /* respect the font colour="" attribute  */
}

/* Legacy <font> tags keep their colour attribute */
#chatRoom font {
    font-family: inherit;
    font-size: inherit;
}

/* ── Empty / placeholder state ─────────────────────────────── */
/* Target only direct-child <em> tags (the "no messages yet" placeholders).
   Nested <em> inside message rows (e.g. rare monster titles) must stay inline. */
#chatRoom > em {
    color: #3a3258;
    font-family: 'Exo 2', sans-serif;
    font-style: normal;
    font-size: 0.88em;
    padding: 8px;
    display: block;
}

/* ── Chat input box ────────────────────────────────────────── */
#chatBox {
    padding: 4px 2px 3px;
}

#chatBox form {
    display: flex;
    align-items: center;
    gap: 4px;
}

#chatBox input[type="text"]#chatmessage {
    flex: 1;
    min-width: 0;
    background: #08070e;
    border: 1px solid #2a1e42;
    border-radius: 4px 0 0 4px;
    border-right: none;
    color: #c0b8d8;
    font-family: 'Exo 2', 'Segoe UI', system-ui, sans-serif;
    font-size: 0.88em;
    font-weight: 400;
    padding: 5px 9px;
    outline: none;
    -webkit-transition: border-color 0.15s, box-shadow 0.15s;
    transition: border-color 0.15s, box-shadow 0.15s;
    /* override the global width:70% inline style if present */
    width: auto !important;
}

#chatBox input[type="text"]#chatmessage:focus {
    border-color: #5a3a88;
    box-shadow: 0 0 6px rgba(120, 70, 200, 0.28);
}

#chatBox input[type="button"]#sendmessage {
    background: linear-gradient(to bottom, #1e1638 0%, #100c24 100%);
    border: 1px solid #4a2a7a;
    border-radius: 0 4px 4px 0;
    color: #a888e8;
    font-family: 'Exo 2', 'Segoe UI', sans-serif;
    font-size: 0.84em;
    font-weight: 500;
    letter-spacing: 0.05em;
    padding: 5px 13px;
    cursor: pointer;
    -webkit-transition: background 0.12s, border-color 0.12s, color 0.12s;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}

#chatBox input[type="button"]#sendmessage:hover {
    background: linear-gradient(to bottom, #2e2050 0%, #1a1438 100%);
    border-color: #c9a020;
    color: #e8c84a;
}

/* ── Chat tabs ──────────────────────────────────────────────── */
/* (overrides the .chat-tab rule defined later; specificity wins) */
#chatTabs {
    border-bottom: 1px solid #1a1530;
    margin-bottom: 2px;
    padding-top: 2px;
}

/* ── Online list ────────────────────────────────────────────── */
#onlineList {
    font-family: 'Exo 2', 'Segoe UI', system-ui, sans-serif;
    font-size: 0.80em;
    font-weight: 400;
    line-height: 1.5;
    padding: 2px;
}

#onlineList table {
    border: none;
    border-spacing: 0;
    background: transparent;
    width: 100%;
}

#onlineList td {
    background: transparent;
    border: none;
    border-bottom: 1px solid #0e0c18;
    padding: 3px 5px;
    color: #8880a8;
    vertical-align: middle;
}

#onlineList td:hover,
#onlineList tr:hover td {
    background: rgba(255, 255, 255, 0.025);
}

#onlineList b,
#onlineList strong {
    font-family: 'Exo 2', sans-serif;
    font-weight: 600;
}

#onlineList {
    padding: 2px;
}

#combatArea, #pvpArea, #auctionArea {
    padding: 2px;
}

/* ───── Chat tabs ───── */
.chat-tab {
    display: inline-block;
    padding: 3px 14px 5px;
    border-bottom: 2px solid transparent;
    color: #3d3860;
    font-family: 'Exo 2', 'Cinzel', Georgia, sans-serif;
    font-size: 0.76em;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    -webkit-transition: color 0.15s ease, border-color 0.15s ease;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.chat-tab:hover {
    color: #9070c0;
    text-decoration: none;
}

.chat-tab.active {
    border-bottom-color: #c9a020;
    color: #e8c84a;
}

/* ───── Custom scrollbars (WebKit / Blink) ───── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #07060f;
    border-left: 1px solid #1e1a2a;
}

::-webkit-scrollbar-thumb {
    background: #2a2040;
    border: 1px solid #3a3060;
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a3060;
    border-color: #c9a020;
}

::-webkit-scrollbar-corner {
    background: #07060f;
}

/* ───── Firefox scrollbar ───── */
* {
    scrollbar-width: thin;
    scrollbar-color: #2a2040 #07060f;
}

/* ═══════════════════════════════════════════════════════════════
   Crystaria — Interactive Visual Enhancements
   ═══════════════════════════════════════════════════════════════ */

/* ── Combat row animations ───────────────────────────────────── */
@keyframes cRiseIn {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes cCritGlow {
    0%   { box-shadow: none; }
    20%  { box-shadow: 0 0 14px rgba(232,200,74,0.65), inset 0 0 8px rgba(232,200,74,0.12); }
    100% { box-shadow: 0 0 3px rgba(232,200,74,0.1); }
}

/* Every combat row fades+rises in; crits also glow gold */
.c-row  { animation: cRiseIn 0.16s ease-out both; }
.c-crit { animation: cRiseIn 0.16s ease-out both, cCritGlow 0.75s ease-out both; }

/* ── HP / MP / XP stat-bar transitions ──────────────────────── */
/* Width animates smoothly when bars are re-rendered each turn   */
.stat-fill {
    -webkit-transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transition:         width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Danger pulse — applied to HP bar when below 25 % */
@keyframes hpDanger {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.42; }
}
.stat-fill-danger {
    animation: hpDanger 1.2s ease-in-out infinite;
}

/* ── Map — player sprite pulse ───────────────────────────────── */
@keyframes mapPlayerPulse {
    0%, 100% { -webkit-filter: drop-shadow(0 0 3px rgba(255,110,110,0.9)); filter: drop-shadow(0 0 3px rgba(255,110,110,0.9)); }
    50%       { -webkit-filter: drop-shadow(0 0 9px rgba(255,110,110,0.3)); filter: drop-shadow(0 0 9px rgba(255,110,110,0.3)); }
}
.map-player-sprite {
    display: block;
    margin: 0 auto;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    animation: mapPlayerPulse 2s ease-in-out infinite;
}

/* ── Map — tile hover tooltip (native title="" is enough;        */
/*    cursor:help signals interactivity)                          */
#mapMenu td[title] { cursor: help; }

/* Pixel-art rendering for all tile background images */
#mapMenu td {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Faint inner frame inset on the desktop map container */
#mapMenu::before {
    content: '';
    position: absolute;
    inset: 5px;
    border: 1px solid rgba(80,60,130,0.12);
    border-radius: 3px;
    pointer-events: none;
}

/* ── Full-map canvas (zoom 3) ─────────────────────────────────── */
#mapCanvas {
    display: block;
    border-radius: 3px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ── Desktop Compass Rose ─────────────────────────────────────── */
.dpad-wrap {
    display: inline-block;
    padding: 7px 6px;
    background: radial-gradient(ellipse 90% 90% at 50% 48%, #19163a 0%, #0e0c24 55%, #08060f 100%);
    border-radius: 50%;
    border: 1px solid #302858;
    box-shadow:
        0 0 0 1px #09071a,
        0 0 18px rgba(55,35,100,0.55),
        inset 0 1px 0 rgba(130,110,210,0.14),
        inset 0 -2px 4px rgba(0,0,0,0.5);
    vertical-align: middle;
}

.dpad-row-d {
    display: flex;
    gap: 2px;
    margin-bottom: 2px;
}
.dpad-row-d:last-child { margin-bottom: 0; }

/* Cardinal direction buttons */
.dpad-btn-d {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 38px;
    background: linear-gradient(175deg, #201b42 0%, #100d24 60%, #0b0918 100%);
    border: 1px solid #3c3468;
    border-bottom: 2px solid #161230;
    border-radius: 7px;
    color: #b0a8dc;
    font-size: 1.1em;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(150,130,220,0.16);
    transition: background 0.08s, border-color 0.08s, color 0.08s, transform 0.05s;
    user-select: none;
}
.dpad-btn-d:hover {
    background: linear-gradient(175deg, #2e2258 0%, #1c1640 60%, #100c28 100%);
    border-color: #c9a020;
    border-bottom-color: #8a6810;
    color: #f0d060;
    text-decoration: none;
    box-shadow: 0 0 10px rgba(201,160,32,0.3), inset 0 1px 0 rgba(255,220,80,0.1);
}
.dpad-btn-d:active {
    transform: translateY(1px);
    border-bottom-width: 1px;
}

/* Diagonal buttons — recessed, dimmer */
.dpad-diag-d {
    width: 36px;
    height: 32px;
    background: linear-gradient(175deg, #0e0c1e 0%, #080610 100%);
    border-color: #1e1a34;
    border-bottom-color: #0c0a18;
    color: #3e3a60;
    font-size: 0.9em;
    border-radius: 5px;
    box-shadow: none;
}
.dpad-diag-d:hover {
    background: linear-gradient(175deg, #1c1838 0%, #0e0c20 100%);
    border-color: #c9a020;
    border-bottom-color: #7a6010;
    color: #d0b840;
}

/* Center refresh button — round green gem */
.dpad-ctr-d {
    width: 40px;
    height: 40px;
    background: radial-gradient(circle at 40% 35%, #1f2f1a 0%, #0e1a0a 60%, #080f06 100%);
    border: 1px solid #2e4e28;
    border-bottom: 2px solid #131e0f;
    border-radius: 50%;
    color: #60b855;
    font-size: 1.1em;
    box-shadow: 0 0 8px rgba(60,160,40,0.2), inset 0 1px 0 rgba(120,220,80,0.14);
}
.dpad-ctr-d:hover {
    background: radial-gradient(circle at 40% 35%, #2a3f22 0%, #162410 60%, #0c1408 100%);
    border-color: #60a050;
    color: #90e870;
    box-shadow: 0 0 12px rgba(80,200,60,0.3);
}

/* ── Map zoom control buttons ─────────────────────────────────── */
.map-zoom-btn {
    display: inline-block;
    padding: 3px 10px;
    margin: 0 2px;
    background: linear-gradient(180deg, #1a1638 0%, #0e0c22 100%);
    border: 1px solid #352e60;
    border-bottom: 2px solid #0e0c1c;
    border-radius: 5px;
    color: #9088cc;
    font-size: 0.82em;
    font-family: 'Cinzel', Georgia, serif;
    letter-spacing: 0.04em;
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.map-zoom-btn:hover {
    background: linear-gradient(180deg, #221c48 0%, #14102a 100%);
    border-color: #5a4898;
    color: #c9a020;
    text-decoration: none;
}

.map-zoom-btn:active {
    background: linear-gradient(180deg, #2a2050 0%, #18143a 100%);
    border-color: #c9a020;
    border-bottom-width: 1px;
    color: #f0d060;
}

/* ── Global boss notification bar (desktop) ───────────────────── */
#globalBossBar:not(:empty) {
    background: linear-gradient(135deg, #1a0505 0%, #0e0204 100%);
    border: 1px solid #5a1010;
    border-radius: 5px;
    box-shadow: 0 0 12px rgba(180,30,0,0.4), inset 0 0 16px rgba(100,0,0,0.25);
    padding: 5px 10px;
    margin: 4px 0;
    color: #e08070;
    font-size: 0.88em;
    line-height: 1.4;
}

#globalBossBar:not(:empty) a {
    color: #ff9060;
    font-weight: 600;
}

/* ── Map legend row ───────────────────────────────────────────── */
.map-legend {
    font-size: 0.92em;
    color: #666677;
    padding: 5px 6px 2px;
    line-height: 2;
}

/* ── Class portrait in stat panel ───────────────────────────── */
.stat-portrait {
    display: block;
    margin: 0 auto 5px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    -webkit-filter: drop-shadow(0 0 6px rgba(201,160,32,0.5));
    filter:         drop-shadow(0 0 6px rgba(201,160,32,0.5));
}

/* ── Keyboard nav hint (injected by JS) ─────────────────────── */
#keyHintBar {
    text-align: center;
    font-size: 0.70em;
    color: #2a2a3a;
    padding: 1px 0 3px;
    letter-spacing: 0.04em;
    -webkit-user-select: none;
    user-select: none;
}

/* ───── Combat Arena (player left · monster right) ─────────── */
.combat-arena {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
        -ms-flex-direction: row;
            flex-direction: row;
    -webkit-box-align: flex-end;
        -ms-flex-align: flex-end;
            align-items: flex-end;
    -webkit-box-pack: space-around;
        -ms-flex-pack: distribute;
            justify-content: space-around;
    padding: 6px 8px 4px;
    min-height: 82px;
}

/* ───── Sprites (shared size) ──────────────────────────────── */
.mon-sprite-wrap,
.plr-sprite-wrap { text-align: center; }

.mon-sprite,
.plr-sprite {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    width:  64px;
    height: 64px;
    display: block;
}

@-webkit-keyframes monIdle {
    0%, 100% { -webkit-transform: translateY(0px);   }
    50%       { -webkit-transform: translateY(-5px);  }
}
@keyframes monIdle {
    0%, 100% { transform: translateY(0px);  }
    50%       { transform: translateY(-5px); }
}

@-webkit-keyframes monHurt {
    0%   { -webkit-transform: translateX(0);     filter: brightness(1); }
    20%  { -webkit-transform: translateX(-9px);  filter: brightness(4) sepia(1) hue-rotate(-20deg); }
    45%  { -webkit-transform: translateX(5px);   filter: brightness(2); }
    65%  { -webkit-transform: translateX(-3px); }
    100% { -webkit-transform: translateX(0);     filter: brightness(1); }
}
@keyframes monHurt {
    0%   { transform: translateX(0);    filter: brightness(1); }
    20%  { transform: translateX(-9px); filter: brightness(4) sepia(1) hue-rotate(-20deg); }
    45%  { transform: translateX(5px);  filter: brightness(2); }
    65%  { transform: translateX(-3px); }
    100% { transform: translateX(0);    filter: brightness(1); }
}

@-webkit-keyframes monCrit {
    0%   { -webkit-transform: scale(1)    translateX(0);    filter: brightness(1); }
    10%  { -webkit-transform: scale(0.88) translateX(-13px); filter: brightness(6) saturate(0); }
    30%  { -webkit-transform: scale(1.06) translateX(7px);  filter: brightness(3) sepia(1) hue-rotate(-20deg) saturate(3); }
    55%  { -webkit-transform: scale(0.96) translateX(-4px); filter: brightness(2); }
    75%  { -webkit-transform: scale(1.02) translateX(2px); }
    100% { -webkit-transform: scale(1)    translateX(0);    filter: brightness(1); }
}
@keyframes monCrit {
    0%   { transform: scale(1)    translateX(0);     filter: brightness(1); }
    10%  { transform: scale(0.88) translateX(-13px); filter: brightness(6) saturate(0); }
    30%  { transform: scale(1.06) translateX(7px);   filter: brightness(3) sepia(1) hue-rotate(-20deg) saturate(3); }
    55%  { transform: scale(0.96) translateX(-4px);  filter: brightness(2); }
    75%  { transform: scale(1.02) translateX(2px); }
    100% { transform: scale(1)    translateX(0);     filter: brightness(1); }
}

@-webkit-keyframes monDie {
    0%   { -webkit-transform: translateY(0)  rotate(0deg);  opacity: 1;   filter: brightness(1); }
    20%  { -webkit-transform: translateY(-6px) rotate(-6deg); filter: brightness(4) sepia(1) hue-rotate(-20deg); }
    55%  { -webkit-transform: translateY(2px)  rotate(12deg); opacity: 0.65; }
    80%  { -webkit-transform: translateY(8px)  rotate(22deg); opacity: 0.30; }
    100% { -webkit-transform: translateY(14px) rotate(32deg); opacity: 0;   filter: brightness(0); }
}
@keyframes monDie {
    0%   { transform: translateY(0)   rotate(0deg);  opacity: 1;    filter: brightness(1); }
    20%  { transform: translateY(-6px) rotate(-6deg); filter: brightness(4) sepia(1) hue-rotate(-20deg); }
    55%  { transform: translateY(2px)  rotate(12deg); opacity: 0.65; }
    80%  { transform: translateY(8px)  rotate(22deg); opacity: 0.30; }
    100% { transform: translateY(14px) rotate(32deg); opacity: 0;    filter: brightness(0); }
}

@-webkit-keyframes monCast {
    0%   { -webkit-transform: scale(1);    filter: brightness(1); }
    25%  { -webkit-transform: scale(1.10); filter: brightness(1.6) hue-rotate(40deg); }
    50%  { -webkit-transform: scale(0.95); filter: brightness(1.25); }
    75%  { -webkit-transform: scale(1.05); }
    100% { -webkit-transform: scale(1);    filter: brightness(1); }
}
@keyframes monCast {
    0%   { transform: scale(1);    filter: brightness(1); }
    25%  { transform: scale(1.10); filter: brightness(1.6) hue-rotate(40deg); }
    50%  { transform: scale(0.95); filter: brightness(1.25); }
    75%  { transform: scale(1.05); }
    100% { transform: scale(1);    filter: brightness(1); }
}

@-webkit-keyframes playerHitFlash {
    0%   { background-color: transparent; }
    20%  { background-color: rgba(180,0,0,0.28); }
    70%  { background-color: rgba(180,0,0,0.10); }
    100% { background-color: transparent; }
}
@keyframes playerHitFlash {
    0%   { background-color: transparent; }
    20%  { background-color: rgba(180,0,0,0.28); }
    70%  { background-color: rgba(180,0,0,0.10); }
    100% { background-color: transparent; }
}

/* Animations applied via inline style on the img — see combatfunctions.php */

.player-flash { -webkit-animation: playerHitFlash 0.7s ease-out; animation: playerHitFlash 0.7s ease-out; }

/* ───── Player Sprite Animations ───────────────────────────── */

/* Attack — lunge forward (toward monster on the right) */
@-webkit-keyframes plrAttack {
    0%   { -webkit-transform: translateX(0);    }
    28%  { -webkit-transform: translateX(20px); }
    55%  { -webkit-transform: translateX(8px);  }
    100% { -webkit-transform: translateX(0);    }
}
@keyframes plrAttack {
    0%   { transform: translateX(0);    }
    28%  { transform: translateX(20px); }
    55%  { transform: translateX(8px);  }
    100% { transform: translateX(0);    }
}

/* Cast — magical bloom with colour shift */
@-webkit-keyframes plrCast {
    0%   { -webkit-transform: scale(1);    filter: brightness(1); }
    20%  { -webkit-transform: scale(1.14); filter: brightness(2.8) hue-rotate(80deg) saturate(2); }
    50%  { -webkit-transform: scale(0.93); filter: brightness(1.6) hue-rotate(160deg); }
    75%  { -webkit-transform: scale(1.07); filter: brightness(1.9) hue-rotate(100deg); }
    100% { -webkit-transform: scale(1);    filter: brightness(1); }
}
@keyframes plrCast {
    0%   { transform: scale(1);    filter: brightness(1); }
    20%  { transform: scale(1.14); filter: brightness(2.8) hue-rotate(80deg) saturate(2); }
    50%  { transform: scale(0.93); filter: brightness(1.6) hue-rotate(160deg); }
    75%  { transform: scale(1.07); filter: brightness(1.9) hue-rotate(100deg); }
    100% { transform: scale(1);    filter: brightness(1); }
}

/* Hit — recoil left with red flash (player takes fatal blow) */
@-webkit-keyframes plrHit {
    0%   { -webkit-transform: translateX(0);     filter: brightness(1); }
    18%  { -webkit-transform: translateX(-14px); filter: brightness(5) sepia(1) hue-rotate(-20deg); }
    45%  { -webkit-transform: translateX(-6px);  filter: brightness(2); }
    72%  { -webkit-transform: translateX(-2px);  }
    100% { -webkit-transform: translateX(0);     filter: brightness(1); }
}
@keyframes plrHit {
    0%   { transform: translateX(0);     filter: brightness(1); }
    18%  { transform: translateX(-14px); filter: brightness(5) sepia(1) hue-rotate(-20deg); }
    45%  { transform: translateX(-6px);  filter: brightness(2); }
    72%  { transform: translateX(-2px);  }
    100% { transform: translateX(0);     filter: brightness(1); }
}

/* Idle — gentle float */
@-webkit-keyframes plrIdle {
    0%, 100% { -webkit-transform: translateY(0);    }
    50%       { -webkit-transform: translateY(-5px); }
}
@keyframes plrIdle {
    0%, 100% { transform: translateY(0);    }
    50%       { transform: translateY(-5px); }
}

/* Player animations applied via inline style — see combatfunctions.php */

/* ─────────────────────────────────────────────────────────────────
   News body — controls spacing and table rendering
   ───────────────────────────────────────────────────────────────── */

/* Tighten paragraph spacing — browser default (1em top+bottom) causes huge gaps */
.news-body p {
    margin: 0.25em 0;
}

/* Lists: remove the double-spacing that appeared when nl2br injected <br> inside <li> */
.news-body ul,
.news-body ol {
    margin: 0.3em 0 0.3em 1.4em;
    padding: 0;
}

.news-body li {
    margin: 0.1em 0;
}

/* Tables inserted via the news editor */
.news-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 6px 0;
    font-size: 0.9em;
}

.news-body th,
.news-body td {
    border: 1px solid #3a3050;
    padding: 4px 9px;
    text-align: left;
    vertical-align: top;
}

.news-body th {
    background: #1a1428;
    color: #c0b0d8;
    font-family: 'Cinzel', Georgia, serif;
    font-weight: 600;
    font-size: 0.88em;
}

.news-body td {
    background: #0d0b18;
    color: #c0b8cc;
}

/* ───── Quest Board ──────────────────────────────────────────────────── */

.quest-board-panel {
    background: #0a0812;
    border: 1px solid #2a2000;
    border-radius: 4px;
    padding: 10px 12px;
    margin: 4px 0;
}

.qb-quest-row {
    background: #0d0b10;
    border: 1px solid #1e1a08;
    border-radius: 3px;
    padding: 7px 10px;
    margin-bottom: 5px;
}

.qb-quest-row:hover {
    border-color: #3a3010;
}

.qb-btn {
    display: inline-block;
    padding: 2px 11px;
    background: #1a1004;
    border: 1px solid #c9a020;
    border-radius: 3px;
    color: #c9a020;
    text-decoration: none;
    font-size: 0.85em;
    cursor: pointer;
}

.qb-btn:hover {
    background: #2a1c08;
    color: #e8c84a;
}

.qb-btn-claim {
    background: #1a1400;
    border-color: #FFD700;
    color: #FFD700;
}

.qb-btn-claim:hover {
    background: #2a2200;
    color: #ffe855;
}

.qb-reward {
    font-size: 0.85em;
    margin: 3px 0;
    color: #888;
}

.qb-progress {
    background: #1e1a08;
    border-radius: 3px;
    height: 5px;
    margin-top: 2px;
}

.news-body tr:hover td {
    background: #140f22;
}

/* ─────────────────────────────────────────────────────────────────
   Crafting Panel
   ───────────────────────────────────────────────────────────────── */

.craft-panel {
    padding: 6px 8px;
    color: #c0b8d0;
}

.craft-title {
    font-family: 'Cinzel', Georgia, serif;
    font-size: 1.15em;
    color: #c8a0e8;
    text-align: center;
    padding: 4px 0 6px;
    border-bottom: 1px solid #2a1a40;
    margin-bottom: 6px;
    letter-spacing: 0.05em;
}

/* ── Tabs ── */
.craft-tabs {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.craft-tab {
    display: inline-block;
    padding: 4px 10px;
    background: #130f1e;
    border: 1px solid #2a1a40;
    border-radius: 4px;
    color: #8070a0;
    text-decoration: none;
    font-size: 0.84em;
    text-align: center;
    line-height: 1.3;
    transition: background 0.15s, color 0.15s;
}

.craft-tab:hover {
    background: #1c1430;
    color: #b090d0;
}

.craft-tab-active {
    background: #2a1a44;
    border-color: #7040a0;
    color: #d0a0f0;
}

.craft-tab-skill {
    font-size: 0.82em;
    color: #7060a0;
}

.craft-tab-active .craft-tab-skill {
    color: #a080c0;
}

/* ── Skill bar ── */
.craft-skillbar-wrap {
    text-align: center;
    margin-bottom: 6px;
    font-size: 0.88em;
}

.craft-skillbar-label {
    color: #9080b0;
}

/* ── Resource summary ── */
.craft-resources {
    text-align: center;
    margin-bottom: 8px;
    padding: 4px;
    background: #0f0c18;
    border: 1px solid #1e1630;
    border-radius: 3px;
}

/* ── Recipe table ── */
.craft-list {
    max-height: 340px;
    overflow-y: auto;
    border: 1px solid #1e1630;
    border-radius: 3px;
    margin-bottom: 8px;
    background: #0a0812;
}

.craft-table {
    border-collapse: collapse;
    font-size: 0.85em;
    width: 100%;
}

.craft-header th {
    background: #130f20;
    color: #7060a0;
    padding: 3px 5px;
    border-bottom: 1px solid #2a1a40;
    font-family: 'Cinzel', Georgia, serif;
    font-weight: 600;
    font-size: 0.82em;
    position: sticky;
    top: 0;
    z-index: 1;
}

.craft-section-head {
    background: #110e1c;
    color: #806090;
    font-size: 0.82em;
    font-style: italic;
    padding: 2px 6px;
    border-top: 1px solid #1e1630;
}

.craft-row-ok td,
.craft-row-locked td {
    padding: 3px 5px;
    border-bottom: 1px solid #140e20;
}

.craft-row-ok {
    background: #0d0b18;
}

.craft-row-ok:hover {
    background: #160e28;
}

.craft-row-locked {
    background: #0a0810;
    opacity: 0.7;
}

.craft-item-name {
    color: #c8b8e0;
}

.craft-row-locked .craft-item-name {
    color: #5a5070;
}

.craft-ing-cell {
    min-width: 120px;
}

/* ── Craft buttons ── */
.craft-btn {
    display: inline-block;
    padding: 2px 8px;
    background: #2a1044;
    border: 1px solid #6030a0;
    border-radius: 3px;
    color: #c080f0;
    text-decoration: none;
    font-size: 0.82em;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.craft-btn:hover {
    background: #401860;
    color: #e0a0ff;
    border-color: #9050d0;
}

.craft-btn-locked {
    display: inline-block;
    padding: 2px 8px;
    color: #443850;
    font-size: 0.80em;
    font-style: italic;
    white-space: nowrap;
}

/* ── Craft log ── */
.craft-log {
    background: #0a0812;
    border: 1px solid #1e1630;
    border-radius: 3px;
    padding: 4px 6px;
    font-size: 0.84em;
}

.craft-log-title {
    color: #7060a0;
    font-family: 'Cinzel', Georgia, serif;
    font-size: 0.88em;
    border-bottom: 1px solid #1e1630;
    margin-bottom: 4px;
    padding-bottom: 2px;
}

/* ── Game Navigation Buttons ─────────────────────────────────── */
.nav-btn {
    display: inline-block;
    padding: 5px 10px;
    margin: 2px 1px;
    background: linear-gradient(to bottom, #1e1630 0%, #0d0a1a 100%);
    border: 1px solid #2e2248;
    border-radius: 4px;
    color: #a898c8;
    text-decoration: none;
    font-family: 'Cinzel', 'Palatino Linotype', serif;
    font-size: 0.75em;
    letter-spacing: 0.05em;
    white-space: nowrap;
    transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
}
.nav-btn:hover {
    background: linear-gradient(to bottom, #2e2050 0%, #18103a 100%);
    border-color: #8050cc;
    color: #e0d0ff;
    text-decoration: none;
    box-shadow: 0 0 7px rgba(130, 80, 210, 0.35);
}
.nav-btn:active {
    background: linear-gradient(to bottom, #0d0a1a 0%, #1a1428 100%);
    border-color: #5030a0;
    color: #b8a8e0;
    box-shadow: none;
}

/* Alert variant — gold pulsing glow when the button has something the player
   should know about (claimable objectives, unread mail, etc.).  The pulse
   keyframe runs on the border + box-shadow so the underlying nav-btn hover
   transitions don't fight it. */
.nav-btn-alert {
    border-color: #c9a020;
    background: linear-gradient(to bottom, #2a1f0c 0%, #15100a 100%);
    color: #ffe06a;
    animation: navAlertPulse 1.6s ease-in-out infinite;
}
.nav-btn-alert:hover {
    background: linear-gradient(to bottom, #3a2a14 0%, #1f1808 100%);
    border-color: #ffd24a;
    color: #fff0a0;
}
@keyframes navAlertPulse {
    0%, 100% {
        box-shadow: 0 0 4px rgba(201, 160, 32, 0.35),
                    inset 0 0 6px rgba(201, 160, 32, 0.12);
    }
    50% {
        box-shadow: 0 0 11px rgba(255, 215, 90, 0.65),
                    inset 0 0 9px rgba(255, 215, 90, 0.22);
    }
}
/* Small numeric pill that hangs off the right of an alert nav button */
.nav-btn-badge {
    display: inline-block;
    background: #cc4444;
    color: #fff;
    border-radius: 9px;
    padding: 0 5px;
    font-size: 0.78em;
    margin-left: 4px;
    font-family: 'Exo 2', sans-serif;
    font-weight: 600;
    box-shadow: 0 0 4px rgba(204, 68, 68, 0.5);
}

/* ── Nav dropdowns ──────────────────────────────────────────────
   .nav-group is an inline-block wrapper around a top-level button
   (the .nav-btn) and a hidden .nav-menu. Hovering the group reveals
   the menu beneath it.  Each .nav-menu-item is a fluid full-width
   link inside the dropdown, keeping the Cinzel/gold game palette.
*/
.nav-group {
    position: relative;
    display: inline-block;
    margin: 2px 1px;
    vertical-align: middle;
}
.nav-group > .nav-btn {
    margin: 0;
}
/* Small caret on grouped buttons */
.nav-group > .nav-btn::after {
    content: ' \25BE';                 /* ▾ */
    color: #6a5a8a;
    font-size: 0.85em;
    margin-left: 4px;
}
.nav-group:hover > .nav-btn::after { color: #c9a020; }
/* The dropdown panel — hidden by default, revealed on group hover. */
.nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 160px;
    margin-top: 3px;
    padding: 4px 0;
    background: linear-gradient(to bottom, #160e2a 0%, #0c0818 100%);
    border: 1px solid #3a2a5a;
    border-radius: 4px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.7),
                inset 0 1px 0 rgba(255,215,90,0.04);
    z-index: 1000;
    text-align: left;
}
.nav-group:hover .nav-menu,
.nav-group:focus-within .nav-menu { display: block; }
/* Tiny hover bridge so the menu does not close when crossing the gap. */
.nav-menu::before {
    content: '';
    position: absolute;
    left: 0; right: 0;
    top: -6px;
    height: 6px;
}
.nav-menu-item {
    display: block;
    padding: 5px 14px;
    color: #a898c8;
    font-family: 'Cinzel', 'Palatino Linotype', serif;
    font-size: 0.78em;
    letter-spacing: 0.04em;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.1s, color 0.1s;
}
.nav-menu-item:hover {
    background: #2a1e42;
    color: #ffe88a;
    text-decoration: none;
}
.nav-menu-item .nav-btn-badge { margin-left: 8px; }
/* When the parent group should show the gold pulsing alert because one
   of its children has unread/claimable content, the parent .nav-btn
   keeps its existing .nav-btn-alert class — we just stop the caret
   from clashing colour-wise. */
.nav-group .nav-btn-alert::after { color: #c9a020; }

/* Admin/GM variant — gold accent */
.nav-btn-admin {
    border-color: #3a2800;
    color: #aa7820;
}
.nav-btn-admin:hover {
    background: linear-gradient(to bottom, #241800 0%, #140e00 100%);
    border-color: #c9a020;
    color: #ffe06a;
    box-shadow: 0 0 7px rgba(200, 155, 20, 0.35);
}
.nav-btn-admin:active {
    background: linear-gradient(to bottom, #140e00 0%, #201600 100%);
    border-color: #806010;
    color: #ccaa40;
    box-shadow: none;
}

/* ═══════════════════════════════════════════════════════════════
   Multi-Resolution Scaling — HD+ through 4K
   Breakpoints : 1440 (HD+) · 1920 (FHD) · 2560 (QHD) · 3840 (4K)
   Strategy    : scale font-size on body; scale fixed-pixel
                 elements (sprites, compass, chat, craft list,
                 stat bars, scrollbars) proportionally.
   ═══════════════════════════════════════════════════════════════ */

/* ── HD+ — 1440p and common large laptops (1440 × 900 +) ─── */
@media screen and (min-width: 1440px) {
    body { font-size: 92%; }
}

/* ── Full HD — 1920 × 1080 ───────────────────────────────── */
@media screen and (min-width: 1920px) {
    body { font-size: 96%; }

    #chatRoom  { height: 490px; }

    .craft-list { max-height: 400px; }

    /* Slightly thicker stat bars */
    .stat-fill,
    .qb-progress { height: 6px; }
}

/* ── QHD / 1440p monitors — 2560 × 1440 ─────────────────── */
@media screen and (min-width: 2560px) {
    body { font-size: 114%; }

    #chatRoom  { height: 600px; }

    .craft-list     { max-height: 500px; }
    .craft-ing-cell { min-width: 165px; }

    .combat-arena { min-height: 104px; }

    /* Combat sprites */
    .mon-sprite,
    .plr-sprite {
        width:  82px;
        height: 82px;
    }

    /* Compass rose — cardinal buttons */
    .dpad-btn-d {
        width:  56px;
        height: 50px;
        font-size: 1.25em;
    }
    /* Diagonal buttons */
    .dpad-diag-d {
        width:  46px;
        height: 40px;
    }
    /* Centre refresh button */
    .dpad-ctr-d {
        width:  52px;
        height: 52px;
        font-size: 1.25em;
    }
    /* Compass rose container */
    .dpad-wrap   { padding: 10px 8px; }
    .dpad-row-d  { gap: 3px; margin-bottom: 3px; }

    /* Stat / progress bars */
    .stat-fill,
    .qb-progress { height: 7px; }

    /* Scrollbars */
    ::-webkit-scrollbar { width: 10px; height: 10px; }

    /* Chat tabs */
    .chat-tab { padding: 4px 14px 6px; font-size: 0.86em; }

    /* Nav buttons */
    .nav-btn { padding: 6px 13px; }
}

/* ── 4K UHD — 3840 × 2160 ───────────────────────────────── */
@media screen and (min-width: 3840px) {
    body { font-size: 148%; }

    #wrapper { top: 10px; }

    #chatRoom  { height: 820px; }

    .craft-list     { max-height: 700px; }
    .craft-ing-cell { min-width: 230px; }

    .combat-arena { min-height: 158px; }

    /* Combat sprites — 2× original */
    .mon-sprite,
    .plr-sprite {
        width:  128px;
        height: 128px;
    }

    /* Compass rose — cardinal buttons */
    .dpad-btn-d {
        width:  78px;
        height: 66px;
        font-size: 1.55em;
        border-radius: 9px;
    }
    /* Diagonal buttons */
    .dpad-diag-d {
        width:  62px;
        height: 54px;
        border-radius: 7px;
    }
    /* Centre refresh button */
    .dpad-ctr-d {
        width:  70px;
        height: 70px;
        font-size: 1.45em;
    }
    /* Compass rose container */
    .dpad-wrap  { padding: 16px 12px; }
    .dpad-row-d { gap: 5px; margin-bottom: 5px; }

    /* Stat / progress bars */
    .stat-fill,
    .qb-progress { height: 10px; }

    /* Scrollbars */
    ::-webkit-scrollbar { width: 14px; height: 14px; }

    /* Chat tabs */
    .chat-tab { padding: 6px 20px 9px; font-size: 0.92em; }

    /* Nav buttons */
    .nav-btn { padding: 9px 18px; font-size: 0.85em; }

    /* Map zoom buttons */
    .map-zoom-btn { padding: 5px 16px; font-size: 0.90em; }

    /* Craft buttons */
    .craft-btn        { padding: 4px 12px; font-size: 0.90em; }
    .craft-btn-locked { padding: 4px 12px; font-size: 0.88em; }
}
