@font-face {
    font-family: "Jacquard Regular";
    src: url("./fonts/Jacquard12-Regular.ttf");
}

body {
    font-family: "Jacquard Regular", "Times New Roman", serif;
    padding: clamp(1em, 3vw, 2em) max(1rem, calc(50vw - 40em)) 6em;
    margin: 0;
    color: #f4e4bc;
    background: #0a0408;
    min-height: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

*, *::before, *::after {
    box-sizing: inherit;
}

::selection {
    background: rgba(212, 168, 87, 0.45);
    color: #fff8e0;
}

html {
    height: 100%;
}

/* ----- Buttons (royal velvet w/ gold trim) ----- */
.btn {
    font-family: "Jacquard Regular", "Times New Roman", serif;
    color: #f4e4bc;
    background: linear-gradient(180deg, #8b1e3f 0%, #5a0e23 100%);
    border: 3px solid #d4a857;
    border-radius: 6px;
    padding: 0.15em 0.7em 0.25em 0.7em;
    font-size: 220%;
    letter-spacing: 0.03em;
    cursor: pointer;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
    box-shadow:
        0 0 0 1px #2a1418 inset,
        0 0 12px rgba(0, 0, 0, 0.5) inset,
        0 4px 0 #2a0a13,
        0 6px 14px rgba(0, 0, 0, 0.6);
    transition: transform 100ms ease, box-shadow 150ms ease, border-color 150ms ease, color 150ms ease, opacity 150ms ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35em;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    user-select: none;
}

/* glint that sweeps across on hover */
.btn::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -60%;
    width: 40%;
    background: linear-gradient(100deg, transparent, rgba(255, 240, 200, 0.35), transparent);
    transform: skewX(-20deg);
    pointer-events: none;
    transition: left 0s;
}

.btn:hover::before {
    left: 130%;
    transition: left 600ms ease;
}

.btn:focus-visible {
    outline: 2px solid #f4d878;
    outline-offset: 3px;
}

.btn:disabled,
.btn.btn-disabled {
    cursor: not-allowed;
    opacity: 0.5;
    filter: saturate(0.5);
    transform: none;
}

.btn:disabled::before,
.btn.btn-disabled::before {
    display: none;
}

.btn:hover:not(:disabled):not(.btn-disabled) {
    color: #fff8e0;
    border-color: #f4d878;
    transform: translateY(-2px);
    box-shadow:
        0 0 0 1px #2a1418 inset,
        0 0 14px rgba(255, 200, 100, 0.25) inset,
        0 6px 0 #2a0a13,
        0 10px 24px rgba(212, 168, 87, 0.35);
}

.btn:active:not(:disabled):not(.btn-disabled) {
    transform: translateY(2px);
    box-shadow:
        0 0 0 1px #2a1418 inset,
        0 0 10px rgba(0, 0, 0, 0.6) inset,
        0 1px 0 #2a0a13,
        0 2px 6px rgba(0, 0, 0, 0.6);
}

/* ----- Title ----- */
.title {
    position: relative;
    text-align: center;
    margin: 0.2em 0 0.4em 0;
    line-height: 1;
    animation: rise-in 900ms cubic-bezier(.2, .8, .2, 1) both;
}

.title-welcome {
    font-size: clamp(1.1rem, 4vw, 1.6rem);
    color: #d4a857;
    letter-spacing: 0.25em;
    margin-bottom: -0.15em;
    text-shadow: 0 0 12px rgba(212, 168, 87, 0.4);
    white-space: nowrap;
}

.title-main {
    position: relative;
    display: inline-block;
    margin: 0;
    font-weight: normal;
    font-size: clamp(4rem, 15vw, 9rem);
    background: linear-gradient(100deg,
        #8b6914 0%, #d4a857 20%, #f4d878 32%, #fff6d0 38%, #f4d878 44%, #d4a857 60%, #8b6914 100%);
    background-size: 250% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 6px 0 #2a0a13) drop-shadow(0 0 24px rgba(212, 168, 87, 0.35));
    letter-spacing: 0.02em;
    line-height: 1;
    white-space: nowrap;
    animation: gold-shimmer 7s ease-in-out infinite;
}

.title-sub {
    font-size: clamp(1rem, 3.4vw, 1.3rem);
    color: #f4e4bc;
    letter-spacing: 0.18em;
    margin-top: 0.1em;
    opacity: 0.85;
    font-style: italic;
    white-space: nowrap;
}

@keyframes gold-shimmer {
    0%, 15%  { background-position: 100% 0; }
    55%, 100% { background-position: 0% 0; }
}

@keyframes rise-in {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
}

/* ----- Connection pill ----- */
.conn-pill {
    display: flex;
    width: fit-content;
    align-items: center;
    gap: 0.55em;
    margin: 0.4em auto 0;
    padding: 0.15em 0.9em 0.25em;
    font-size: clamp(0.95rem, 2.6vw, 1.15rem);
    letter-spacing: 0.06em;
    color: rgba(244, 228, 188, 0.8);
    border: 1px solid rgba(212, 168, 87, 0.35);
    background: rgba(23, 10, 16, 0.7);
    transition: color 300ms ease, border-color 300ms ease;
    animation: rise-in 900ms 150ms cubic-bezier(.2, .8, .2, 1) both;
}

.conn-dot {
    width: 0.55em;
    height: 0.55em;
    border-radius: 50%;
    background: #d4a857;
    box-shadow: 0 0 8px currentColor;
}

.conn-connecting .conn-dot { animation: pulse 1s ease-in-out infinite; }
.conn-online .conn-dot     { background: #9fd36b; color: #9fd36b; }
.conn-offline              { color: #e79a8a; border-color: rgba(200, 80, 60, 0.45); }
.conn-offline .conn-dot    { background: #d0543c; color: #d0543c; animation: pulse 1.6s ease-in-out infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.35; transform: scale(0.75); }
}

.top-row {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-top: 0.4em;
}

.top-row .conn-pill {
    margin: 0;
}

.forge-jump {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    padding: 0.15em 0.9em 0.25em;
    font-family: inherit;
    font-size: clamp(0.95rem, 2.6vw, 1.15rem);
    letter-spacing: 0.06em;
    color: #f4d878;
    background: rgba(139, 30, 63, 0.5);
    border: 1px solid #d4a857;
    cursor: pointer;
    transition: background 200ms ease, color 200ms ease, box-shadow 200ms ease;
    animation: rise-in 900ms 200ms cubic-bezier(.2, .8, .2, 1) both;
}

.forge-jump:hover {
    color: #fff6d0;
    background: rgba(168, 40, 78, 0.65);
    box-shadow: 0 0 14px rgba(212, 168, 87, 0.3);
}

@media (min-width: 1100px) {
    .forge-jump { display: none; }
}

/* ----- Layout ----- */
.landing-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0 3em;
    align-items: start;
}

.landing-join,
.landing-forge {
    animation: rise-in 900ms 250ms cubic-bezier(.2, .8, .2, 1) both;
    min-width: 0;
}

.landing-forge {
    animation-delay: 380ms;
}

@media (min-width: 1100px) {
    .landing-grid {
        grid-template-columns: minmax(0, 1fr) 25em;
    }
    .landing-forge .heading {
        font-size: 2.2rem;
        white-space: nowrap;
    }
    .landing-forge {
        position: sticky;
        top: 1.5em;
    }
}

/* ----- Headings ----- */
.heading {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    margin: 1.4em 0 0.6em 0;
    font-weight: normal;
    font-size: clamp(1.9rem, 6.5vw, 2.6rem);
    color: #f4d878;
    letter-spacing: 0.06em;
    text-shadow: 0 3px 0 #2a0a13, 0 0 20px rgba(212, 168, 87, 0.4);
    text-align: center;
}

/* gilded rule that fades out to both sides */
.heading::before,
.heading::after {
    content: "";
    flex: 1;
    height: 2px;
    max-width: 6em;
    background: linear-gradient(90deg, transparent, #d4a857);
    box-shadow: 0 1px 0 #2a0a13;
}

.heading::after {
    background: linear-gradient(270deg, transparent, #d4a857);
    order: 3;
}

.heading-text {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
}

.heading-orn {
    font-size: 0.7em;
    color: #d4a857;
}

.heading-badge {
    order: 2;
    min-width: 1.5em;
    padding: 0 0.35em 0.1em;
    font-size: 0.55em;
    line-height: 1.4;
    color: #2a1810;
    text-shadow: none;
    background: linear-gradient(180deg, #f4d878, #b98c2e);
    border: 2px solid #5a4214;
    border-radius: 999px;
    box-shadow: 0 2px 0 #2a0a13;
}

/* ----- Lobby card (ink & gilt ledger) ----- */
.lobby-list {
    display: flex;
    flex-direction: column;
    gap: 1.6em;
    margin: 1.2em 0;
}

.lobby_div {
    --gold: #d4a857;
    position: relative;
    font-family: "Jacquard Regular", "Times New Roman", serif;
    font-size: clamp(1.45rem, 4.2vw, 2rem);
    color: #f4e4bc;

    display: flex;
    flex-direction: column;
    gap: 0.35em;
    padding: 0.55em 0.85em 0.65em;

    background:
        radial-gradient(ellipse at 50% 0%, rgba(212, 168, 87, 0.12), transparent 70%),
        #170a10;
    border: 1px solid rgba(212, 168, 87, 0.7);
    outline: 1px solid rgba(212, 168, 87, 0.25);
    outline-offset: -7px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);

    transition: transform 200ms ease, box-shadow 250ms ease, border-color 250ms ease, opacity 300ms ease, filter 300ms ease;
    animation: card-in 500ms cubic-bezier(.2, .8, .2, 1) backwards;
}

.lobby_div:hover {
    transform: translateY(-3px);
    border-color: #f4d878;
    box-shadow: 0 0 34px rgba(212, 168, 87, 0.16), 0 16px 32px rgba(0, 0, 0, 0.65);
}

/* gold stars pinned to the four corners */
.lobby-star {
    position: absolute;
    font-size: 16px;
    line-height: 1;
    color: #f4d878;
    pointer-events: none;
    transition: text-shadow 250ms ease, transform 250ms ease;
}

.lobby-star-tl { top: -8px; left: -7px; }
.lobby-star-tr { top: -8px; right: -7px; }
.lobby-star-bl { bottom: -8px; left: -7px; }
.lobby-star-br { bottom: -8px; right: -7px; }

.lobby_div:hover .lobby-star {
    text-shadow: 0 0 8px rgba(244, 216, 120, 0.9), 0 0 16px rgba(244, 170, 70, 0.6);
    transform: scale(1.15);
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

.lobby-new {
    animation: card-in 500ms cubic-bezier(.2, .8, .2, 1) backwards, new-glow 2.2s ease-out 3 backwards;
}

@keyframes new-glow {
    0%   { box-shadow: 0 0 0 0 rgba(244, 216, 120, 0.7), 0 12px 28px rgba(0, 0, 0, 0.6); }
    60%  { box-shadow: 0 0 0 14px rgba(244, 216, 120, 0), 0 12px 28px rgba(0, 0, 0, 0.6); }
    100% { box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6); }
}

.lobby-full {
    background: #120810;
    border-color: rgba(212, 168, 87, 0.35);
    outline-color: rgba(212, 168, 87, 0.12);
}

.lobby-full .lobby-star {
    display: none;
}

.lobby-full .lobby_name {
    color: rgba(244, 228, 188, 0.55);
}

.lobby-full .lobby-rule {
    opacity: 0.4;
}

.lobby-stopping {
    opacity: 0.45;
    filter: grayscale(0.6);
    pointer-events: none;
}

.lobby-skeleton {
    min-height: 4.6em;
    overflow: hidden;
    opacity: 0.5;
    animation: none;
}

.lobby-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 20%, rgba(212, 168, 87, 0.12) 50%, transparent 80%);
    transform: translateX(-100%);
    animation: skeleton 1.4s ease-in-out infinite;
}

@keyframes skeleton {
    to { transform: translateX(100%); }
}

.lobby_name {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.1em 0.4em;
    text-align: center;
    color: #f4e4bc;
    overflow-wrap: anywhere;
    line-height: 1.1;
}

.lobby-tag {
    font-size: 0.55em;
    letter-spacing: 0.04em;
    padding: 0.05em 0.5em 0.15em;
    color: #d4a857;
    border: 1px solid rgba(212, 168, 87, 0.5);
}

.lobby-new .lobby-tag {
    color: #f4d878;
    border-color: #d4a857;
    background: rgba(139, 30, 63, 0.5);
}

/* gilded rule with a star in the middle */
.lobby-rule {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: 0.4em;
    color: #d4a857;
}

.lobby-rule span {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #d4a857);
}

.lobby-rule span:last-child {
    background: linear-gradient(270deg, transparent, #d4a857);
}

.lobby-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.4em 1em;
}

.lobby_players {
    font-size: 0.62em;
    color: #d4a857;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 0.6em;
}

.lobby-full .lobby_players {
    color: rgba(212, 168, 87, 0.6);
}

.lobby_actions {
    display: flex;
    align-items: center;
    gap: 0.7em;
    flex-shrink: 0;
    margin-left: auto;
}

.lobby-join {
    position: relative;
    overflow: hidden;
    display: inline-block;
    font-size: 0.82em;
    line-height: 1.2;
    text-decoration: none;
    color: #f4d878;
    padding: 0.08em 0.7em 0.18em;
    background: rgba(139, 30, 63, 0.5);
    border: 1px solid #d4a857;
    transition: background 200ms ease, color 200ms ease, box-shadow 200ms ease, transform 100ms ease;
}

.lobby-join::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -60%;
    width: 40%;
    background: linear-gradient(100deg, transparent, rgba(255, 240, 200, 0.3), transparent);
    transform: skewX(-20deg);
}

.lobby-join:not(.is-disabled):hover {
    color: #fff6d0;
    background: rgba(168, 40, 78, 0.65);
    box-shadow: 0 0 16px rgba(212, 168, 87, 0.3);
}

.lobby-join:not(.is-disabled):hover::before {
    left: 130%;
    transition: left 600ms ease;
}

.lobby-join:not(.is-disabled):active {
    transform: translateY(1px);
}

.lobby-join:focus-visible,
.lobby-stop:focus-visible {
    outline: 1px solid #f4d878;
    outline-offset: 3px;
}

.lobby-join.is-disabled {
    color: rgba(244, 216, 120, 0.3);
    background: transparent;
    border: 1px dashed rgba(212, 168, 87, 0.25);
    cursor: not-allowed;
}

.lobby-stop {
    font-family: inherit;
    font-size: 0.68em;
    color: rgba(244, 228, 188, 0.55);
    padding: 0.05em 0.15em 0.15em;
    background: transparent;
    border: none;
    border-bottom: 1px solid transparent;
    cursor: pointer;
    transition: color 150ms ease, border-color 150ms ease;
}

.lobby-stop:hover:not(:disabled) {
    color: #f4e4bc;
    border-bottom-color: rgba(244, 228, 188, 0.4);
}

.lobby-stop.is-confirm {
    color: #ef9a85;
    border-bottom-color: #c0543c;
    animation: nudge 300ms ease;
}

@keyframes nudge {
    0%, 100% { translate: 0; }
    25%      { translate: -3px 0; }
    75%      { translate: 3px 0; }
}

/* ----- Player pips (little shields) ----- */
.pips {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.18em;
}

.pip {
    font: inherit;
    width: 0.55em;
    height: 0.65em;
    padding: 0;
    border: 2px solid #8b6914;
    border-radius: 2px 2px 50% 50%;
    background: rgba(244, 228, 188, 0.06);
    transition: background 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}

.pip-on {
    background: linear-gradient(180deg, #a8284e, #5a0e23);
    border-color: #d4a857;
    box-shadow: 0 0 6px rgba(139, 30, 63, 0.5);
}

.pips-interactive {
    font-size: 1.9rem;
    gap: 0.25em;
    margin-top: 0.35em;
}

.pips-interactive .pip {
    cursor: pointer;
    border-color: #d4a857;
    background: rgba(212, 168, 87, 0.08);
}

.pips-interactive .pip:disabled {
    cursor: default;
}

.pips-interactive .pip-on {
    background: linear-gradient(180deg, #f4d878 0%, #d4a857 50%, #8b6914 100%);
    border-color: #f4d878;
    box-shadow: 0 0 10px rgba(244, 216, 120, 0.45);
}

/* small gold star under the recommended counts (4, 6, 8) */
.pips-interactive .pip-rec {
    position: relative;
}

.pips-interactive .pip-rec::after {
    content: "✦";
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    font-size: 0.4em;
    line-height: 1.6;
    color: #d4a857;
    pointer-events: none;
}

.pips-interactive .pip:not(:disabled):hover {
    transform: translateY(-3px) scale(1.12);
}

/* ----- Empty state ----- */
.lobby_empty {
    font-family: "Jacquard Regular", "Times New Roman", serif;
    font-size: clamp(1.4rem, 4.5vw, 2rem);
    color: #d4a857;
    text-align: center;
    padding: 1.4em 0 1.8em;
    letter-spacing: 0.04em;
    animation: rise-in 700ms ease both;
}

.lobby_empty-hint {
    font-size: 0.65em;
    font-style: italic;
    margin-top: 0.4em;
    color: rgba(244, 228, 188, 0.55);
}

/* a lonely candle on the tavern table */
.candle {
    display: block;
    position: relative;
    width: 0.55em;
    height: 1.4em;
    margin: 0 auto 0.6em;
    background: linear-gradient(90deg, #d9c49a, #f4e4bc 40%, #c7ae7e);
    border-radius: 3px 3px 2px 2px;
    box-shadow: 0 0 40px 12px rgba(255, 170, 70, 0.12);
}

.candle::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 100%;
    width: 0.4em;
    height: 0.75em;
    margin-left: -0.2em;
    margin-bottom: 0.05em;
    border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%;
    background: radial-gradient(ellipse at 50% 75%, #fff6d0 0%, #ffcf5a 35%, #ff7a1a 70%, transparent 72%);
    filter: blur(0.5px);
    transform-origin: 50% 100%;
    animation: flame 1.8s ease-in-out infinite;
}

@keyframes flame {
    0%, 100% { transform: scaleY(1) rotate(-2deg); opacity: 1; }
    30%      { transform: scaleY(1.12) rotate(2deg); opacity: 0.9; }
    60%      { transform: scaleY(0.92) rotate(-1deg); opacity: 1; }
}

/* ----- Forge form (velvet panel) ----- */
.forge {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.1em;
    margin: 1.2em 0 2em;
    padding: 1.3em 1.4em 1.1em;
    font-size: 1.5rem;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(212, 168, 87, 0.12), transparent 70%),
        #170a10;
    border: 1px solid rgba(212, 168, 87, 0.7);
    outline: 1px solid rgba(212, 168, 87, 0.25);
    outline-offset: -7px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);
}

.forge:focus-within .lobby-star {
    text-shadow: 0 0 8px rgba(244, 216, 120, 0.9), 0 0 16px rgba(244, 170, 70, 0.6);
}

.forge-field {
    display: flex;
    flex-direction: column;
    gap: 0.2em;
}

.forge-label {
    font-size: 0.8em;
    letter-spacing: 0.08em;
    color: #d4a857;
}

.forge-name-row {
    display: flex;
    align-items: center;
    gap: 0.4em;
}

.forge input[type="text"] {
    flex: 1;
    min-width: 0;
    width: 100%;
    margin: 0;
    font-size: 1.25em;
    transition: border-color 200ms ease, box-shadow 200ms ease;
}

.forge input[type="text"]:focus {
    box-shadow: 0 6px 12px -8px rgba(244, 216, 120, 0.8);
}

.forge-dice {
    flex-shrink: 0;
    font-size: 1.5em;
    line-height: 1;
    padding: 0 0.1em;
    color: #d4a857;
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 500ms cubic-bezier(.3, 1.6, .5, 1), color 150ms ease;
}

.forge-dice:hover {
    color: #f4d878;
}

.stepper {
    display: inline-flex;
    align-items: stretch;
    width: fit-content;
    border: 1px solid #d4a857;
    outline: none;
}

.stepper:focus-visible {
    outline: 2px solid #f4d878;
    outline-offset: 3px;
}

.stepper-btn {
    font-family: inherit;
    font-size: 1.2em;
    width: 1.7em;
    color: #d4a857;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
}

.stepper-btn:hover:not(:disabled) {
    color: #fff6d0;
    background: rgba(139, 30, 63, 0.5);
}

.stepper-btn:disabled {
    color: rgba(212, 168, 87, 0.25);
    cursor: not-allowed;
}

.stepper-value {
    min-width: 2em;
    display: grid;
    place-items: center;
    font-size: 1.35em;
    color: #f4d878;
    background: rgba(139, 30, 63, 0.35);
    border-left: 1px solid rgba(212, 168, 87, 0.5);
    border-right: 1px solid rgba(212, 168, 87, 0.5);
    animation: pop 250ms cubic-bezier(.3, 1.6, .5, 1);
}

@keyframes pop {
    from { transform: scale(0.6); opacity: 0.3; }
    to   { transform: none; opacity: 1; }
}

.forge-hint {
    display: none;
}

.forge-hint.is-shown {
    display: flex;
    margin-top: 0.5em;
    align-items: flex-start;
    gap: 0.5em;
    padding: 0.45em 0.7em 0.5em;
    font-size: 0.8em;
    line-height: 1.25;
    color: #f4e4bc;
    background: rgba(212, 168, 87, 0.1);
    border-left: 3px solid #d4a857;
    border-radius: 0 6px 6px 0;
    animation: hint-in 350ms cubic-bezier(.2, .8, .2, 1);
}

.forge-hint-icon {
    color: #d4a857;
    flex-shrink: 0;
}

@keyframes hint-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}

.forge-rule {
    font-size: 0.6em;
    margin-top: 0.2em;
}

.forge-submit {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35em;
    align-self: stretch;
    font-family: inherit;
    font-size: clamp(1.8rem, 5vw, 2.1rem);
    color: #f4d878;
    padding: 0.15em 0.7em 0.25em;
    background: rgba(139, 30, 63, 0.5);
    border: 1px solid #d4a857;
    cursor: pointer;
    transition: background 200ms ease, color 200ms ease, box-shadow 200ms ease, transform 100ms ease, opacity 200ms ease;
}

.forge-submit::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -60%;
    width: 40%;
    background: linear-gradient(100deg, transparent, rgba(255, 240, 200, 0.3), transparent);
    transform: skewX(-20deg);
}

.forge-submit:hover:not(:disabled) {
    color: #fff6d0;
    background: rgba(168, 40, 78, 0.65);
    box-shadow: 0 0 22px rgba(212, 168, 87, 0.3);
}

.forge-submit:hover:not(:disabled)::before {
    left: 130%;
    transition: left 600ms ease;
}

.forge-submit:active:not(:disabled) {
    transform: translateY(1px);
}

.forge-submit:focus-visible {
    outline: 1px solid #f4d878;
    outline-offset: 3px;
}

.forge-submit:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.spinner {
    width: 0.7em;
    height: 0.7em;
    border: 3px solid rgba(244, 228, 188, 0.3);
    border-top-color: #f4d878;
    border-radius: 50%;
    animation: spin 800ms linear infinite;
}

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

.forge-msg {
    min-height: 1.2em;
    font-size: 0.8em;
    text-align: center;
    color: #e79a8a;
    font-style: italic;
}

/* ----- Inputs (quill on parchment) ----- */
input {
    font-family: "Jacquard Regular", "Times New Roman", serif;
    background-color: transparent;
    font-size: xx-large;
    color: #f4e4bc;
    border: none;
    border-bottom: 2px solid #d4a857;
    outline: none;
    margin: 1em 0;
    padding: 0.2em 0.3em;
    letter-spacing: 0.04em;
}

input::placeholder {
    color: rgba(244, 228, 188, 0.45);
    font-style: italic;
}

input:focus {
    border-bottom-color: #f4d878;
}

/* ----- Background / ambience ----- */
#blurDiv {
    position: fixed;
    inset: 0;
    backdrop-filter: blur(140px);
    z-index: -8;
    pointer-events: none;
}

#background {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 50% 30%, #3a1a2a 0%, #1a0810 60%, #0a0408 100%);
    z-index: -10;
}

/* faint stone-y texture on top of background */
#background::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(212, 168, 87, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(139, 30, 63, 0.08) 0%, transparent 45%);
    pointer-events: none;
}

#mousePointerDeco {
    position: fixed;
    height: 600px;
    width: 600px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(255, 190, 100, 0.28) 0%,
        rgba(220, 110, 40, 0.14) 35%,
        rgba(140, 40, 20, 0.06) 60%,
        transparent 75%
    );
    z-index: -9;
    translate: -50% -50%;
    pointer-events: none;
    filter: blur(20px);
    animation: torch-flicker 4s ease-in-out infinite;
    will-change: left, top;
}

#embers {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -7;
    pointer-events: none;
}

@keyframes torch-flicker {
    0%, 100% { transform: scale(1); opacity: 1; }
    25%      { transform: scale(1.05); opacity: 0.92; }
    50%      { transform: scale(0.97); opacity: 1; }
    75%      { transform: scale(1.03); opacity: 0.95; }
}

/* ----- Music controls (main menu) ----- */
.music-controls-main {
    position: fixed;
    bottom: 1.4em;
    right: 1.4em;
    z-index: 10;

    display: flex;
    align-items: center;
    gap: 0.7em;

    font-family: "Jacquard Regular", "Times New Roman", serif;
    padding: 0.45em 0.8em 0.45em 0.45em;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(212, 168, 87, 0.12), transparent 70%),
        rgba(23, 10, 16, 0.85);
    border: 1px solid rgba(212, 168, 87, 0.7);
    outline: 1px solid rgba(212, 168, 87, 0.25);
    outline-offset: -5px;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
}

/* two of the card stars, pinned to opposite corners */
.music-controls-main::before,
.music-controls-main::after {
    content: "✦";
    position: absolute;
    font-size: 13px;
    line-height: 1;
    color: #f4d878;
    pointer-events: none;
}

.music-controls-main::before { top: -7px; left: -6px; }
.music-controls-main::after  { bottom: -7px; right: -6px; }

.music-controls-main input[type="range"] {
    margin: 0;
}

.music-controls-main .music-toggle {
    position: relative;
    color: #f4d878;
    background: rgba(139, 30, 63, 0.5);
    border: 1px solid #d4a857;
    padding: 0.05em 0.45em 0.12em;
    font-family: "Jacquard Regular", "Times New Roman", serif;
    font-size: 170%;
    line-height: 1;
    cursor: pointer;
    transition: background 200ms ease, color 200ms ease, box-shadow 200ms ease;
}

.music-controls-main .music-toggle:hover {
    color: #fff6d0;
    background: rgba(168, 40, 78, 0.65);
    box-shadow: 0 0 14px rgba(212, 168, 87, 0.3);
}

.music-controls-main .music-toggle.muted {
    color: rgba(244, 216, 120, 0.4);
    background: transparent;
}

.music-controls-main .music-toggle.muted::after {
    content: "";
    position: absolute;
    left: 18%;
    right: 18%;
    top: 48%;
    height: 1px;
    background: #d4a857;
    transform: rotate(-25deg);
    transform-origin: center;
    pointer-events: none;
}

/* Main menu only plays music, so the single slider needs no icon label. */
.music-controls-main .music-slider-row {
    display: flex;
    align-items: center;
}

.music-controls-main .music-slider-label {
    display: none;
}

.music-controls-main .music-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 8em;
    height: 4px;
    background: linear-gradient(90deg, rgba(212, 168, 87, 0.15), rgba(212, 168, 87, 0.5));
    border: none;
    border-top: 1px solid rgba(212, 168, 87, 0.6);
    border-bottom: 1px solid rgba(212, 168, 87, 0.6);
    border-radius: 0;
    outline: none;
}

.music-controls-main .music-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: #f4d878;
    border: 1px solid #8b6914;
    border-radius: 0;
    transform: rotate(45deg);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(244, 216, 120, 0.6);
}

.music-controls-main .music-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #f4d878;
    border: 1px solid #8b6914;
    border-radius: 0;
    transform: rotate(45deg);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(244, 216, 120, 0.6);
}

@media (max-width: 560px) {
    .music-controls-main .music-slider {
        width: 5em;
    }
    #mousePointerDeco {
        width: 380px;
        height: 380px;
    }
}
