body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #111;
    color: #eee;
}

:root {
    --chat-window-height: 360px;
    --chat-panel-min-height: calc(var(--chat-window-height) + 3.6rem);
}

a {
    color: #ffd27f;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page > .visitor-hero {
    flex: 1;
}

.topbar {
    background: #330000;
    color: #ffd27f;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar .logo {
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.topbar .main-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar .main-nav a {
    font-size: 0.95rem;
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown__toggle {
    background: none;
    border: 1px solid transparent;
    color: #ffd27f;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.nav-dropdown__toggle:focus-visible {
    outline: none;
    border-color: #ffd27f;
}

.nav-dropdown__menu {
    position: absolute;
    top: calc(100% + 0.2rem);
    left: 0;
    display: none;
    flex-direction: column;
    min-width: 170px;
    background: #220000;
    border: 1px solid #553333;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    z-index: 10;
    padding: 0.35rem;
}

.nav-dropdown__menu a {
    padding: 0.45rem 0.6rem;
    border-radius: 4px;
    color: #ffd27f;
    font-weight: 600;
}

.nav-dropdown__menu a:hover {
    background: rgba(255, 210, 127, 0.08);
    text-decoration: none;
}

.nav-dropdown:hover .nav-dropdown__menu,
.nav-dropdown:focus-within .nav-dropdown__menu {
    display: flex;
}

.content {
    flex: 1;
    max-width: 900px;
    margin: 1.5rem auto;
    padding: 0 1rem 3rem;
}

.visitor-hero {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    align-items: stretch;
    margin: 1rem auto 0;
    max-width: 1200px;
    padding: 0 1rem 2rem;
}

.visitor-hero__image {
    max-width: 520px;
    margin: 0 auto;
}

.visitor-hero__image img {
    width: 100%;
    height: auto;
    display: block;
}

.visitor-hero__content .content {
    margin: 0 auto;
    width: 100%;
}

.footer {
    text-align: center;
    padding: 0.75rem;
    font-size: 0.8rem;
    color: #aaa;
    background: #1a1a1a;
}

.footer-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem 1rem;
    color: #ddd;
}

.footer-stat {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.35rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 4px;
}

.footer-name {
    color: #ffd27f;
    font-weight: 700;
}

.footer-link {
    color: #ffd27f;
    font-weight: 600;
}

.card {
    background: #1b0c0c;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 0 20px rgba(0,0,0,0.6);
    border: 1px solid #552222;
}

.card h1 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.btn {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    background: #b32a0f;
    color: #fff;
    font-weight: 600;
    margin-right: 0.5rem;
}

.btn.secondary {
    background: #444;
}

.btn.danger {
    background: #7c0f0f;
}

.btn:hover {
    filter: brightness(1.1);
    text-decoration: none;
}

label {
    display: block;
    margin-bottom: 0.5rem;
}

.form-group {
    margin: 0.75rem 0 1rem;
    padding: 0.35rem 0.25rem 0.1rem;
    border: 1px solid #2f1d1d;
    border-radius: 6px;
}

.form-group legend {
    color: #ffd27f;
    padding: 0 0.35rem;
    font-weight: 700;
}

.gender-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.6rem;
    margin-top: 0.35rem;
}

.gender-card {
    position: relative;
    display: block;
    cursor: pointer;
    text-decoration: none;
}

.gender-card input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.gender-card__body {
    border: 1px solid #3f1f1f;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
    min-height: 92px;
}

.gender-card__title {
    font-weight: 700;
    color: #ffd27f;
    font-size: 1.05rem;
    margin-bottom: 0.2rem;
}

.gender-card__subtitle {
    color: #d6c2b0;
    font-size: 0.95rem;
    line-height: 1.35;
}

.gender-card:hover .gender-card__body {
    border-color: #a35a2a;
    transform: translateY(-2px);
}

.gender-card input:focus-visible + .gender-card__body {
    outline: 2px solid #ffd27f;
    outline-offset: 2px;
}

.gender-card input:checked + .gender-card__body {
    border-color: #c29c62;
    box-shadow: 0 0 0 1px rgba(194, 156, 98, 0.55);
    background: linear-gradient(135deg, rgba(255, 210, 127, 0.08), rgba(255, 210, 127, 0.02));
}

input, textarea {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #555;
    background: #111;
    color: #eee;
    margin-top: 0.2rem;
    font-family: inherit;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

.alert {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
}

.alert.info {
    background: #003049;
    border: 1px solid #457b9d;
}

.alert.success {
    background: #063d2b;
    border: 1px solid #0fa36b;
}

.alert.danger {
    background: #5d0011;
    border: 1px solid #ff4d6d;
}

.form-actions {
    margin-top: 0.75rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.25rem 1rem;
    margin-bottom: 1rem;
}

.stats div strong {
    display: inline-block;
    width: 120px;
}

.actions {
    margin-top: 1rem;
}

.bank-forms {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.bank-form {
    border: 1px solid #553333;
    padding: 1rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
}

.bank-form h2 {
    margin-top: 0;
    margin-bottom: 0.35rem;
}

.bank-form p {
    margin-top: 0;
    margin-bottom: 0.8rem;
}

.bank-balances {
    margin: 0.5rem 0 1rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.75rem;
}

.table th, .table td {
    border-bottom: 1px solid #333;
    padding: 0.4rem 0.3rem;
    text-align: left;
}

.table th {
    background: #260000;
}

.chat-panel {
    position: relative;
}

.chat-shell {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding-bottom: 0.5rem;
}

.chat-toolbar {
    display: flex;
    justify-content: flex-end;
}

.chat-size-toggle {
    min-width: 8.5rem;
}

.chat-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.chat-tab {
    background: #1a0c0c;
    border: 1px solid #3f1f1f;
    color: #f9e7d7;
    padding: 0.45rem 0.7rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: border-color 0.15s ease, background 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.chat-tab:hover {
    border-color: #7f4d2f;
}

.chat-tab.active {
    background: linear-gradient(135deg, #3f1f1f, #1d0c0c);
    border-color: #c49a6c;
    color: #fff1db;
}

.chat-tab.unread {
    box-shadow: 0 0 0 1px #f2c46d inset;
}

.chat-tab-close {
    margin-left: 0.2rem;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.85;
}

.chat-tab-close:hover {
    opacity: 1;
}

.chat-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 0.85rem;
    align-items: stretch;
    min-height: var(--chat-panel-min-height);
}

.chat-main {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-height: var(--chat-panel-min-height);
}

.chat-logs {
    width: 100%;
    flex: 1;
    min-height: 0;
}

.chat-log {
    background: #000;
    border-radius: 6px;
    border: 1px solid #333;
    min-height: var(--chat-window-height);
    height: 100%;
    flex: 1;
    overflow-y: auto;
    padding: 0.4rem 0.5rem;
    margin-bottom: 0.1rem;
    font-family: "Consolas", monospace;
    font-size: 0.9rem;
}

.chat-line {
    margin-bottom: 0.18rem;
}

.chat-time {
    color: #888;
    margin-right: 0.3rem;
}

.chat-name {
    color: #ffd27f;
    margin-right: 0.2rem;
}

.chat-name-button {
    background: none;
    border: none;
    padding: 0;
    color: #ffd27f;
    font: inherit;
    cursor: pointer;
}

.chat-name-button:hover:not(:disabled),
.chat-name-button:focus-visible {
    text-decoration: underline;
}

.chat-name-button:disabled {
    opacity: 0.7;
    cursor: default;
}

.chat-text {
    color: #eee;
}

.chat-form {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid #2e1b1b;
    flex-shrink: 0;
}

.chat-form input {
    flex: 1;
}

.chat-sidebar {
    border: 1px solid #3f1f1f;
    border-radius: 8px;
    padding: 0.65rem;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    height: 100%;
    min-height: 0;
}

.chat-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.chat-sidebar-title {
    font-weight: 700;
    color: #ffd27f;
}

.chat-room-label {
    color: #f5e1c0;
    font-size: 0.95rem;
}

.roster-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
    max-height: none;
    overflow-y: auto;
    min-height: 0;
}

.roster-entry {
    text-align: left;
    background: #130707;
    border: 1px solid #2e1b1b;
    color: #f9e7d7;
    padding: 0.4rem 0.5rem;
    border-radius: 5px;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.roster-entry:hover:not(:disabled) {
    border-color: #af8045;
}

.roster-entry:disabled {
    opacity: 0.6;
    cursor: default;
}

.roster-empty {
    color: #a69080;
    font-style: italic;
}

.room-actions {
    border-top: 1px solid #2e1b1b;
    padding-top: 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: auto;
}

.room-actions-header {
    font-weight: 700;
    color: #e9c899;
}

.room-form {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.room-form input {
    flex: 1;
}

.room-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.room-pill {
    background: #1a0c0c;
    border: 1px solid #2e1b1b;
    color: #f3dec3;
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
    cursor: pointer;
}

.room-pill:hover {
    border-color: #af8045;
}

.room-hint {
    color: #b6a28e;
    font-size: 0.9rem;
}

.room-overlay[hidden] {
    display: none;
}

.room-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 20;
}

.room-overlay-dialog {
    background: #120909;
    border: 1px solid #2f1d1d;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    width: min(520px, 100%);
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.room-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}

.room-overlay-title {
    font-weight: 700;
    color: #f3dec3;
    font-size: 1.05rem;
}

.room-overlay-close {
    background: none;
    border: none;
    color: #f3dec3;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
}

.room-overlay-close:hover {
    color: #f5c67d;
}

.room-overlay-body {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    min-height: 2.75rem;
}

.room-overlay-empty {
    color: #b6a28e;
    font-style: italic;
}

@media (max-width: 960px) {
    :root {
        --chat-window-height: 280px;
        --chat-panel-min-height: calc(var(--chat-window-height) + 3.6rem);
    }

    .chat-body {
        grid-template-columns: 1fr;
    }
}

body.chat-maximized {
    overflow: hidden;
}

.chat-panel.maximized {
    position: fixed;
    inset: 0.85rem;
    max-width: none;
    width: auto;
    height: calc(100vh - 1.7rem);
    z-index: 30;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat-panel.maximized .chat-shell {
    flex: 1;
    height: 100%;
}

.chat-panel.maximized .chat-body {
    min-height: 0;
    height: 100%;
}

.chat-panel.maximized .chat-main {
    min-height: 0;
    height: 100%;
}

.chat-panel.maximized .chat-logs {
    height: 100%;
}

.chat-panel.maximized .chat-log {
    min-height: 0;
}

.chat-panel.maximized .chat-sidebar {
    height: 100%;
}

.announcement-form {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin: 0.75rem 0 1rem;
}

.announcement-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.announcement-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-top: 0.35rem;
}

.announcement-entry {
    border: 1px solid #3f1f1f;
    border-radius: 6px;
    padding: 0.65rem 0.7rem;
    background: rgba(255, 255, 255, 0.03);
}

.announcement-header {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-bottom: 0.3rem;
}

.announcement-title {
    font-weight: 700;
    color: #ffd27f;
    font-size: 1.05rem;
}

.announcement-meta {
    color: #c8b8a6;
    font-size: 0.95rem;
}

.announcement-body {
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.45;
}
.mail-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 0.5rem 0 1rem;
}

.mail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem;
}

.mail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.mail-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    color: #c8b8a6;
    font-size: 0.95rem;
    margin: 0.35rem 0 0.6rem;
}

.mail-note {
    margin: 0.25rem 0 0.35rem;
    color: #c8b8a6;
    font-size: 0.95rem;
}

.mail-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.4rem;
}

.mail-entry {
    border: 1px solid #3f1f1f;
    border-radius: 6px;
    padding: 0.65rem 0.7rem;
    background: rgba(255, 255, 255, 0.03);
}

.mail-entry.mail-unread {
    border-color: #e5a44f;
    background: rgba(255, 211, 133, 0.08);
}

.mail-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.mail-entry-actions {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
}

.mail-action {
    margin: 0;
}

.mail-entry-meta {
    color: #c8b8a6;
    font-size: 0.95rem;
}

.mail-entry-subject {
    font-weight: 700;
    color: #ffd27f;
    margin: 0.15rem 0;
}

.mail-entry-body {
    margin: 0.25rem 0 0.35rem;
    white-space: pre-wrap;
    line-height: 1.45;
}

.mail-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.mail-attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    border: 1px solid #4b2a1f;
    background: rgba(255, 255, 255, 0.05);
    color: #f7e7d3;
    font-size: 0.95rem;
    line-height: 1.2;
}

.bbs-panel {
    font-family: "Consolas", "Courier New", monospace;
    background: radial-gradient(circle at top left, #2a0909, #130303 60%);
    border: 1px solid #773a25;
}

.bbs-heading {
    text-align: center;
    margin-bottom: 1rem;
}

.bbs-title {
    font-size: 1.15rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #ffb347;
}

.bbs-subtitle {
    color: #d4c7b0;
    font-size: 0.95rem;
}

.bbs-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.35rem 1rem;
    margin-bottom: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #3f1f14;
    border-radius: 4px;
    padding: 0.6rem 0.75rem;
}

.bbs-label {
    display: inline-block;
    width: 110px;
    color: #ffcf99;
}

.bbs-value {
    color: #f5f5f5;
}

.bbs-message {
    background: #14213d;
    border: 1px solid #457b9d;
    padding: 0.55rem 0.75rem;
    border-radius: 4px;
    margin: 0.5rem 0 1rem;
    color: #d8e2dc;
}

.bbs-divider {
    border-bottom: 1px dashed #78350f;
    margin: 0.75rem 0 0.6rem;
}

.bbs-menu-title {
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.bbs-options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.35rem 0.75rem;
}

@media (min-width: 760px) {
    .bbs-options-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.bbs-option-card {
    border: 1px solid #2c160f;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.25);
    transition: transform 0.1s ease, border-color 0.1s ease;
}

.bbs-option-card:hover {
    transform: translateY(-2px);
    border-color: #7a3b16;
}

.bbs-option-link {
    display: grid;
    grid-template-columns: 50px 1fr;
    gap: 0.5rem;
    padding: 0.45rem 0.2rem;
    color: inherit;
    align-items: start;
    font-family: "Consolas", "Courier New", monospace;
}

.bbs-option-link:hover,
.bbs-option-link:focus-visible {
    background: rgba(255, 210, 127, 0.05);
    text-decoration: none;
}

.bbs-key {
    display: inline-block;
    color: #161616;
    background: linear-gradient(180deg, #e0b57a, #d18b47);
    border: 1px solid #8c3b0e;
    border-radius: 3px;
    text-align: center;
    padding: 0.35rem 0.25rem;
    min-width: 46px;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.35);
}

.bbs-option-main {
    color: #ffd27f;
    font-weight: 700;
}

.bbs-option-note {
    color: #c8b8a6;
    font-size: 0.95rem;
}

.encounter-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.8rem;
}

.encounter-stat {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #352018;
    border-radius: 5px;
    padding: 0.45rem 0.6rem;
    min-width: 150px;
}

.encounter-stat-label {
    color: #c8b8a6;
    font-size: 0.85rem;
}

.encounter-stat-value {
    color: #f0e6d2;
    font-weight: 700;
}

.inn-panel h2 {
    color: #ffd27f;
    margin-top: 0.2rem;
}

.inn-option-button {
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    padding: 0;
    text-align: left;
    width: 100%;
}

.inn-pane {
    display: none;
    margin-top: 1rem;
}

.inn-pane.active {
    display: block;
}

.bartender-lore-list {
    margin: 0.5rem 0 0.75rem 1.1rem;
    padding-left: 1.1rem;
    color: #d8e2dc;
    line-height: 1.35;
}

.bartender-lore-list strong {
    color: #ffd27f;
}

.ruby-layout,
.bard-layout,
.bartender-layout {
    display: grid;
    grid-template-columns: minmax(220px, 320px) 1fr;
    gap: 1.25rem;
    align-items: start;
}

.ruby-portrait,
.bard-portrait,
.bartender-portrait {
    justify-self: center;
}

.ruby-portrait img,
.bard-portrait img,
.bartender-portrait img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 320px;
    border-radius: 6px;
    border: 1px solid #342012;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
    background: #120b0a;
}

.ruby-interaction,
.bard-interaction,
.bartender-interaction {
    width: 100%;
}

@media (max-width: 768px) {
    .ruby-layout,
    .bard-layout,
    .bartender-layout {
        grid-template-columns: 1fr;
    }

    .ruby-portrait img,
    .bard-portrait img,
    .bartender-portrait img {
        max-width: 260px;
    }
}

.battle-log {
    background: #0e0e0e;
    border: 1px solid #342012;
    border-radius: 6px;
    padding: 0.65rem 0.75rem;
    font-family: "Consolas", monospace;
    margin: 0.75rem 0;
}

.battle-log-title {
    color: #ffd27f;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.battle-log ul {
    margin: 0;
    padding-left: 1.1rem;
}

.battle-log li {
    margin: 0.2rem 0;
    line-height: 1.3;
}

.battle-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.character-card h1 {
    margin-bottom: 0.15rem;
}

.character-subtitle {
    color: #c8b8a6;
    margin: 0;
}

.character-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.4rem 0.8rem;
}

.character-meta {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.character-pill {
    padding: 0.25rem 0.6rem;
    background: rgba(255, 210, 127, 0.08);
    border: 1px solid #5d2b12;
    border-radius: 999px;
    color: #ffd27f;
    font-weight: 700;
}

.character-stats {
    margin-top: 0.4rem;
}

.character-titles {
    margin: 0.8rem 0 1rem;
}

.title-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.35rem;
}

.title-pill {
    background: rgba(255, 210, 127, 0.08);
    border: 1px solid #5d2b12;
    border-radius: 999px;
    color: #ffd27f;
    font-weight: 700;
    padding: 0.2rem 0.7rem;
    font-size: 0.95rem;
}

.equipment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.equipment-card {
    padding: 0.75rem 0.85rem;
    border: 1px solid #3f1f14;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
}

.equipment-title {
    color: #c8b8a6;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.85rem;
}

.equipment-name {
    font-weight: 700;
    color: #ffd27f;
}

.equipment-meta {
    color: #c8b8a6;
}

.equipment-desc {
    margin: 0.35rem 0 0.6rem;
    color: #ddd;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.75rem;
}

.inventory-column h2 {
    margin-bottom: 0.4rem;
}

.inventory-item {
    border: 1px solid #2c160f;
    border-radius: 6px;
    padding: 0.55rem 0.6rem;
    margin-bottom: 0.4rem;
}

.inventory-item.equipped {
    background: rgba(255, 210, 127, 0.06);
}

.inventory-heading {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    justify-content: space-between;
}

.inventory-name {
    font-weight: 700;
}

.inventory-meta {
    color: #c8b8a6;
    font-size: 0.95rem;
}

.inventory-actions {
    margin-top: 0.35rem;
}

.character-actions {
    margin-top: 0.5rem;
}

.shop-panel h2 {
    margin-bottom: 0.35rem;
}

.shop-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.3rem 0.75rem;
    padding: 0.55rem 0.7rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #3f1f14;
    border-radius: 5px;
    margin-bottom: 0.75rem;
}

.shop-grid {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
    gap: 0.75rem;
    margin: 0.5rem 0 1rem;
    overflow-x: auto;
    align-items: start;
}

.shop-column {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid #362014;
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    min-width: 320px;
}

.shop-item {
    border-bottom: 1px solid #2c160f;
    padding: 0.35rem 0 0.5rem;
}

.shop-item:last-child {
    border-bottom: none;
}

.shop-item.equipped {
    background: rgba(255, 210, 127, 0.06);
    border-radius: 4px;
}

.shop-item-title {
    font-weight: 700;
    color: #ffd27f;
}

.shop-item-meta {
    color: #c8b8a6;
    font-size: 0.95rem;
}

.shop-item-desc {
    color: #ddd;
    font-size: 0.95rem;
    margin: 0.2rem 0 0.35rem;
}

.shop-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.35rem;
}

.tag {
    background: #8c3b0e;
    color: #fff;
    padding: 0.05rem 0.35rem;
    border-radius: 3px;
    font-size: 0.8rem;
    margin-left: 0.35rem;
}

.tag.secondary {
    background: #28404f;
    color: #d7ecff;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: start;
}

.admin-grid > div {
    min-width: 0;
}

@media (min-width: 900px) {
    .admin-grid {
        grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    }
}

.admin-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.table-head, .table-row {
    display: grid;
    grid-template-columns: repeat(var(--columns, 6), minmax(0, 1fr));
    gap: 0.35rem;
    align-items: center;
    padding: 0.35rem 0.25rem;
}

.table-head {
    font-weight: 700;
    border-bottom: 1px solid #333;
}

.table-row:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.table-row input[type="text"],
.table-row input[type="email"],
.table-row input[type="number"],
.table-row select {
    width: 100%;
    min-width: 0;
    margin: 0;
}

/* below added to fix spacing and overlap issues */
*, *::before, *::after { box-sizing: border-box; }

.table-scroll { overflow-x: auto; min-width: 0; } 

.user-table .table-head,
.user-table .table-row { min-width: 880px; } 
/* above to fix spacing and overlap issues */


.user-table .table-head,
.user-table .table-row {
    grid-template-columns:
        minmax(120px, 1.35fr)
        minmax(95px, 0.9fr)
        minmax(150px, 1.25fr)
        minmax(105px, 1fr)
        minmax(62px, 0.6fr)
        minmax(140px, 1.05fr)
        minmax(78px, 0.65fr);
}

.stats-table .table-head,
.stats-table .table-row {
    grid-template-columns:
        minmax(150px, 1.5fr)
        repeat(7, minmax(72px, 1fr))
        minmax(85px, 0.75fr);
    min-width: 820px;
}

.table {
    width: 100%;
    overflow-x: auto;
}

.table .table-head,
.table .table-row {
    min-width: 0;
}

.table .table-row > div {
    min-width: 0;
}

.table .table-row > div:first-child {
    overflow-wrap: anywhere;
}

.checkbox-cell {
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-form {
    margin: 0.25rem 0 0.75rem;
}

.search-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.search-row input[type="search"] {
    flex: 1;
    margin: 0;
}

.search-row .btn {
    margin: 0;
}

.muted-note {
    color: #c8b8a6;
    font-size: 0.95rem;
    margin: 0.5rem 0 1rem;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0.35rem 0 0.75rem;
}

.import-form {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.import-form input[type="file"] {
    max-width: 280px;
}

.stacked-form fieldset {
    border: 1px solid #3f1f1f;
    border-radius: 6px;
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.75rem;
}

.stacked-form legend {
    padding: 0 0.35rem;
    color: #ffd27f;
}

@media (max-width: 600px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .topbar .main-nav {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

.attribute-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 1rem; margin: 1rem 0 1.5rem; }
.attribute-card { padding: 1rem; border: 1px solid #66482f; border-radius: 8px; background: #211b17; display: flex; flex-direction: column; }
.attribute-heading { display: flex; justify-content: space-between; align-items: center; color: #ffd27f; }
.attribute-heading strong { font-size: 2rem; }
.attribute-card p { flex: 1; font-size: .9rem; line-height: 1.5; }
.attribute-card .btn { width: 100%; }
.progression-panel { margin: 1rem 0; padding: 1rem; background: #1b1b1b; border: 1px solid #444; border-radius: 8px; }
.progression-panel progress { width: 100%; height: 1rem; margin-top: .6rem; accent-color: #d6a04c; }
.progression-panel summary { cursor: pointer; color: #ffd27f; }
.item-rank { color: #ffd27f; font-size: .85rem; margin-top: .5rem; }
.item-attributes { color: #abd3a5; font-weight: 600; margin: .4rem 0; }
.character-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.character-stats div strong { display: block; width: auto; margin-bottom: .3rem; color: #d4c7b0; font-size: .85rem; }
.attribute-heading abbr { text-decoration: none; }
@media (max-width: 520px) {
    .attribute-grid { grid-template-columns: 1fr; }
    .character-header { align-items: flex-start; }
}

.rarity-rare { color: #8dccff; font-weight: 700; }
.rarity-legendary { color: #ffd27c; font-weight: 700; }
.rarity-epic { color: #d5b0ff; font-weight: 700; }
.rarity-common { color: #b4bcbd; }
.attribute-card progress, .boss-health { width: 100%; accent-color: #d75158; }
.boss-intent { padding: 1rem; border-left: 4px solid #e8a354; background: #30221d; }

.btn:disabled, .btn:disabled:hover { background: #3a3330; color: #aaa19a; border-color: #51463f; cursor: not-allowed; opacity: .75; }

.equipment-comparison { margin: .8rem 0; padding: .8rem; background: #171c1c; border: 1px solid #3f5351; border-radius: 6px; }
.comparison-heading, .comparison-current { margin: 0 0 .5rem; font-size: .9rem; line-height: 1.5; }
.comparison-current { color: #b3c8c4; }
.comparison-locked { color: #ffd08c; font-size: .85rem; margin: .5rem 0; }
.comparison-highlights { list-style: none; padding: 0; margin: .5rem 0; font-size: .85rem; line-height: 1.6; }
.stat-better { color: #8de0ae; }
.stat-worse { color: #ffada5; }
.stat-unchanged { color: #b8c2bf; }
.comparison-details summary { cursor: pointer; color: #d1e6e0; padding: .4rem 0; font-size: .9rem; }
.comparison-details summary:focus-visible { outline: 2px solid #ffd08c; outline-offset: 3px; }
.comparison-table { width: 100%; border-collapse: collapse; font-size: .8rem; table-layout: fixed; }
.comparison-table caption { text-align: left; padding: .5rem 0; font-weight: 700; }
.comparison-table th, .comparison-table td { padding: .4rem .15rem; border-bottom: 1px solid #384340; text-align: right; overflow-wrap: anywhere; }
.comparison-table th:first-child { text-align: left; width: 30%; }
.comparison-table th:last-child { width: 28%; }
.comparison-details .muted-note { margin: .6rem 0 0; font-size: .8rem; }
@media (max-width: 760px) {
    .shop-grid { grid-template-columns: minmax(0, 1fr); overflow-x: visible; }
    .shop-column { min-width: 0; }
}

.adventure-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 1rem; margin: 1rem 0 2rem; }
.adventure-card { padding: 1rem; border: 1px solid #674832; border-radius: 8px; background: #211b17; min-width: 0; }
.adventure-card h3 { margin-top: 0; color: #ffd27f; }
.adventure-card progress { width: 100%; margin: .5rem 0 1rem; accent-color: #d6a04c; }
.adventure-summary, .affinity-list { display: flex; flex-wrap: wrap; gap: .6rem 1.25rem; padding: .75rem; background: #171c1c; border-radius: 6px; }
.tactical-readout { margin: 1rem 0; }
.effect-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 1rem; }
.effect-grid h3 { font-size: 1rem; margin-bottom: .5rem; }
.effect-badge { border-left: 3px solid #e8a354; padding: .5rem .75rem; background: #30221d; }
.combat-help { margin: .75rem 0; padding: .75rem; border: 1px solid #66482f; border-radius: 6px; }
.combat-help summary { cursor: pointer; color: #ffd27f; }
.combat-help dt { font-weight: 700; margin-top: .6rem; }
.combat-help dd { margin: .25rem 0 .75rem; color: #d4c7b0; }
.battle-actions, .combat-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.operations-grid { margin: 1.5rem 0; }
.operations-grid > article { min-width: 0; padding: 1rem; border: 1px solid #66482f; border-radius: 8px; background: #211b17; }
.health-value { color: #ffd27f; font-size: 1.2rem; font-weight: 700; }
.arena-preferences { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; padding: 1rem; border: 1px solid #66482f; border-radius: 8px; }
.arena-preferences select { max-width: 100%; }
.arena-ladder { line-height: 2; }
.achievement-badge { display: inline-block; padding: .3rem .6rem; border-radius: 6px; background: #343534; color: #c2c2bd; font-size: .8rem; font-weight: bold; }
.achievement-earned { border-color: #d6a04c; }
.achievement-earned .achievement-badge { background: #504120; color: #ffe2a8; }
.recent-changes { padding-left: 1.25rem; line-height: 1.8; }
.history-filter { display: flex; flex-wrap: wrap; align-items: end; gap: 1rem; margin: 1.5rem 0; }
.history-filter > div { flex: 1 1 220px; min-width: 0; }
.history-filter label { display: block; margin-bottom: .4rem; }
.history-filter input, .history-filter select { width: 100%; box-sizing: border-box; }
.history-entry { padding: 1rem 0; border-top: 1px solid #66482f; overflow-wrap: anywhere; }
.history-entry h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
.audit-details { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.6; background: #171c1c; padding: 1rem; border-radius: 6px; }
.starter-reminder { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; border-left: 4px solid #d6a04c; }
.starter-reminder h2 { margin-top: 0; }
.guide-steps { list-style: none; counter-reset: guide; padding: 0; margin: 1.5rem 0; }
.guide-step { counter-increment: guide; padding: 1.25rem; margin: 1rem 0; background: #211b17; border: 1px solid #66482f; border-radius: 8px; }
.guide-step h2 { margin-top: 0; font-size: 1.15rem; }
.guide-step h2::before { content: counter(guide) ". "; color: #ffd27f; }
.guide-step p, .guide-builds p { line-height: 1.6; }
.guide-step .step-status { display: inline-block; margin-left: .6rem; font-size: .8rem; color: #ffd27f; }
.guide-step.is-complete { border-color: #57745d; }
.guide-step.is-complete .step-status { color: #8de0ae; }
.guide-builds { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 1rem; margin: 1rem 0; }
.guide-builds h3 { margin-top: 0; color: #ffd27f; }
.guide-attributes dt { font-weight: 700; margin-top: .75rem; }
.guide-attributes dd { margin: .3rem 0 1rem; line-height: 1.5; }
.guide-reward { padding: 1rem; border: 1px solid #d6a04c; border-radius: 8px; }
#starter-progress { width: 100%; margin: .7rem 0; accent-color: #d6a04c; }
.guide-step form, .guide-reward form { margin: 0; }
.guide-step .admin-actions, .starter-reminder { min-width: 0; }
.history-entry summary, .guide-builds ~ details summary { cursor: pointer; padding: .4rem 0; }
.history-entry summary:focus-visible, .card summary:focus-visible { outline: 2px solid #ffd27f; outline-offset: 3px; }
