@font-face {
    font-family: 'OpenSans';
    src: url('../fonts/OpenSans-Regular.ttf') format('truetype');
    font-weight: 400;
}

@font-face {
    font-family: 'OpenSans';
    src: url('../fonts/OpenSans-Semibold.ttf') format('truetype');
    font-weight: 600;
}

/* MedievalSharp by wmk69, SIL Open Font License 1.1, see fonts/MedievalSharp-OFL.txt */
@font-face {
    font-family: 'MedievalSharp';
    src: url('../fonts/MedievalSharp.ttf') format('truetype');
    font-weight: 400;
}

:root {
    --primary: #8b1414;
    --primary-dark: #5a0b0b;
    --gold: #e8e800;
    --error: #eb4034;
    --success: #00ff40;
    --danger: #ff0000;

    --radius: 10px;
    /* Item rarity colors */
    --rarity-poor: #9d9d9d;
    --rarity-common: #ffffff;
    --rarity-uncommon: #1eff00;
    --rarity-rare: #0070dd;
    --rarity-epic: #a335ee;
    --rarity-legendary: #ff8000;
    --rarity-artifact: #e6cc80;
    --rarity-heirloom: #00ccff;
    --arrow-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 24'%3E%3Cpath d='M2 12 L13 4.5 L11 10.5 L11 13.5 L13 19.5 Z'/%3E%3Crect x='11' y='10.8' width='27' height='2.4' rx='1'/%3E%3Cpath d='M33 11 L39 4 L46 4 L40 11 Z'/%3E%3Cpath d='M33 13 L39 20 L46 20 L40 13 Z'/%3E%3Cpath d='M29 11 L34 6 L37 6 L33 11 Z'/%3E%3Cpath d='M29 13 L34 18 L37 18 L33 13 Z'/%3E%3C/svg%3E");
    --crest: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23f3d873'/%3E%3Cstop offset='1' stop-color='%239a7417'/%3E%3C/linearGradient%3E%3ClinearGradient id='s' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23d23a3a'/%3E%3Cstop offset='1' stop-color='%236e0b0b'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cg fill='none' stroke='%237a5a12' stroke-width='1.4' stroke-linecap='round'%3E%3Cpath d='M29.8 57.9 A25 25 0 0 1 19.5 11.3'/%3E%3Cpath d='M34.2 57.9 A25 25 0 0 0 44.5 11.3'/%3E%3C/g%3E%3Cg fill='url%28%23g%29' stroke='%236b4e10' stroke-width='0.5'%3E%3Cellipse cx='24.8' cy='59.0' rx='4' ry='1.7' transform='rotate%28155 24.8 59.0%29'/%3E%3Cellipse cx='25.4' cy='55.4' rx='4' ry='1.7' transform='rotate%28225 25.4 55.4%29'/%3E%3Cellipse cx='17.1' cy='55.5' rx='4' ry='1.7' transform='rotate%28173 17.1 55.5%29'/%3E%3Cellipse cx='18.8' cy='52.2' rx='4' ry='1.7' transform='rotate%28243 18.8 52.2%29'/%3E%3Cellipse cx='10.9' cy='49.8' rx='4' ry='1.7' transform='rotate%28191 10.9 49.8%29'/%3E%3Cellipse cx='13.5' cy='47.2' rx='4' ry='1.7' transform='rotate%28261 13.5 47.2%29'/%3E%3Cellipse cx='6.7' cy='42.4' rx='4' ry='1.7' transform='rotate%28209 6.7 42.4%29'/%3E%3Cellipse cx='10.0' cy='40.8' rx='4' ry='1.7' transform='rotate%28279 10.0 40.8%29'/%3E%3Cellipse cx='5.1' cy='34.1' rx='4' ry='1.7' transform='rotate%28227 5.1 34.1%29'/%3E%3Cellipse cx='8.7' cy='33.6' rx='4' ry='1.7' transform='rotate%28297 8.7 33.6%29'/%3E%3Cellipse cx='6.0' cy='25.8' rx='4' ry='1.7' transform='rotate%28245 6.0 25.8%29'/%3E%3Cellipse cx='9.6' cy='26.4' rx='4' ry='1.7' transform='rotate%28315 9.6 26.4%29'/%3E%3Cellipse cx='9.5' cy='18.1' rx='4' ry='1.7' transform='rotate%28263 9.5 18.1%29'/%3E%3Cellipse cx='12.8' cy='19.8' rx='4' ry='1.7' transform='rotate%28333 12.8 19.8%29'/%3E%3Cellipse cx='15.2' cy='11.9' rx='4' ry='1.7' transform='rotate%28281 15.2 11.9%29'/%3E%3Cellipse cx='17.8' cy='14.5' rx='4' ry='1.7' transform='rotate%28351 17.8 14.5%29'/%3E%3Cellipse cx='33.4' cy='56.3' rx='4' ry='1.7' transform='rotate%28205 33.4 56.3%29'/%3E%3Cellipse cx='34.1' cy='59.9' rx='4' ry='1.7' transform='rotate%28135 34.1 59.9%29'/%3E%3Cellipse cx='40.6' cy='54.7' rx='4' ry='1.7' transform='rotate%28187 40.6 54.7%29'/%3E%3Cellipse cx='42.3' cy='57.9' rx='4' ry='1.7' transform='rotate%28117 42.3 57.9%29'/%3E%3Cellipse cx='46.8' cy='51.0' rx='4' ry='1.7' transform='rotate%28169 46.8 51.0%29'/%3E%3Cellipse cx='49.5' cy='53.5' rx='4' ry='1.7' transform='rotate%2899 49.5 53.5%29'/%3E%3Cellipse cx='51.7' cy='45.5' rx='4' ry='1.7' transform='rotate%28151 51.7 45.5%29'/%3E%3Cellipse cx='55.0' cy='47.1' rx='4' ry='1.7' transform='rotate%2881 55.0 47.1%29'/%3E%3Cellipse cx='54.6' cy='38.8' rx='4' ry='1.7' transform='rotate%28133 54.6 38.8%29'/%3E%3Cellipse cx='58.2' cy='39.3' rx='4' ry='1.7' transform='rotate%2863 58.2 39.3%29'/%3E%3Cellipse cx='55.3' cy='31.6' rx='4' ry='1.7' transform='rotate%28115 55.3 31.6%29'/%3E%3Cellipse cx='58.9' cy='30.9' rx='4' ry='1.7' transform='rotate%2845 58.9 30.9%29'/%3E%3Cellipse cx='53.7' cy='24.4' rx='4' ry='1.7' transform='rotate%2897 53.7 24.4%29'/%3E%3Cellipse cx='56.9' cy='22.7' rx='4' ry='1.7' transform='rotate%2827 56.9 22.7%29'/%3E%3Cellipse cx='50.0' cy='18.2' rx='4' ry='1.7' transform='rotate%2879 50.0 18.2%29'/%3E%3Cellipse cx='52.5' cy='15.5' rx='4' ry='1.7' transform='rotate%289 52.5 15.5%29'/%3E%3C/g%3E%3Cpath d='M32 13 L46 17.5 V31 C46 41 40 48 32 52 C24 48 18 41 18 31 V17.5 Z' fill='%231e1e1e' transform='translate%280.8 1.2%29' opacity='0.5'/%3E%3Cpath d='M32 13 L46 17.5 V31 C46 41 40 48 32 52 C24 48 18 41 18 31 V17.5 Z' fill='url%28%23s%29' stroke='url%28%23g%29' stroke-width='2.2'/%3E%3Cpath d='M32 22 L34.4 28.6 L41.2 28.8 L35.8 33 L37.8 39.6 L32 35.7 L26.2 39.6 L28.2 33 L22.8 28.8 L29.6 28.6 Z' fill='url%28%23g%29' stroke='%236b4e10' stroke-width='0.5'/%3E%3C/svg%3E");
    --font-medieval: 'MedievalSharp', 'OpenSans', serif;
    --font-sans: 'OpenSans', sans-serif;
    --font-text: var(--font-medieval);
    --font-scale: 1;
    --gap: 10px;
    --max-width: 450px;
    --tabbar-height: 64px;
    --fab-size: 56px;
    --fab-gap: 12px;
    --ad-height: 50px;

    --bg: #ffffff;
    --surface: #ffffff;
    --text: #000000;
    --text-muted: #555555;
    --outline: #C8C8C8;
    --stat-boosted: #a8780a;
    --btn-bg: linear-gradient(180deg, #b01c1c 0%, var(--primary) 45%, var(--primary-dark) 100%);
    --btn-text: var(--gold);
    --btn-disabled-bg: #8e8e8e;
    --btn-disabled-text: #e6e6e6;
    --quest-title: var(--gold-text);
    --frame: linear-gradient(145deg, #f4f4f4 0%, #a6a6a6 15%, #5c5c5c 32%, #e0e0e0 50%, #7c7c7c 66%, #3f3f3f 84%, #c4c4c4 100%);
    --frame-width: 4px;
    --bronze: linear-gradient(145deg, #fde2bb 0%, #d9a065 15%, #a9692f 32%, #f4c58e 50%, #c0834a 66%, #8a5424 84%, #e6b47c 100%);
    /* Raised metal: drop shadow outside, dark bevel line and soft shade inside */
    --frame-shadow: 0 3px 6px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.45), inset 0 2px 5px rgba(0, 0, 0, 0.25);
    /* Engraved corner ornaments, drawn inside the frame */
    --corner-tl: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cg transform='rotate%280 16 16%29'%3E%3Cpath d='M3 27 V11 Q3 3 11 3 H27' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M8 21 Q8 8 21 8' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M27 3 q3 0 3 3 q0 2.5 -2.5 2.5' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 q0 3 3 3 q2.5 0 2.5 -2.5' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 V11 Q3 3 11 3 H27' stroke='%23c9c9c9' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M8 21 Q8 8 21 8' stroke='%23c9c9c9' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M27 3 q3 0 3 3 q0 2.5 -2.5 2.5' stroke='%23c9c9c9' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 q0 3 3 3 q2.5 0 2.5 -2.5' stroke='%23c9c9c9' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Ccircle cx='8.7' cy='8.7' r='2.4' fill='%231e1e1e'/%3E%3Ccircle cx='8' cy='8' r='2.2' fill='%23d6d6d6' stroke='%236a6a6a' stroke-width='0.6'/%3E%3Ccircle cx='7.4' cy='7.4' r='0.7' fill='%23ffffff'/%3E%3C/g%3E%3C/svg%3E");
    --corner-tr: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cg transform='rotate%2890 16 16%29'%3E%3Cpath d='M3 27 V11 Q3 3 11 3 H27' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M8 21 Q8 8 21 8' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M27 3 q3 0 3 3 q0 2.5 -2.5 2.5' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 q0 3 3 3 q2.5 0 2.5 -2.5' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 V11 Q3 3 11 3 H27' stroke='%23c9c9c9' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M8 21 Q8 8 21 8' stroke='%23c9c9c9' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M27 3 q3 0 3 3 q0 2.5 -2.5 2.5' stroke='%23c9c9c9' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 q0 3 3 3 q2.5 0 2.5 -2.5' stroke='%23c9c9c9' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Ccircle cx='8.7' cy='8.7' r='2.4' fill='%231e1e1e'/%3E%3Ccircle cx='8' cy='8' r='2.2' fill='%23d6d6d6' stroke='%236a6a6a' stroke-width='0.6'/%3E%3Ccircle cx='7.4' cy='7.4' r='0.7' fill='%23ffffff'/%3E%3C/g%3E%3C/svg%3E");
    --corner-br: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cg transform='rotate%28180 16 16%29'%3E%3Cpath d='M3 27 V11 Q3 3 11 3 H27' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M8 21 Q8 8 21 8' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M27 3 q3 0 3 3 q0 2.5 -2.5 2.5' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 q0 3 3 3 q2.5 0 2.5 -2.5' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 V11 Q3 3 11 3 H27' stroke='%23c9c9c9' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M8 21 Q8 8 21 8' stroke='%23c9c9c9' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M27 3 q3 0 3 3 q0 2.5 -2.5 2.5' stroke='%23c9c9c9' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 q0 3 3 3 q2.5 0 2.5 -2.5' stroke='%23c9c9c9' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Ccircle cx='8.7' cy='8.7' r='2.4' fill='%231e1e1e'/%3E%3Ccircle cx='8' cy='8' r='2.2' fill='%23d6d6d6' stroke='%236a6a6a' stroke-width='0.6'/%3E%3Ccircle cx='7.4' cy='7.4' r='0.7' fill='%23ffffff'/%3E%3C/g%3E%3C/svg%3E");
    --corner-bl: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cg transform='rotate%28270 16 16%29'%3E%3Cpath d='M3 27 V11 Q3 3 11 3 H27' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M8 21 Q8 8 21 8' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M27 3 q3 0 3 3 q0 2.5 -2.5 2.5' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 q0 3 3 3 q2.5 0 2.5 -2.5' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 V11 Q3 3 11 3 H27' stroke='%23c9c9c9' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M8 21 Q8 8 21 8' stroke='%23c9c9c9' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M27 3 q3 0 3 3 q0 2.5 -2.5 2.5' stroke='%23c9c9c9' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 q0 3 3 3 q2.5 0 2.5 -2.5' stroke='%23c9c9c9' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Ccircle cx='8.7' cy='8.7' r='2.4' fill='%231e1e1e'/%3E%3Ccircle cx='8' cy='8' r='2.2' fill='%23d6d6d6' stroke='%236a6a6a' stroke-width='0.6'/%3E%3Ccircle cx='7.4' cy='7.4' r='0.7' fill='%23ffffff'/%3E%3C/g%3E%3C/svg%3E");
    --icon-filter: none;
    /* Gold as text color: bright yellow vanishes on white, light mode uses a dark gold (buttons keep --gold on red) */
    --gold-text: #8a6a07;
    --points-high: #a8281c;
    --gold-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
    /* White "common" frames vanish on the light slots */
    --rarity-common-frame: #8a8a8a;
    /* Dark halo around the tab icons, the light ones (papyrus, metal) vanish on white otherwise */
    --tab-glow: drop-shadow(0 0 2px rgba(0, 0, 0, 0.85)) drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7));
    /* Sunken slots and bars: light grey in light mode, near black in dark mode */
    --slot-bg: radial-gradient(circle at 50% 40%, #ececec, #bcbcbc);
    --slot-border: #8a8a8a;
    --slot-icon: #000000;
    --slot-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35), 0 1px 1px rgba(255, 255, 255, 0.6);
    --bar-bg: #cfcfcf;
    --bar-border: #7a7a7a;
    --bar-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35), 0 1px 1px rgba(255, 255, 255, 0.6);
    /* Tints the black icons gold on red buttons */
    --btn-icon-filter: invert(1) sepia(1) saturate(6) hue-rotate(5deg) brightness(1.05);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1f1f1f;
        --surface: #292929;
        --text: #ffffff;
        --text-muted: #ACACAC;
        --outline: #6E6E6E;
        --stat-boosted: #f0c850;
        --btn-disabled-bg: #4a4a4a;
        --btn-disabled-text: #b0b0b0;
        --icon-filter: invert(1);
        --gold-text: var(--gold);
        --points-high: #d0584c;
        --gold-shadow: 1px 1px 1px rgba(0, 0, 0, 0.6);
        --rarity-common-frame: var(--rarity-common);
        --tab-glow: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7));
        --slot-bg: radial-gradient(circle at 50% 40%, #2c2c2c, #141414);
        --slot-border: #5c5c5c;
        --slot-icon: #ffffff;
        --slot-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.8), 0 1px 1px rgba(255, 255, 255, 0.12);
        --bar-bg: #151515;
        --bar-border: #3a3a3a;
        --bar-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7), 0 1px 1px rgba(255, 255, 255, 0.15);
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-text);
    overflow-x: hidden;
}
/* Every scalable font size is in rem (16px = 1rem at 100 %), the ones inside fixed boxes and glyph icons stay in px */
html { font-size: calc(16px * var(--font-scale)); }
body { font-size: 0.875rem; }

/* Accessibility (Settings, landing page, js/display.js): size 100 / 115 / 130 %; fonts 0 = game font, 1 = readable (headings stay medieval), 2 = the device's font */
html[data-font-size="1"] { --font-scale: 1.15; }
html[data-font-size="2"] { --font-scale: 1.3; }
html[data-font-style="0"] { --font-text: var(--font-medieval); }
html[data-font-style="1"] { --font-text: var(--font-sans); }
html[data-font-style="2"] { --font-medieval: system-ui, sans-serif; --font-sans: system-ui, sans-serif; --font-text: system-ui, sans-serif; }
h1, h2, h3, .entry-title, .celebration-title, .celebrate-title { font-family: var(--font-medieval); }
/* The ? is drawn with the medieval glyph in every font choice */
.quest-mark { font-family: 'MedievalSharp', serif; }

h1 { font-size: 1.75rem; margin: 0; font-weight: 400; }
h2 { font-size: 1.5rem; margin: 10px 0; text-align: center; font-weight: 400; }

.page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; }
.content { width: 100%; max-width: var(--max-width); padding: calc(20px + env(safe-area-inset-top, 0px)) 20px 20px; display: flex; flex-direction: column; gap: var(--gap); }
/* Leaves room for the floating bug button above the tab bar */
.content.with-tabbar { padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px) + var(--ad-room, 0px) + var(--fab-size) + 2 * var(--fab-gap)); }
/* With the ad slot above the tab bar the content and the bug button keep its height free */
.page:has(> .ad-slot) { --ad-room: var(--ad-height); }

.page-header { display: flex; align-items: center; gap: var(--gap); margin-bottom: 10px; }

.card, .entry {
    --frame-fill: var(--surface);
    --corner-size: 25px;
    border: var(--frame-width) solid transparent;
    background:
        var(--corner-tl) top left / var(--corner-size) var(--corner-size) no-repeat padding-box,
        var(--corner-tr) top right / var(--corner-size) var(--corner-size) no-repeat padding-box,
        var(--corner-br) bottom right / var(--corner-size) var(--corner-size) no-repeat padding-box,
        var(--corner-bl) bottom left / var(--corner-size) var(--corner-size) no-repeat padding-box,
        linear-gradient(var(--frame-fill), var(--frame-fill)) padding-box,
        var(--frame) border-box;
    box-shadow: var(--frame-shadow);
}
.card {
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.entry {
    --corner-size: 13px;
    border-radius: var(--radius);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
/* One-time quests: bronze instead of metal frame */
.bronze {
    --frame: var(--bronze);
    --corner-tl: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cg transform='rotate%280 16 16%29'%3E%3Cpath d='M3 27 V11 Q3 3 11 3 H27' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M8 21 Q8 8 21 8' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M27 3 q3 0 3 3 q0 2.5 -2.5 2.5' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 q0 3 3 3 q2.5 0 2.5 -2.5' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 V11 Q3 3 11 3 H27' stroke='%23e0a96d' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M8 21 Q8 8 21 8' stroke='%23e0a96d' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M27 3 q3 0 3 3 q0 2.5 -2.5 2.5' stroke='%23e0a96d' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 q0 3 3 3 q2.5 0 2.5 -2.5' stroke='%23e0a96d' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Ccircle cx='8.7' cy='8.7' r='2.4' fill='%231e1e1e'/%3E%3Ccircle cx='8' cy='8' r='2.2' fill='%23e8b57a' stroke='%236b3a12' stroke-width='0.6'/%3E%3Ccircle cx='7.4' cy='7.4' r='0.7' fill='%23fff1d6'/%3E%3C/g%3E%3C/svg%3E");
    --corner-tr: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cg transform='rotate%2890 16 16%29'%3E%3Cpath d='M3 27 V11 Q3 3 11 3 H27' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M8 21 Q8 8 21 8' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M27 3 q3 0 3 3 q0 2.5 -2.5 2.5' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 q0 3 3 3 q2.5 0 2.5 -2.5' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 V11 Q3 3 11 3 H27' stroke='%23e0a96d' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M8 21 Q8 8 21 8' stroke='%23e0a96d' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M27 3 q3 0 3 3 q0 2.5 -2.5 2.5' stroke='%23e0a96d' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 q0 3 3 3 q2.5 0 2.5 -2.5' stroke='%23e0a96d' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Ccircle cx='8.7' cy='8.7' r='2.4' fill='%231e1e1e'/%3E%3Ccircle cx='8' cy='8' r='2.2' fill='%23e8b57a' stroke='%236b3a12' stroke-width='0.6'/%3E%3Ccircle cx='7.4' cy='7.4' r='0.7' fill='%23fff1d6'/%3E%3C/g%3E%3C/svg%3E");
    --corner-br: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cg transform='rotate%28180 16 16%29'%3E%3Cpath d='M3 27 V11 Q3 3 11 3 H27' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M8 21 Q8 8 21 8' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M27 3 q3 0 3 3 q0 2.5 -2.5 2.5' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 q0 3 3 3 q2.5 0 2.5 -2.5' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 V11 Q3 3 11 3 H27' stroke='%23e0a96d' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M8 21 Q8 8 21 8' stroke='%23e0a96d' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M27 3 q3 0 3 3 q0 2.5 -2.5 2.5' stroke='%23e0a96d' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 q0 3 3 3 q2.5 0 2.5 -2.5' stroke='%23e0a96d' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Ccircle cx='8.7' cy='8.7' r='2.4' fill='%231e1e1e'/%3E%3Ccircle cx='8' cy='8' r='2.2' fill='%23e8b57a' stroke='%236b3a12' stroke-width='0.6'/%3E%3Ccircle cx='7.4' cy='7.4' r='0.7' fill='%23fff1d6'/%3E%3C/g%3E%3C/svg%3E");
    --corner-bl: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cg transform='rotate%28270 16 16%29'%3E%3Cpath d='M3 27 V11 Q3 3 11 3 H27' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M8 21 Q8 8 21 8' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M27 3 q3 0 3 3 q0 2.5 -2.5 2.5' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 q0 3 3 3 q2.5 0 2.5 -2.5' transform='translate%280.7 0.7%29' stroke='%231e1e1e' stroke-width='2.4' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 V11 Q3 3 11 3 H27' stroke='%23e0a96d' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M8 21 Q8 8 21 8' stroke='%23e0a96d' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M27 3 q3 0 3 3 q0 2.5 -2.5 2.5' stroke='%23e0a96d' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Cpath d='M3 27 q0 3 3 3 q2.5 0 2.5 -2.5' stroke='%23e0a96d' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3Ccircle cx='8.7' cy='8.7' r='2.4' fill='%231e1e1e'/%3E%3Ccircle cx='8' cy='8' r='2.2' fill='%23e8b57a' stroke='%236b3a12' stroke-width='0.6'/%3E%3Ccircle cx='7.4' cy='7.4' r='0.7' fill='%23fff1d6'/%3E%3C/g%3E%3C/svg%3E");
}
.entry-row { display: flex; justify-content: space-between; align-items: center; gap: var(--gap); }
.entry-title { font-size: 1.25rem; font-weight: 400; color: var(--quest-title); text-shadow: var(--gold-shadow); }
.points-0 { color: #727171; }
.points-1 { color: #348634; }
.points-mid { color: var(--gold-text); }
.points-high { color: var(--points-high); }
.clickable { cursor: pointer; }

.stats { display: grid; grid-template-columns: 0.8fr 0.8fr 1.2fr 1.2fr; text-align: center; }
.stats > div { display: flex; flex-direction: column; align-items: center; }
.stats .label { white-space: nowrap; }
/* Larger fonts: two rows, four columns don't fit the labels anymore */
html[data-font-size="1"] .stats, html[data-font-size="2"] .stats { grid-template-columns: 1fr 1fr; row-gap: 6px; }
.stat-value { font-size: 1.25rem; font-weight: 400; color: var(--gold-text); text-shadow: var(--gold-shadow); }
.charges { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; min-height: 27px; align-items: center; max-width: 80px; }
.charge { width: 10px; height: 10px; border-radius: 50%; border: 1px solid #7a7a7a; background: transparent; }
.charge.full {
    border-color: #8a6d00;
    background: radial-gradient(circle at 35% 35%, #fff7b0 0%, var(--gold) 45%, #a88f00 100%);
    box-shadow: 0 0 4px rgba(232, 232, 0, 0.6);
}
.label { font-size: 0.875rem; color: var(--text-muted); text-align: center; }
.hint { font-size: 0.875rem; text-align: center; margin-top: -5px; }
.small { font-size: 0.875rem; }
.overdue { color: var(--error); }
.due-today { color: var(--success); }
.error-text { color: var(--error); font-size: 0.875rem; text-align: center; }
.center { text-align: center; }

.btn {
    background: var(--btn-bg);
    color: var(--btn-text);
    border: 2px solid #9a9a9a;
    border-radius: 8px;
    font-weight: 400;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
    padding: 10px 14px;
    min-height: 44px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn img { width: 24px; height: 24px; filter: var(--btn-icon-filter); }
.btn-secondary { background: transparent; color: var(--text); text-shadow: none; }
.btn-danger { background: var(--danger); color: #ffffff; }
/* Secondary button for actions that can't be undone (leave guild, delete account) */
.btn-secondary.btn-warn { color: var(--error); }
.btn-link { background: transparent; color: var(--text); font-size: 0.875rem; border: none; box-shadow: none; text-shadow: none; }
.btn-toggle { background: transparent; color: var(--text); text-shadow: none; min-width: 44px; }
.btn-toggle.active { background: var(--btn-bg); color: var(--btn-text); text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8); }
.btn:disabled, .btn:disabled.active { background: var(--btn-disabled-bg); color: var(--btn-disabled-text); border-color: #7a7a7a; text-shadow: none; cursor: default; }
.btn:disabled img { filter: invert(0.8); }
.btn-quest { background: transparent; border: none; box-shadow: none; padding: 0 8px; min-width: 60px; }
.btn-icon { width: 44px; height: 44px; padding: 0; }
.quest-entry { flex-direction: row; align-items: stretch; gap: var(--gap); }
.quest-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.quest-entry > .btn-quest { align-self: center; }
.quest-due { flex-shrink: 0; text-align: right; }
.quest-mark {
    font-size: 72px;
    font-weight: 400;
    line-height: 1;
    color: var(--gold);
    -webkit-text-stroke: 1px #3a2a00;
    text-shadow: 0 0 6px rgba(255, 209, 0, 0.6), 2px 2px 2px rgba(0, 0, 0, 0.8);
}
.btn:not(.btn-quest) .quest-mark { font-size: 24px; -webkit-text-stroke: 0; }
/* The ? stays gold while its quest is locked (dialogs, saving) */
.btn-quest:disabled { background: transparent; border: none; }
/* Hand-in (Overview.FinishChore, 1.8s = HandInMs): the ? wobbles and hops, its color drains into a glow that fades, then the quest fades out */
.handing-in .quest-mark { display: inline-block; animation: quest-hand-in 1.8s ease-out forwards; }
.quest-entry.handing-in { animation: quest-handed-in 1.8s ease-in forwards; }
@keyframes quest-hand-in {
    0% { transform: none; }
    6% { transform: rotate(-12deg); }
    12% { transform: rotate(10deg); }
    18% { transform: rotate(-6deg); }
    24% { transform: none; }
    32% { transform: translateY(-18px) scale(1.12); }
    40% { transform: none; color: var(--gold); -webkit-text-stroke-color: #3a2a00; text-shadow: 0 0 6px rgba(255, 209, 0, 0.6), 2px 2px 2px rgba(0, 0, 0, 0.8); }
    65% { color: transparent; -webkit-text-stroke-color: transparent; text-shadow: 0 0 14px rgba(255, 209, 0, 0.95), 0 0 32px rgba(255, 209, 0, 0.7); }
    100% { transform: none; color: transparent; -webkit-text-stroke-color: transparent; text-shadow: 0 0 40px rgba(255, 209, 0, 0), 0 0 60px rgba(255, 209, 0, 0); }
}
@keyframes quest-handed-in {
    0%, 80% { opacity: 1; }
    100% { opacity: 0; }
}
.btn-row { display: flex; gap: 5px; }
.btn-row > .btn { flex: 1; }
.btn-row > .btn-icon { flex: 0 0 44px; }
.icon-btn { background: transparent; border: none; color: var(--text); font-size: 1.5rem; cursor: pointer; min-width: 44px; min-height: 44px; }
/* Medieval arrow with fletching, used as mask so it takes the text color */
.back-arrow {
    display: inline-block;
    width: 42px;
    height: 21px;
    background: currentColor;
    -webkit-mask: var(--arrow-mask) center / contain no-repeat;
    mask: var(--arrow-mask) center / contain no-repeat;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

.icon { width: 24px; height: 24px; filter: var(--icon-filter); transition: transform 0.2s; }
.icon.rotated { transform: rotate(90deg); }
.expand-arrow {
    width: 22px;
    height: 22px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23fff2a0'/%3E%3Cstop offset='0.5' stop-color='%23e8c400'/%3E%3Cstop offset='1' stop-color='%238c6a00'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M5 4 L21 12 L5 20 L9 12 Z' fill='url%28%23g%29' stroke='%233a2a00' stroke-width='1.1' stroke-linejoin='round'/%3E%3Cpath d='M5 4 L9 12 L21 12' fill='none' stroke='%23ffffff' stroke-opacity='0.45' stroke-width='0.8'/%3E%3C/svg%3E") center / contain no-repeat;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
    transition: transform 0.2s;
}
.expand-arrow.rotated { transform: rotate(90deg); }

input, textarea, select {
    width: 100%;
    background: transparent;
    color: var(--text);
    border: none;
    border-bottom: 1px solid var(--outline);
    padding: 8px 4px;
    font-family: inherit;
    font-size: 0.875rem;
}
select option { background: var(--bg); color: var(--text); }
input[type=checkbox] { width: auto; }
input.invalid, textarea.invalid { background: rgba(255, 0, 0, 0.5); }
.inline { display: flex; align-items: center; gap: 5px; justify-content: center; }
.inline input { width: auto; }
.inline label { white-space: nowrap; }
/* Long labels wrap instead of pushing the checkbox and info sign off small screens */
.inline.wrap label { white-space: normal; min-width: 0; }
.inline.wrap > :not(label) { flex-shrink: 0; }
.toggle-group { display: flex; flex-wrap: wrap; gap: 5px; justify-content: space-evenly; }
.divider { height: 1px; background: var(--outline); margin: 10px 20px; }

.tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    display: flex;
    justify-content: space-around;
    background: var(--surface);
    border-top: var(--frame-width) solid #8a8a8a;
    z-index: 50;
}
.tab { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); text-decoration: none; font-size: 0.8125rem; }
/* Long labels (e.g. "Guild Council") are cut instead of wrapping on narrow phones */
.tab > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab img { width: 28px; height: 28px; filter: var(--icon-filter); opacity: 0.6; }
.tab.active { color: var(--text); }
.tab.active img { opacity: 1; }
.tab .quest-mark { font-size: 30px; -webkit-text-stroke: 1px #3a2a00; filter: var(--tab-glow); }
.tab .quest-mark, .tab .tab-icon { opacity: 0.6; }
.tab.active .quest-mark, .tab.active .tab-icon { opacity: 1; }
/* PNG line icons used as mask, filled with a gradient */
.tab-icon { width: 28px; height: 28px; filter: var(--tab-glow); }
.tab-icon::before {
    content: "";
    display: block;
    width: 100%;
    height: 100%;
    background: var(--icon-fill);
    -webkit-mask: var(--icon-mask) center / contain no-repeat;
    mask: var(--icon-mask) center / contain no-repeat;
}
.tab-icon.papyrus { --icon-mask: url('../images/tabbar_reports.png'); --icon-fill: linear-gradient(160deg, #f7ebc4 0%, #e0c98f 45%, #c4a265 100%); }
.tab-icon.habit { --icon-mask: url('../images/tabbar_habit.png'); --icon-fill: linear-gradient(160deg, #e86a5a 0%, #b22222 50%, #6e0f0f 100%); }
.tab-action { background: none; border: none; font-family: inherit; cursor: pointer; padding: 0; }
.tab-icon.metal { --icon-mask: url('../images/tabbar_settings.png'); --icon-fill: var(--frame); }
.tab-icon.gavel { --icon-mask: url('../images/tabbar_council.svg'); --icon-fill: var(--bronze); }
.tab-icon.helmet { --icon-mask: url('../images/tabbar_character.svg'); --icon-fill: var(--frame); }
.btn .tab-icon { width: 22px; height: 22px; }

/* Council: votes for (green, left) and against (red, right), the line marks the 50% a proposal needs */
.vote-bar { position: relative; display: flex; justify-content: space-between; height: 10px; border-radius: 5px; overflow: hidden; background: var(--outline); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5); }
.vote-for { background: linear-gradient(180deg, #5fd14a, #2e8f1f); }
.vote-against { background: linear-gradient(180deg, #f06a5f, #a8231a); }
.vote-mark { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--text); opacity: 0.7; }
.vote-for-text { color: #3aa52a; }
.vote-against-text { color: var(--error); }
.vote-needed { color: var(--quest-title); text-shadow: var(--gold-shadow); }
.proposal-entry, .proposal-form { gap: 6px; }
/* Guild council hall behind the page: pillars at the sides, ashlar wall between (fading out), round table at the bottom */
.council-hall {
    position: fixed;
    top: 0;
    bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px));
    left: 50%;
    width: min(100%, 560px);
    transform: translateX(-50%);
    z-index: -1;
    pointer-events: none;
    opacity: 0.55;
    background:
        url('../images/council_table.svg') bottom center / 100% auto no-repeat,
        url('../images/council_pillar.svg') left -22px top / 44px 100% no-repeat,
        url('../images/council_pillar.svg') right -22px top / 44px 100% no-repeat;
}
/* Own stacking context, otherwise the body background is painted over the hall (z-index -1) */
.content:has(> .council-hall) { isolation: isolate; }
.council-hall::before {
    content: "";
    position: absolute;
    inset: 0 16px;
    z-index: -1;
    background: url('../images/council_wall.svg') top center / 120px 64px repeat;
    /* Faint on light backgrounds, the wall would otherwise look like a grey veil */
    opacity: 0.45;
    -webkit-mask-image: linear-gradient(transparent, #000 45%, #000 70%, transparent);
    mask-image: linear-gradient(transparent, #000 45%, #000 70%, transparent);
}
@media (prefers-color-scheme: dark) {
    .council-hall { opacity: 0.45; }
    .council-hall::before { opacity: 1; }
}
.proposal-change { font-weight: bold; }

.guild-heroes .hero-name { display: inline-flex; align-items: center; gap: 6px; }
.leader-crown { width: 20px; height: 15px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6)); }

.loading { display: flex; flex-direction: column; align-items: center; margin-top: 100px; font-size: 1.25rem; text-align: center; }
.spinner { width: 70px; height: 70px; border: 6px solid var(--outline); border-top-color: var(--gold); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.dialog-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.dialog { width: 100%; max-width: 400px; --frame-fill: var(--bg); }
.dialog h2 { text-align: left; }
.dialog-message { white-space: pre-line; }
/* Text the heroes typed in (reasons, change requests), same green as easy quests */
.user-text { color: #348634; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 5px; margin-top: 10px; }
.dialog-note { margin-right: auto; align-self: flex-end; font-size: 0.75rem; color: var(--text-muted); }

.expand-list { display: flex; flex-direction: column; gap: 5px; }
.expand-head { display: flex; align-items: center; gap: 10px; background: transparent; border: none; color: var(--text); font-family: inherit; font-size: 1.125rem; cursor: pointer; padding: 5px 0; }
.expand-content { display: flex; flex-direction: column; gap: 5px; }
/* Entries fly in one after another, --i is the entry index. Not "both": a kept transform / opacity makes every entry its own layer and the next entry covers open tooltips */
.expand-content > * { animation: fly-in 0.3s cubic-bezier(0.33, 1, 0.68, 1) backwards, fade-in 0.4s backwards; animation-delay: calc(var(--i, 0) * 0.1s); }
/* An open tooltip (InfoTip / LockedButton) lifts its entry above the following ones */
.expand-content > :has(.info-bubble) { position: relative; z-index: 61; }
@keyframes fly-in { from { transform: translateX(-100vw); } to { transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.search { position: relative; }
.bug-btn {
    position: fixed;
    right: calc(var(--fab-gap) + env(safe-area-inset-right, 0px));
    bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px) + var(--ad-room, 0px) + var(--fab-gap));
    z-index: 40;
    width: var(--fab-size);
    height: var(--fab-size);
    border-radius: 50%;
    border: 2px solid #9a9a9a;
    background: var(--btn-bg);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    font-size: 26px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Notification settings: topic | one checkbox column per channel */
.notify-grid { display: grid; gap: 8px 14px; align-items: center; justify-items: center; }
.notify-grid .settings-label { justify-self: start; }
.notify-head { display: inline-flex; align-items: center; gap: 4px; font-size: 0.875rem; color: var(--text-muted); }
.search-results { border: 1px solid var(--outline); border-radius: 0 0 var(--radius) var(--radius); background: var(--surface); }
.search-results div { padding: 10px; cursor: pointer; }

.scroll-list { max-height: 400px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }

.distribution h2 { margin-bottom: 5px; }
.distribution-bar { display: flex; height: 40px; border-radius: var(--radius); overflow: hidden; box-shadow: 0 0 0 2px #8a8a8a, 0 2px 5px rgba(0, 0, 0, 0.45); }
.distribution-part { display: flex; align-items: center; justify-content: center; color: #ffffff; font-size: 0.875rem; overflow: hidden; white-space: nowrap; padding: 0 4px; text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -2px 3px rgba(0, 0, 0, 0.3); }

/* Paper pages: dark text and translucent cards on papyrus */
.parchment, .scroll-sheet {
    --text: #3b2a14;
    --text-muted: #6b5233;
    --outline: #a8834a;
    --surface: rgba(255, 248, 225, 0.35);
    --icon-filter: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: var(--gap);
}
:is(.parchment, .scroll-sheet) :is(.entry-title, h1, h2) { text-shadow: none; }
:is(.parchment, .scroll-sheet) .due-today { color: #2e6b1f; }
/* Council colors darkened for the light paper */
:is(.parchment, .scroll-sheet) :is(.vote-for-text, .user-text) { color: #1f5a14; font-weight: 600; }
:is(.parchment, .scroll-sheet) .vote-against-text { color: #8a1c14; font-weight: 600; }
:is(.parchment, .scroll-sheet) :is(.vote-needed, .proposal-entry .entry-title) { color: #7a5c00; text-shadow: none; font-weight: 600; }
:is(.parchment, .scroll-sheet) select option { background: #f6e8c0; color: #3b2a14; }

/* Quest details: papyrus sheet, light center darkening to the edges, torn edge via clip-path */
.parchment-shadow { filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.55)); }
.parchment {
    padding: 22px 18px;
    background:
        radial-gradient(ellipse at center, #f6e8c0 0%, #ead39b 55%, #cfae6c 85%, #a9834a 100%);
    clip-path: polygon(0% 2.3px, 3% 1.1px, 6% 4.6px, 9% 0.5px, 12% 3.8px, 15% 2.6px, 18% 0.4px, 21% 3.6px, 24% 0.3px, 27% 3.0px, 30% 0.5px, 33% 0.6px, 36% 3.0px, 39% 5.8px, 42% 0.9px, 45% 1.6px, 48% 4.4px, 51% 6.6px, 54% 4.0px, 57% 2.8px, 60% 6.8px, 63% 0.3px, 66% 6.0px, 69% 2.0px, 72% 1.0px, 75% 0.8px, 78% 2.2px, 81% 5.7px, 84% 1.3px, 87% 4.1px, 90% 4.5px, 93% 2.6px, 96% 3.8px, 99% 0.4px, calc(100% - 0.4px) 3%, calc(100% - 1.4px) 6%, calc(100% - 4.8px) 9%, calc(100% - 3.0px) 12%, calc(100% - 2.2px) 15%, calc(100% - 4.1px) 18%, calc(100% - 3.2px) 21%, calc(100% - 2.1px) 24%, calc(100% - 5.6px) 27%, calc(100% - 4.9px) 30%, calc(100% - 1.7px) 33%, calc(100% - 4.0px) 36%, calc(100% - 3.7px) 39%, calc(100% - 6.1px) 42%, calc(100% - 5.1px) 45%, calc(100% - 2.0px) 48%, calc(100% - 6.9px) 51%, calc(100% - 0.8px) 54%, calc(100% - 2.9px) 57%, calc(100% - 5.3px) 60%, calc(100% - 1.1px) 63%, calc(100% - 3.4px) 66%, calc(100% - 0.3px) 69%, calc(100% - 4.7px) 72%, calc(100% - 5.4px) 75%, calc(100% - 4.0px) 78%, calc(100% - 6.1px) 81%, calc(100% - 2.2px) 84%, calc(100% - 4.9px) 87%, calc(100% - 4.2px) 90%, calc(100% - 4.1px) 93%, calc(100% - 3.2px) 96%, calc(100% - 5.9px) 99%, 100% calc(100% - 6.6px), 97% calc(100% - 3.3px), 94% calc(100% - 4.6px), 91% calc(100% - 0.4px), 88% calc(100% - 4.9px), 85% calc(100% - 4.5px), 82% calc(100% - 7.0px), 79% calc(100% - 5.8px), 76% calc(100% - 2.0px), 73% calc(100% - 2.7px), 70% calc(100% - 4.7px), 67% calc(100% - 0.2px), 64% calc(100% - 3.2px), 61% calc(100% - 1.2px), 58% calc(100% - 0.8px), 55% calc(100% - 0.4px), 52% calc(100% - 5.4px), 49% calc(100% - 0.9px), 46% calc(100% - 1.7px), 43% calc(100% - 2.7px), 40% calc(100% - 6.1px), 37% calc(100% - 0.6px), 34% calc(100% - 3.1px), 31% calc(100% - 3.8px), 28% calc(100% - 6.2px), 25% calc(100% - 5.7px), 22% calc(100% - 6.0px), 19% calc(100% - 1.9px), 16% calc(100% - 2.9px), 13% calc(100% - 2.5px), 10% calc(100% - 6.2px), 7% calc(100% - 6.7px), 4% calc(100% - 1.1px), 1% calc(100% - 1.2px), 1.6px 97%, 1.6px 94%, 3.4px 91%, 4.1px 88%, 1.8px 85%, 0.0px 82%, 2.9px 79%, 2.6px 76%, 4.0px 73%, 6.7px 70%, 4.8px 67%, 3.6px 64%, 4.3px 61%, 4.7px 58%, 0.4px 55%, 6.3px 52%, 5.5px 49%, 6.1px 46%, 5.6px 43%, 2.7px 40%, 2.8px 37%, 0.7px 34%, 4.4px 31%, 0.4px 28%, 0.5px 25%, 1.5px 22%, 1.1px 19%, 2.4px 16%, 0.4px 13%, 0.0px 10%, 1.1px 7%, 0.7px 4%, 2.5px 1%);
}
.parchment .card { padding: 18px 24px; }

/* Achievements: scroll with rolled ends, sheet curving towards the sides, crest with laurel */
.scroll { position: relative; margin: 14px 4px; }
.scroll::before, .scroll::after {
    content: "";
    position: absolute;
    left: -10px;
    right: -10px;
    height: 24px;
    border-radius: 12px;
    background: linear-gradient(180deg, #6e5028 0%, #c9a868 22%, #f7ead0 48%, #e2c58c 70%, #8a6a3a 100%);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(60, 40, 15, 0.5);
    z-index: 1;
}
.scroll::before { top: -12px; }
.scroll::after { bottom: -12px; }
.scroll-sheet {
    position: relative;
    padding: 30px 20px;
    background: linear-gradient(90deg, #b8955a 0%, #e4cc96 7%, #f4e6c2 20%, #f8ecce 50%, #f4e6c2 80%, #e4cc96 93%, #b8955a 100%);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}
.crest {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 64px;
    height: 64px;
    background: var(--crest) center / contain no-repeat;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45));
    pointer-events: none;
}
/* Ink drawn boxes instead of the silver frames, so they belong to the paper */
.scroll-sheet :is(.card, .entry) {
    background: rgba(110, 80, 35, 0.08);
    border: 1px solid rgba(107, 82, 51, 0.45);
    box-shadow: inset 0 1px 3px rgba(80, 55, 20, 0.25);
}

/* Shown when all daily quests are done */
.celebration { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0; text-align: center; }
.celebration-crest {
    width: 76px;
    height: 76px;
    background: var(--crest) center / contain no-repeat;
    filter: drop-shadow(0 0 8px rgba(232, 232, 0, 0.55));
    animation: celebrate-swing 2.4s ease-in-out infinite;
}
.celebration-title {
    font-size: 1.75rem;
    color: var(--gold-text);
    animation: celebrate-glow 2.4s ease-in-out infinite;
}
@keyframes celebrate-swing {
    0%, 100% { transform: scale(1) rotate(-4deg); }
    50% { transform: scale(1.08) rotate(4deg); }
}
@keyframes celebrate-glow {
    0%, 100% { text-shadow: var(--gold-shadow), 0 0 4px rgba(232, 232, 0, 0.35); }
    50% { text-shadow: var(--gold-shadow), 0 0 14px rgba(232, 232, 0, 0.9); }
}
/* MedievalSharp has no bold cut, a thin stroke in the text color thickens the letters instead */
.achievement-name { font-size: 1.0625rem; -webkit-text-stroke: 0.5px currentColor; }

/* Points per day: stacked bars per hero, sundays slightly shaded */
.timeline h2 { margin-bottom: 5px; }
.timeline-chart { display: flex; gap: 2px; }
.timeline-day { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch; }
.timeline-slot { height: 120px; display: flex; flex-direction: column; justify-content: flex-end; border-bottom: 2px solid var(--outline); }
.timeline-day.sunday .timeline-slot { background: rgba(107, 82, 51, 0.12); border-radius: 3px 3px 0 0; }
.timeline-bar {
    display: flex;
    flex-direction: column-reverse;
    min-height: 3px;
    border-radius: 3px 3px 0 0;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.35);
}
.timeline-part { min-height: 1px; }
.timeline-day { cursor: pointer; }
.timeline-day.selected .timeline-slot { background: rgba(232, 232, 0, 0.18); border-radius: 3px 3px 0 0; }
.timeline-day.selected .timeline-bar { box-shadow: 0 0 0 2px var(--text), 0 1px 3px rgba(0, 0, 0, 0.5); }
.timeline-detail { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 4px 12px; margin-top: 8px; padding: 6px 8px; font-size: 0.875rem; border: 1px solid rgba(107, 82, 51, 0.45); border-radius: 6px; background: rgba(110, 80, 35, 0.08); }
.timeline-detail .achievement-name { flex-basis: 100%; text-align: center; }
.timeline-label { height: 18px; font-size: 13px; text-align: center; color: var(--text-muted); white-space: nowrap; overflow: visible; }
.timeline-swatch { display: inline-block; width: 12px; height: 12px; margin-right: 4px; border-radius: 2px; vertical-align: -1px; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4); }

/* Pull to refresh: gold arrow points down, turns up when far enough, spins while loading */
.ptr { display: flex; flex-direction: column; gap: var(--gap); }
.ptr-indicator { height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; transition: height 0.2s; }
.ptr-indicator.pulling { transition: none; }
.ptr-indicator .expand-arrow { transform: rotate(90deg); transition: transform 0.2s; }
.ptr-indicator.ready .expand-arrow { transform: rotate(-90deg); }
.ptr-indicator.loading .expand-arrow { animation: spin 0.8s linear infinite; }
.updating { text-align: center; font-size: 0.875rem; color: var(--text-muted); }

/* Calendar leaves to visualize due dates */
.date-move { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 10px 0; }
.date-move-arrow { display: inline-block; width: 42px; height: 21px; background: var(--gold); transform: rotate(180deg); -webkit-mask: var(--arrow-mask) center / contain no-repeat; mask: var(--arrow-mask) center / contain no-repeat; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5)); }
.date-leaf { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.date-leaf-caption { font-size: 0.875rem; color: var(--text-muted); }
.date-leaf-sheet {
    width: 84px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 6px;
    border-radius: 6px;
    overflow: hidden;
    color: #3b2a14;
    background: linear-gradient(180deg, #f8ecce 0%, #e8d3a0 100%);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(107, 82, 51, 0.5);
}
.date-leaf-month { align-self: stretch; text-align: center; padding: 2px 0; font-size: 0.875rem; color: var(--gold); background: var(--btn-bg); text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8); }
.date-leaf-day { font-size: 2.125rem; line-height: 1.1; }
.date-leaf-weekday { font-size: 0.8125rem; }

/* Finished quests in the details: hero, points, completion and a status badge */
.finish-entry { gap: 6px; }
.finish-points { font-size: 1.0625rem; color: var(--quest-title); text-shadow: var(--gold-shadow); }
.parchment .finish-points { color: #7a5c00; text-shadow: none; }
.finish-due { color: var(--text-muted); }
.status-badge { padding: 1px 10px; border-radius: 10px; font-size: 0.8125rem; color: #ffffff; text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.7); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.4); white-space: nowrap; }
/* Item rarity colors: rare when on time, epic when early, poor (scrap) when late */
.status-ontime { background: var(--rarity-rare); }
.status-late { background: var(--rarity-poor); }
.status-early { background: var(--rarity-epic); }
.status-uncommon { background: var(--rarity-uncommon); color: #102a00; text-shadow: none; }
.status-common { background: var(--rarity-common); color: #2a2a2a; text-shadow: none; }

/* Completion counts in the quest details */
.quest-stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; margin-top: 4px; }
.quest-stats > div { display: flex; flex-direction: column; align-items: center; }
.parchment .stat-value { color: #7a5c00; text-shadow: none; }

/* Settings: labels left, equally wide fields right */
.settings-grid { display: grid; grid-template-columns: 1fr 120px; gap: 8px 12px; align-items: center; }
.settings-grid input { width: 100%; }
.settings-label { display: flex; align-items: center; gap: 6px; text-align: left; }
.settings-label.centered { justify-content: center; }
.field-label { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 0.875rem; color: var(--text-muted); }
.form-heading { font-size: 1.25rem; color: var(--text); margin-top: 6px; }

/* Info sign with explanation bubble (InfoTip / TooltipService) */
.info-tip { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; }
.info-icon {
    width: 18px;
    height: 18px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid #8a6d00;
    font-family: Georgia, serif;
    font-size: 12px;
    font-style: italic;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #3a2a00;
    background: radial-gradient(circle at 35% 30%, #fff2a0 0%, var(--gold) 55%, #a88f00 100%);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}
.info-bubble {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    /* --shift: set by tooltip.js when the bubble would leave the screen */
    transform: translateX(calc(-50% + var(--shift, 0px)));
    z-index: 60;
    width: max-content;
    max-width: min(220px, calc(100vw - 16px));
    padding: 8px 10px;
    font-size: 0.875rem;
    line-height: 1.3;
    text-align: left;
    color: #3b2a14;
    background: linear-gradient(180deg, #f8ecce 0%, #e8d3a0 100%);
    border: 1px solid rgba(107, 82, 51, 0.6);
    border-radius: 6px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
}
.info-bubble.start { left: 0; transform: translateX(var(--shift, 0px)); }
/* Greyed out button that explains itself on tap (LockedButton) */
.btn.locked { background: var(--btn-disabled-bg); color: var(--btn-disabled-text); border-color: #7a7a7a; text-shadow: none; cursor: help; }
.btn.locked img { filter: invert(0.8); }
/* Hero and points of a finish as big as quest names */
.finish-entry .achievement-name, .finish-entry .finish-points { font-size: 1.25rem; }

/* Setup: answers as selectable cards */
.setup { gap: 10px; }
.setup h1 { text-align: center; }
.option-list { display: flex; flex-direction: column; gap: 8px; }
.option-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px 12px;
    text-align: left;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid var(--outline);
    border-radius: var(--radius);
    cursor: pointer;
}
.option-card.selected { border-color: var(--gold); box-shadow: 0 0 6px rgba(232, 232, 0, 0.25); background: rgba(255, 255, 255, 0.07); }

/* Guild banner / knight helmet / rotation arrows in front of owners and card headings */
.owner-tag { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; }
/* A name without breaks is cut instead of pushing the row wider */
.owner-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.owner-icon { display: inline-block; flex-shrink: 0; width: 18px; height: 18px; background: center / contain no-repeat; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5)); }
.owner-icon.guild { background-image: url('../images/guild.svg'); }
.owner-icon.personal { background-image: url('../images/personal.svg'); }
.owner-icon.rotation { background-image: url('../images/rotation.svg'); }
h2 .owner-icon { width: 26px; height: 26px; margin-right: 8px; vertical-align: -4px; }

/* Character page: XP / health bars left of the level badge, portrait in the middle, today's quota at the bottom */
.character-sheet { display: flex; flex-direction: column; gap: 14px; }
.character-top { display: flex; align-items: flex-start; gap: 10px; }
.character-bars { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.level-badge {
    width: 68px;
    height: 68px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: var(--frame-width) solid transparent;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #2c2c2c, #111) padding-box, var(--frame) border-box;
    box-shadow: var(--frame-shadow);
    color: var(--gold);
    text-shadow: 1px 1px 1px #000;
}
.level-badge small { font-size: 13px; color: #d8d8d8; }
.level-badge span { font-size: 28px; }

.stat-bar {
    position: relative;
    height: 22px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid var(--bar-border);
    background: var(--bar-bg);
    box-shadow: var(--bar-shadow);
}
.stat-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--fill);
    background: var(--bar);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -3px 4px rgba(0, 0, 0, 0.35);
    transition: width 0.8s ease-out;
}
/* Thin marks between the sections, the last one sits under the border */
.stat-ticks {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(90deg, transparent 0 calc(100% / var(--segments) - 1px), rgba(0, 0, 0, 0.55) calc(100% / var(--segments) - 1px) calc(100% / var(--segments)));
}
.stat-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 0 2px #000, 1px 1px 1px #000;
    white-space: nowrap;
}
.stat-bar.xp { --bar: linear-gradient(180deg, #f7e36a 0%, #c9a316 55%, #8a6a07 100%); }
.stat-bar.hp { --bar: linear-gradient(180deg, #ff5a4f 0%, #c01d12 55%, #7a0b05 100%); }
.stat-bar.quota { --bar: linear-gradient(180deg, #7ee26c 0%, #33a321 55%, #1d6512 100%); }
/* Exactly the day's quests: silver, more than that: gold with a light sweep */
.stat-bar.done { --bar: linear-gradient(180deg, #ffffff 0%, #c4c4c4 45%, #6e6e6e 100%); border-color: #5c5c5c; box-shadow: 0 0 6px rgba(220, 220, 220, 0.45), inset 0 2px 4px rgba(0, 0, 0, 0.5); }
.stat-bar.done .stat-text { color: #1e1e1e; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7); }
.stat-bar.full { --bar: linear-gradient(180deg, #fff3a0 0%, #e8c21a 45%, #9a7409 100%); border-color: #8a6a07; box-shadow: 0 0 8px rgba(232, 200, 0, 0.6), inset 0 2px 4px rgba(0, 0, 0, 0.5); }
.stat-bar.full .stat-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%);
    background-size: 200% 100%;
    animation: stat-shine 2.6s linear infinite;
}
@keyframes stat-shine { from { background-position: 150% 0; } to { background-position: -50% 0; } }

/* Questlog: today's XP above the stats */
.daily-progress { display: flex; flex-direction: column; gap: 4px; }

.buff-row { display: flex; flex-wrap: wrap; gap: 4px; min-height: 28px; }
.buff {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #c9a316;
    border-radius: 4px;
    /* Light glow behind the icon, the dark outlines of the icons stay visible */
    background: radial-gradient(circle, rgba(255, 243, 214, 0.6) 0, rgba(255, 243, 214, 0) 95%), #1b1b1b;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    position: relative;
    padding: 0;
    cursor: pointer;
}
.buff img { width: 22px; height: 22px; }
.buff-stacks {
    position: absolute;
    right: -4px;
    bottom: -5px;
    min-width: 14px;
    padding: 0 2px;
    border-radius: 7px;
    background: #1b1b1b;
    border: 1px solid #c9a316;
    color: #f6d04d;
    font-size: 10px;
    font-weight: bold;
    line-height: 12px;
    text-align: center;
}
.buff.full { box-shadow: 0 0 6px 1px rgba(246, 208, 77, 0.8); }
.buff-details ul { margin: 0 0 8px; padding-left: 18px; }
.buff-details p { margin: 0 0 8px; }
.buff-until { opacity: 0.75; font-size: 0.9em; }

/* Plain frame around the portrait, empty for now: black in dark mode, white in light mode */
/* Equipment slots | hero | arena door */
.character-stage { display: grid; grid-template-columns: 48px minmax(0, 1fr) 64px; gap: 10px; align-items: stretch; }
.equip-slots { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; }
/* Stats on top, arena door at the bottom next to the portrait */
.character-side { display: flex; flex-direction: column; justify-content: space-between; align-items: center; gap: 10px; }
.item-slot {
    width: 46px;
    height: 46px;
    padding: 7px;
    border: 2px solid var(--slot-border);
    border-radius: 6px;
    background: var(--slot-bg);
    box-shadow: var(--slot-shadow);
    cursor: pointer;
}
.slot-icon { width: 100%; height: 100%; display: block; fill: var(--slot-icon); opacity: 0.16; }
/* The hero keeps its size (226px = full width of the page) while the frame narrows, only then it shrinks; the frame's height follows the hero */
.character-portrait {
    width: 100%;
    border: var(--frame-width) solid transparent;
    border-radius: var(--radius);
    background: linear-gradient(var(--bg), var(--bg)) padding-box, var(--frame) border-box;
    box-shadow: var(--frame-shadow);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 48px 4px 0;
    overflow: hidden;
    position: relative;
}
.character-portrait .buff-row { position: absolute; top: 6px; left: 6px; right: 6px; z-index: 1; justify-content: flex-end; min-height: 0; }
/* Hero with the worn items on top, all images share the 120x160 figure coordinates. Items stay within x 16-105 (pauldrons, sword),
   so the frame may cut up to 11% of the figure on each side (100% / 128%) before the hero shrinks. */
.hero-stack { position: relative; flex-shrink: 0; width: min(128%, 226px); aspect-ratio: 3 / 4; }
.hero-stack > * { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-edit { align-self: center; }
/* margin-top auto: the bag sits right above the arena door, not in the middle of the column */
.bag-button { position: relative; width: 52px; height: 58px; margin-top: auto; padding: 0 0 8px; border: none; background: none; cursor: pointer; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
.bag-button svg { width: 100%; height: 100%; display: block; }
.bag-button .arena-sign { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); white-space: nowrap; }
.bag-slots { display: grid; grid-template-columns: repeat(5, 46px); gap: 8px; justify-content: center; }
.bag-empty { grid-column: 1 / -1; margin: 4px 0 0; text-align: center; font-size: 0.8125rem; opacity: 0.8; }
.hero-editor { gap: 8px; }
/* Rows of five */
.look-choices { display: grid; grid-template-columns: repeat(5, 44px); gap: 8px; justify-content: center; }
.look-choice {
    width: 44px;
    height: 44px;
    padding: 2px;
    border: 2px solid var(--outline);
    border-radius: 8px;
    background: var(--bg);
    cursor: pointer;
}
.look-choice.swatch { background: var(--swatch) content-box; }
.look-choice.face .hero-figure { width: 100%; height: 100%; display: block; }
.look-choice.selected { border-color: var(--gold); box-shadow: 0 0 0 2px var(--primary), 0 0 8px rgba(232, 232, 0, 0.6); }
.character-name { align-self: center; font-size: 1.375rem; margin-top: -6px; }

/* Arena door: same size and shadow as the other figures on the page */
.arena-door { position: relative; width: 58px; height: 70px; padding: 0; border: none; background: none; cursor: pointer; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
.arena-door svg { width: 100%; height: 100%; display: block; }
.arena-door .arena-sign { position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%); }
.arena-sign {
    height: fit-content;
    padding: 1px 5px;
    border-radius: 3px;
    background: #d8c18a;
    color: #3a2a10;
    font-family: var(--font-medieval);
    font-size: 11px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}


/* Tutorial (TutorialHost, js/tutorial.js): shades around the lit element, below dialogs (100) and celebrations (150) */
.tutorial-shade { position: fixed; z-index: 90; background: rgba(0, 0, 0, 0.72); touch-action: none; }
.tutorial-frame {
    position: fixed;
    z-index: 90;
    pointer-events: none;
    border-radius: var(--radius);
    box-shadow: 0 0 0 2px var(--gold), 0 0 14px 2px rgba(232, 232, 0, 0.5);
    animation: tutorial-glow 1.6s ease-in-out infinite alternate;
}
@keyframes tutorial-glow { from { box-shadow: 0 0 0 2px var(--gold), 0 0 6px 0 rgba(232, 232, 0, 0.35); } to { box-shadow: 0 0 0 2px var(--gold), 0 0 18px 4px rgba(232, 232, 0, 0.6); } }
.tutorial-box {
    position: fixed;
    z-index: 95;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: min(calc(100% - 24px), var(--max-width));
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--bg);
    border: 2px solid var(--gold-text);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.tutorial-box.at-top { bottom: auto; top: calc(12px + env(safe-area-inset-top, 0px)); }
.tutorial-box p { margin: 0; }
/* What to do now, on its own line after the explanation */
.tutorial-action { display: block; color: var(--gold-text); }
.tutorial-text + .tutorial-action { margin-top: 4px; }
.tutorial-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.tutorial-actions .small { margin-right: auto; color: var(--text-muted); }

/* Celebrations (CelebrationHost): one overlay, the kind class picks the animation */
.celebrate-overlay {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.7);
    animation: fade-in 0.3s both;
    cursor: pointer;
}
.celebrate-fx { position: absolute; inset: 0; pointer-events: none; }
.celebrate-stage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px; max-width: 360px; text-align: center; }
.celebrate-title { font-size: 2.125rem; color: var(--gold); text-shadow: 0 0 12px rgba(232, 232, 0, 0.8), 1px 1px 1px #000; animation: celebrate-pop 0.6s 0.3s both; }
.celebrate-text { color: #f0f0f0; font-size: 1rem; text-shadow: 0 0 4px #000, 1px 1px 1px #000; animation: fade-in 0.6s 0.6s both; }
.celebrate-hint { color: #b0b0b0; font-size: 0.75rem; margin-top: 12px; text-shadow: 0 0 4px #000; animation: fade-in 0.6s 1.5s both; }
/* Dark soft plate behind title and text, so rays, sparks and the grin don't run through the letters */
.celebrate-caption {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 0 -40px;
    padding: 18px 48px;
    background: radial-gradient(ellipse closest-side, rgba(0, 0, 0, 0.8) 0, rgba(0, 0, 0, 0.65) 60%, transparent 100%);
}
.celebrate-crest { display: block; width: 110px; height: 110px; background: var(--crest) center / contain no-repeat; filter: drop-shadow(0 0 12px rgba(232, 232, 0, 0.7)); }
.celebrate-badge {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 6px solid transparent;
    border-radius: 18px;
    background: linear-gradient(180deg, #2c2c2c, #0e0e0e) padding-box, var(--frame) border-box;
    color: var(--gold);
    font-size: 54px;
    text-shadow: 1px 1px 2px #000;
}
.celebrate-badge small { font-size: 1.25rem; color: #d8d8d8; }
.celebrate-crack { display: none; }

/* Sparks fly out of the middle, --n spreads them around */
.celebrate-sparks { position: absolute; inset: 0; pointer-events: none; }
.celebrate-sparks span {
    position: absolute;
    left: 50%;
    top: 42%;
    width: var(--s);
    height: var(--s);
    margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 8px var(--gold);
    opacity: 0;
    animation: celebrate-spark var(--t) calc(0.3s + var(--w)) ease-out infinite;
}
/* --a angle, --d distance, --t duration, --w delay (CelebrationHost.Sparks): irregular, the loops drift apart */
@keyframes celebrate-spark {
    0% { opacity: 0; transform: rotate(var(--a)) translateY(-40px) scale(1); }
    10% { opacity: 1; }
    100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(-1 * var(--d))) scale(0.2); }
}

/* Turning light rays behind the stage: a square with a round mask, so turning never shows its corners */
.celebrate-rays {
    display: none;
    position: absolute;
    left: 50%;
    top: 42%;
    width: 720px;
    height: 720px;
    margin: -360px 0 0 -360px;
    pointer-events: none;
    --ray: rgba(232, 200, 60, 0.28);
    background: repeating-conic-gradient(var(--ray) 0 10deg, transparent 10deg 24deg);
    -webkit-mask: radial-gradient(circle closest-side, #000 0, transparent 85%);
    mask: radial-gradient(circle closest-side, #000 0, transparent 85%);
    animation: celebrate-rays 14s linear infinite, fade-in 0.8s both;
}
.level-up .celebrate-rays, .item-found .celebrate-rays, .buff-gained .celebrate-rays, .quests-done .celebrate-rays, .guild-done .celebrate-rays { display: block; }
.quests-done .celebrate-rays, .guild-done .celebrate-rays { --ray: rgba(232, 200, 60, 0.16); animation-duration: 24s, 0.8s; }
@keyframes celebrate-pop { 0% { opacity: 0; transform: scale(0.4); } 70% { opacity: 1; transform: scale(1.12); } 100% { transform: scale(1); } }

/* Level up: golden rays turn behind the badge, which rises up */
.level-up .celebrate-fx { background: radial-gradient(circle at 50% 42%, rgba(232, 200, 60, 0.3) 0, transparent 40%); animation: fade-in 0.8s both, celebrate-pulse-dark 3s 0.8s ease-in-out infinite; }
.level-up .celebrate-badge { animation: celebrate-rise 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) both, celebrate-badge-glow 2s 0.9s ease-in-out infinite; }
@keyframes celebrate-rays { to { transform: rotate(360deg); } }
@keyframes celebrate-rise { from { opacity: 0; transform: translateY(80px) scale(0.5); } to { opacity: 1; transform: none; } }
@keyframes celebrate-badge-glow { 0%, 100% { box-shadow: 0 0 12px rgba(232, 232, 0, 0.4); } 50% { box-shadow: 0 0 34px rgba(232, 232, 0, 0.95); } }

/* Level lost: red darkness closes in, the badge cracks, shakes and sinks */
.level-down { background: rgba(0, 0, 0, 0.85); }
.level-down .celebrate-fx {
    background: radial-gradient(circle at 50% 42%, transparent 20%, rgba(90, 0, 0, 0.55) 55%, rgba(0, 0, 0, 0.95) 100%);
    animation: fade-in 1.2s both, celebrate-pulse-dark 3s 1.2s ease-in-out infinite;
}
.level-down .celebrate-title { color: #c0281d; text-shadow: 0 0 14px rgba(160, 0, 0, 0.9), 1px 1px 1px #000; animation: celebrate-sink-in 1s 0.4s both; }
.level-down .celebrate-badge {
    color: #9a8a8a;
    filter: grayscale(0.7);
    animation: celebrate-shake 0.5s 0.2s both, celebrate-drop 1.2s 0.7s ease-in forwards;
}
.level-down .celebrate-crack {
    display: block;
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 47%, rgba(0, 0, 0, 0.9) 48%, rgba(190, 30, 20, 0.8) 49%, transparent 51%),
                linear-gradient(60deg, transparent 58%, rgba(0, 0, 0, 0.85) 59%, transparent 61%);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    animation: fade-in 0.2s 0.5s both;
}
.level-down .celebrate-sparks { display: none; }
@keyframes celebrate-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px) rotate(-3deg); }
    40% { transform: translateX(8px) rotate(3deg); }
    60% { transform: translateX(-5px) rotate(-2deg); }
    80% { transform: translateX(5px) rotate(1deg); }
}
@keyframes celebrate-drop { to { transform: translateY(14px) rotate(-4deg); } }
@keyframes celebrate-sink-in { from { opacity: 0; transform: translateY(-20px); letter-spacing: 8px; } to { opacity: 1; transform: none; } }
@keyframes celebrate-pulse-dark { 0%, 100% { opacity: 1; } 50% { opacity: 0.75; } }
/* The grin of the final boss: eyes above the badge, the mouth below the text */
.celebrate-grin {
    position: absolute;
    left: 50%;
    top: 50%;
    height: min(88vh, 620px);
    max-width: 100vw;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    animation: celebrate-grin-in 1.8s 0.9s ease-out forwards;
}
.grin-eye { fill: #d8b8ff; filter: drop-shadow(0 0 4px #9a6ad0) drop-shadow(0 0 10px #7a3ac0); }
.grin-pupil { fill: #0a0010; }
.grin-eye, .grin-pupil { transform-box: fill-box; transform-origin: center; animation: celebrate-eye-open 0.6s 1.3s both, celebrate-blink 5s 3s ease-in-out infinite; }
.grin-lips { fill: #0c0309; stroke: #7a3ac0; stroke-width: 1.5; filter: drop-shadow(0 0 6px rgba(150, 40, 90, 0.8)); }
.grin-teeth path { fill: rgba(216, 184, 255, 0.5); }
.grin-mouth { transform-box: fill-box; transform-origin: center top; animation: celebrate-grin-widen 1.4s 1.6s cubic-bezier(0.3, 1.4, 0.6, 1) both, celebrate-grin-breathe 4s 3s ease-in-out infinite; }
@keyframes celebrate-grin-in { to { opacity: 0.75; } }
@keyframes celebrate-eye-open { from { transform: scaleY(0.05); } to { transform: none; } }
@keyframes celebrate-blink { 0%, 92%, 100% { transform: none; } 96% { transform: scaleY(0.1); } }
@keyframes celebrate-grin-widen { from { transform: scale(0.6, 0.2); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes celebrate-grin-breathe { 0%, 100% { transform: none; } 50% { transform: scale(1.03, 1.08); } }

/* All own daily quests: the crest swings in */
.quests-done .celebrate-crest { animation: celebrate-pop 0.7s both, celebrate-swing 2.4s 0.7s ease-in-out infinite; }

/* All guild quests: a red banner with the crest unrolls from the top */
.celebrate-banner {
    width: 130px;
    height: 170px;
    display: flex;
    justify-content: center;
    padding-top: 20px;
    background: linear-gradient(180deg, #b01c1c, var(--primary-dark));
    border-top: 8px solid #8a6a07;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 85%, 0 100%);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.6);
    transform-origin: top;
    animation: celebrate-unroll 0.9s cubic-bezier(0.33, 1, 0.68, 1) both;
}
.celebrate-banner .celebrate-crest { width: 90px; height: 90px; animation: fade-in 0.5s 0.8s both; }
@keyframes celebrate-unroll { from { transform: scaleY(0); } to { transform: scaleY(1); } }

@media (prefers-reduced-motion: reduce) {
    .celebrate-overlay *, .celebrate-overlay { animation-duration: 0.01s !important; animation-iteration-count: 1 !important; }
    /* No wobble or hop, only the color fading into the glow */
    .handing-in .quest-mark { animation-name: quest-hand-in-calm; }
}
@keyframes quest-hand-in-calm {
    0% { color: var(--gold); text-shadow: 0 0 6px rgba(255, 209, 0, 0.6); }
    50% { color: transparent; -webkit-text-stroke-color: transparent; text-shadow: 0 0 14px rgba(255, 209, 0, 0.95), 0 0 32px rgba(255, 209, 0, 0.7); }
    100% { color: transparent; -webkit-text-stroke-color: transparent; text-shadow: 0 0 40px rgba(255, 209, 0, 0); }
}

/* Item rarity: --rarity is the color of the frame / name */
.rarity-0 { --rarity: var(--rarity-poor); }
.rarity-1 { --rarity: var(--rarity-common); }
.rarity-2 { --rarity: var(--rarity-uncommon); }
.rarity-3 { --rarity: var(--rarity-rare); }
.rarity-4 { --rarity: var(--rarity-epic); }
.rarity-5 { --rarity: var(--rarity-legendary); }
.rarity-6 { --rarity: var(--rarity-artifact); }
.rarity-7 { --rarity: var(--rarity-heirloom); }
.item-slot.rarity-1, .rarity-1 .item-card-image { --rarity: var(--rarity-common-frame); }
.item-slot.has-item { border-color: var(--rarity); box-shadow: var(--slot-shadow), 0 0 6px var(--rarity); padding: 2px; }
.item-image { position: relative; display: block; width: 100%; height: 100%; overflow: hidden; }
.item-image img { position: absolute; max-width: none; height: auto; }

/* Attack, defense and crit above the arena door */
.hero-stats { display: flex; flex-direction: column; gap: 6px; align-self: stretch; padding: 6px 4px; border-radius: 6px; background: rgba(0, 0, 0, 0.12); }
.hero-stats span { display: flex; align-items: center; justify-content: space-between; gap: 4px; font-family: var(--font-sans); font-size: 0.8125rem; font-weight: 600; white-space: nowrap; }
.hero-stats svg { width: 14px; height: 14px; flex-shrink: 0; fill: var(--text); opacity: 0.8; }
/* Raised by worn items or their bonuses */
.hero-stats .boosted { color: var(--stat-boosted); }
.hero-stats .boosted svg { fill: var(--stat-boosted); }

.item-card { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
.item-card-image { width: 72px; height: 72px; padding: 3px; border: 2px solid var(--rarity); border-radius: 8px; background: var(--slot-bg); box-shadow: 0 0 8px var(--rarity); }
.item-name { font-size: 1.125rem; color: var(--rarity); text-shadow: 0 1px 1px rgba(0, 0, 0, 0.7); }
/* White "common" would vanish on the light background */
.rarity-1 .item-name { color: var(--text); text-shadow: none; }
.item-rarity { font-size: 0.75rem; color: var(--text-muted); }
.item-stat { font-family: var(--font-sans); font-size: 0.8125rem; }
.item-stat .better { color: #2e9e2e; margin-left: 4px; }
.item-stat .worse { color: var(--error); margin-left: 4px; }
.item-bonus { font-family: var(--font-sans); font-size: 0.8125rem; color: #2e9e2e; }
.item-description { font-size: 0.8125rem; color: var(--text-muted); font-style: italic; }
.item-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.item-compare > div { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.item-compare-head { font-size: 0.8125rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

/* Item put on: the item in its rarity color, light of that color behind it */
.item-found .celebrate-fx { background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--rarity) 40%, transparent) 0, transparent 40%); animation: fade-in 0.8s both, celebrate-pulse-dark 3s 0.8s ease-in-out infinite; }
.item-found .celebrate-rays { --ray: color-mix(in srgb, var(--rarity) 30%, transparent); }
.celebrate-item {
    width: 130px;
    height: 130px;
    padding: 6px;
    border: 4px solid var(--rarity);
    border-radius: 16px;
    background: radial-gradient(circle at 50% 40%, #2c2c2c, #0e0e0e);
    box-shadow: 0 0 24px var(--rarity);
    animation: celebrate-pop 0.7s both;
}
.item-found .celebrate-sparks span { background: var(--rarity); box-shadow: 0 0 8px var(--rarity); }

/* Buff gained: its icon in a gold frame, golden light behind it */
.buff-gained .celebrate-fx { background: radial-gradient(circle at 50% 42%, rgba(246, 208, 77, 0.4) 0, transparent 40%); animation: fade-in 0.8s both, celebrate-pulse-dark 3s 0.8s ease-in-out infinite; }
.celebrate-buff {
    width: 120px;
    height: 120px;
    padding: 18px;
    box-sizing: border-box;
    border: 4px solid #c9a316;
    border-radius: 16px;
    background: radial-gradient(circle, rgba(255, 243, 214, 0.6) 0, rgba(255, 243, 214, 0) 95%), radial-gradient(circle at 50% 40%, #2c2c2c, #0e0e0e);
    box-shadow: 0 0 24px #f6d04d;
    animation: celebrate-pop 0.7s both;
}
.celebrate-buff img { width: 100%; height: 100%; }
.buff-gained .celebrate-sparks span { background: #f6d04d; box-shadow: 0 0 8px #f6d04d; }

/* Guild without combat: no stats and arena next to the portrait, the empty column mirrors the equipment slots so the hero stays centered */
.character-stage.no-combat { grid-template-columns: 48px minmax(0, 1fr) 48px; }

/* Arena: hinted fortress behind the page (jagged walls, spiked towers), fading out towards the top */
.arena-fortress {
    position: fixed;
    top: 0;
    bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px));
    left: 50%;
    width: min(100%, 560px);
    transform: translateX(-50%);
    z-index: -1;
    pointer-events: none;
    opacity: 0.4;
    background: url('../images/arena_fortress.svg') bottom center / 100% auto no-repeat;
    -webkit-mask-image: linear-gradient(transparent, #000 35%);
    mask-image: linear-gradient(transparent, #000 35%);
}
.content:has(> .arena-fortress) { isolation: isolate; }
@media (prefers-color-scheme: dark) {
    .arena-fortress { opacity: 0.5; }
}

.arena-list { display: flex; flex-direction: column; gap: 12px; }
/* One stage per boss: angular plate with the boss, locked ones as a silhouette */
.arena-stage {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 16px 10px 10px;
    border: 2px solid #2e2e2e;
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%, 8px 50%);
    background: linear-gradient(135deg, #4a4f56 0%, #2c2f34 60%, #1d1f23 100%);
    color: #f0f0f0;
    text-align: left;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.arena-stage:disabled { cursor: default; }
.arena-stage.beaten { background: linear-gradient(135deg, #5a5233 0%, #33301f 60%, #1f1d14 100%); }
.stage-image { width: 64px; height: 64px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.stage-image img { max-width: 100%; max-height: 100%; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.6)); }
.arena-stage.locked .stage-image img { filter: brightness(0) opacity(0.7); }
.arena-stage.locked .stage-boss, .arena-stage.locked .stage-title { opacity: 0.6; }
.stage-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stage-title { font-family: var(--font-medieval); font-size: 1.25rem; color: var(--gold); text-shadow: 1px 1px 1px #000; }
.stage-boss { font-size: 0.875rem; }
.stage-stats { display: flex; flex-wrap: wrap; gap: 10px; font-family: var(--font-sans); font-size: 0.75rem; font-weight: 600; }
.stage-stats span { display: inline-flex; align-items: center; gap: 3px; }
.stage-stats .stat-icon, .stage-info .stat-icon { width: 12px; height: 12px; fill: #d8d8d8; }
.stage-info { display: inline-flex; align-items: center; gap: 4px; font-size: 0.75rem; color: #c8c8c8; }
.stage-info.won { color: var(--gold); }
.stage-lock { width: 13px; height: 13px; fill: #c8c8c8; }

/* Fight: boss on top, hero below, damage numbers fly up from the one who was hit */
.fight { display: flex; flex-direction: column; gap: 10px; }
.fighter { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.fighter .stat-bar { width: 100%; }
.fighter-name { font-family: var(--font-medieval); font-size: 1.125rem; color: var(--quest-title); text-shadow: var(--gold-shadow); }
.fighter-sprite { width: 150px; }
.fighter-sprite .boss-image { width: 100%; display: block; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.6)); }
.fighter-sprite .hero-stack { width: 100%; }
.fight-vs { align-self: center; font-family: var(--font-medieval); font-size: 1.375rem; color: var(--primary); text-shadow: 1px 1px 0 #000; }
.fighter-sprite.lunge-down.a { animation: fight-lunge-down-a 0.35s ease-out; }
.fighter-sprite.lunge-down.b { animation: fight-lunge-down-b 0.35s ease-out; }
.fighter-sprite.lunge-up.a { animation: fight-lunge-up-a 0.35s ease-out; }
.fighter-sprite.lunge-up.b { animation: fight-lunge-up-b 0.35s ease-out; }
.fighter-sprite.hit.a { animation: fight-hit-a 0.35s linear; }
.fighter-sprite.hit.b { animation: fight-hit-b 0.35s linear; }
.fighter-sprite.hit.crit { filter: drop-shadow(0 0 8px rgba(255, 60, 30, 0.9)); }
@keyframes fight-lunge-down-a { 40% { transform: translateY(26px) scale(1.06); } }
@keyframes fight-lunge-down-b { 40% { transform: translateY(26px) scale(1.06); } }
@keyframes fight-lunge-up-a { 40% { transform: translateY(-26px) scale(1.06); } }
@keyframes fight-lunge-up-b { 40% { transform: translateY(-26px) scale(1.06); } }
@keyframes fight-hit-a { 20% { transform: translateX(-7px) rotate(-3deg); } 45% { transform: translateX(7px) rotate(3deg); } 70% { transform: translateX(-4px); } }
@keyframes fight-hit-b { 20% { transform: translateX(-7px) rotate(-3deg); } 45% { transform: translateX(7px) rotate(3deg); } 70% { transform: translateX(-4px); } }

.fight-floats { position: absolute; left: 0; right: 0; top: 40%; height: 0; z-index: 2; pointer-events: none; display: flex; justify-content: center; }
.fight-float {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    animation: fight-float 1s ease-out forwards;
}
.float-damage { font-family: var(--font-medieval); font-size: 34px; color: #ff3b2f; -webkit-text-stroke: 1px #000; text-shadow: 2px 2px 0 #000; }
.fight-float.crit .float-damage { font-size: 46px; color: #ffcc00; }
.fight-float.heal .float-damage { color: #5fd14a; font-size: 26px; }
.float-crit { font-family: var(--font-medieval); font-size: 15px; color: #ffcc00; text-shadow: 1px 1px 0 #000; }
.float-blocked { display: inline-flex; align-items: center; gap: 3px; margin-top: 2px; font-family: var(--font-sans); font-size: 13px; font-weight: 700; color: #d8d8d8; text-shadow: 1px 1px 1px #000; }
.float-blocked .stat-icon { width: 13px; height: 13px; fill: #9ab4d8; stroke: #000; stroke-width: 1; }
@keyframes fight-float {
    0% { opacity: 0; transform: translateY(10px) scale(0.6); }
    15% { opacity: 1; transform: translateY(0) scale(1.15); }
    30% { transform: translateY(-6px) scale(1); }
    100% { opacity: 0; transform: translateY(-60px); }
}

.fight-skip { align-self: center; }
.fight-result { align-items: center; text-align: center; gap: 8px; animation: celebrate-pop 0.5s ease-out; }
.fight-result-title { font-family: var(--font-medieval); font-size: 1.875rem; text-shadow: 1px 1px 1px #000; }
.fight-result.won .fight-result-title { color: var(--gold); }
.fight-result.lost .fight-result-title { color: #9a9a9a; }

/* A field (time range, search) with a pill switch (Game / Real, All / Focus) and its explanation in one row */
.filter-row { display: flex; align-items: center; gap: 8px; }
.filter-row > :first-child { flex: 1; min-width: 0; }
.focus-hint { margin: 4px 0; text-align: center; font-size: 0.8125rem; color: var(--text-muted); }
.mode-switch { display: inline-flex; flex-shrink: 0; padding: 2px; border: 1px solid var(--outline); border-radius: 999px; }
.mode-switch button { padding: 4px 10px; border: none; border-radius: 999px; background: none; color: var(--text-muted); font-family: inherit; font-size: 0.8125rem; cursor: pointer; }
.mode-switch button.active { background: var(--btn-bg); color: var(--btn-text); text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.6); }

/* Account deletion */
.delete-warning p { margin: 0 0 8px; }
.delete-dissolve { color: var(--error); font-weight: 600; }
.guild-heroes .hero-actions { display: inline-flex; align-items: center; gap: 4px; }
.guild-heroes .hero-remove { font-size: 1.125rem; color: var(--error); min-width: 36px; min-height: 36px; }
/* Forms only for submitting with Enter, the fields stay in the card's layout */
.form-fields { display: contents; }

/* A page broke (AppErrorBoundary) */
.error-panel { margin-top: 40px; text-align: center; }
.error-trap { align-self: center; width: 150px; max-width: 70%; height: auto; margin-bottom: 4px; }
/* The whole app broke, shown by Blazor itself (host page) */
#blazor-error-ui {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 1000;
    padding: 12px 16px;
    background: var(--danger);
    color: #ffffff;
    text-align: center;
}
#blazor-error-ui .reload { color: #ffffff; font-weight: 600; margin-left: 8px; }

/* Feedback dialog: what the diagnostic data contains */
.feedback-diagnostics { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.feedback-details { margin-top: 4px; text-align: left; }
.feedback-details summary { cursor: pointer; }
.feedback-off { opacity: 0.45; }
.feedback-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 6px 0; overflow-wrap: anywhere; }

/* Ad slot above the tab bar (AdSlot): placeholder until an ad network is chosen, points to the deep pockets */
.ad-slot {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px));
    width: min(100%, var(--max-width));
    height: var(--ad-height);
    z-index: 45;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 12px;
    border: none;
    border-top: 1px solid var(--outline);
    background: var(--surface);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
}
.ad-slot img { width: 28px; height: 28px; }
.ad-slot .ad-text { display: flex; flex-direction: column; min-width: 0; text-align: left; line-height: 1.25; }
.ad-slot .ad-title, .ad-slot .ad-subtext { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-slot .ad-title { color: var(--text); font-weight: 600; }
.ad-slot .ad-subtext { font-size: 0.75rem; }
.ad-slot .ad-label { flex-shrink: 0; padding: 1px 5px; border: 1px solid var(--outline); border-radius: 4px; font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* Deep pockets in the settings (SupporterSection) */
.supporter { align-items: stretch; gap: 10px; }
.supporter p { margin: 0; }
.supporter-title { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0; }
.supporter-title img { width: 32px; height: 32px; }
.supporter-title:focus { outline: none; }
.supporter-offers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.supporter-offer { position: relative; align-items: center; text-align: center; gap: 4px; padding-top: 16px; }
.supporter-offer .entry-title { font-size: 1.125rem; }
/* The cards share the row's height, the buttons sit at the bottom however the texts wrap */
.supporter-offer .btn { width: 100%; margin-top: auto; padding: 8px 4px; }
.supporter-offer .small:last-of-type { margin-bottom: 6px; }
.supporter-offer.featured { --frame: var(--bronze); box-shadow: var(--frame-shadow), 0 0 10px rgba(246, 208, 77, 0.55); }
.supporter-price { font-size: 1.375rem; color: var(--gold-text); text-shadow: var(--gold-shadow); }
.supporter-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 1px 8px;
    border-radius: 10px;
    background: var(--btn-bg);
    color: var(--btn-text);
    font-size: 0.75rem;
    white-space: nowrap;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.7);
}
