/* Лут-веб: современный светлый UI (slate / indigo) */
:root {
    --bg-page: #e8edf5;
    --bg-page-2: #eef2f9;
    --surface: rgba(255, 255, 255, 0.94);
    --surface-2: #f8fafc;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: rgba(100, 116, 139, 0.18);
    --border-strong: #cbd5e1;
    --grid-line: #e2e8f0;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-soft: rgba(79, 70, 229, 0.1);
    --accent-glow: rgba(79, 70, 229, 0.22);
    --row-hover: rgba(99, 102, 241, 0.08);
    --row-selected: linear-gradient(90deg, rgba(99, 102, 241, 0.18), rgba(59, 130, 246, 0.12));
    --header-th: linear-gradient(180deg, #f8faff 0%, #e8edf7 100%);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 20px -2px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 40px -8px rgba(15, 23, 42, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --font: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
    --mono: "Cascadia Code", "Consolas", "Lucida Console", ui-monospace, monospace;
    --win-header: #f8fafc;
    --grid: #e2e8f0;
    --row-hover-legacy: var(--row-hover);
    --link: var(--accent);
    --muted: var(--text-muted);
    --border-soft: var(--border);
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition-duration: 0.01ms !important;
    }
}

* {
    box-sizing: border-box;
}

body {
    font: 13px/1.45 var(--font);
    margin: 0;
    min-height: 100vh;
    padding: 16px 20px 32px;
    max-width: 100%;
    width: 100%;
    -webkit-font-smoothing: antialiased;
}

body:not(.lootweb-hero-bg) {
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(99, 102, 241, 0.09), transparent 50%),
        radial-gradient(900px 500px at 0% 100%, rgba(59, 130, 246, 0.07), transparent 45%),
        linear-gradient(165deg, var(--bg-page) 0%, var(--bg-page-2) 100%);
}

/* Как на основном сайте (assets/css/app.css): уголь + фиолетово-золотые блики + полноэкранный hero */
html:has(body.lootweb-hero-bg) {
    height: 100%;
    min-height: 100%;
    background-color: #0a0a0c;
}

body.lootweb-hero-bg {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    color: #ece9e4;
    background-color: #0a0a0c;
    background:
        radial-gradient(ellipse 120% 80% at 50% -20%, rgba(124, 58, 237, 0.08), transparent 50%),
        radial-gradient(ellipse 80% 50% at 100% 50%, rgba(201, 162, 39, 0.04), transparent 45%),
        #0a0a0c;
    padding: 0;
}

body.lootweb-hero-bg .bg-grid {
    opacity: 0;
}

body.lootweb-hero-bg::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    background-color: #0a0a0c;
    background-image: var(--hero-image);
    background-size: cover;
    background-position: 58% 12%;
    background-repeat: no-repeat;
    pointer-events: none;
}

@media (max-width: 720px) {
    body.lootweb-hero-bg::before {
        background-position: 54% 10%;
    }
}

@media (max-width: 480px) {
    body.lootweb-hero-bg::before {
        background-position: 52% 8%;
    }
}

body.lootweb-hero-bg .lootweb-page-inner {
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    max-width: 100%;
    padding: 16px min(4vw, 20px) 32px;
}

body.lootweb-hero-bg main {
    color: var(--text);
}

body.lootweb-hero-bg .lootweb-local-header {
    border-bottom: 1px solid rgba(212, 175, 55, 0.16);
}

body.lootweb-hero-bg h1 a {
    background: linear-gradient(135deg, #faf6ed 0%, #ebe4d4 22%, #d4b24c 42%, #c9a227 55%, #8a6230 78%, #635042 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 14px rgba(201, 162, 39, 0.32));
    border-bottom: none;
}

body.lootweb-hero-bg h1 a:hover {
    opacity: 0.88;
    border-bottom: none;
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
    body.lootweb-hero-bg h1 a {
        background: none;
        color: #ece9e4;
        -webkit-text-fill-color: #ece9e4;
        filter: none;
    }
}

body.lootweb-hero-bg footer {
    color: #9a9590;
}

body.lootweb-hero-bg footer {
    border-top-color: rgba(212, 175, 55, 0.16);
}

body.lootweb-hero-bg main > p > a {
    color: #d4b24c;
}

body.lootweb-hero-bg main > p > a:hover {
    color: #faf6ed;
    border-bottom-color: rgba(201, 162, 39, 0.45);
}

body.lootweb-hero-bg .panel a,
body.lootweb-hero-bg .card a {
    color: var(--accent);
}

body.lootweb-hero-bg .panel a:hover,
body.lootweb-hero-bg .card a:hover {
    color: var(--accent-hover);
    border-bottom-color: rgba(67, 56, 202, 0.35);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: none;
    border-bottom: 1px solid rgba(67, 56, 202, 0.35);
}

h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.25;
}

h1 a {
    color: var(--text);
    border-bottom: none;
    background: linear-gradient(120deg, #1e1b4b, var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: opacity 0.2s ease;
}

h1 a:hover {
    opacity: 0.85;
    border-bottom: none;
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
    h1 a {
        background: none;
        -webkit-text-fill-color: #1e1b4b;
        color: #1e1b4b;
    }
}

h2 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: #1e293b;
}

.muted,
footer {
    color: var(--text-muted);
    font-size: 12px;
}

header.lootweb-local-header {
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

main {
    max-width: 100%;
    margin: 0;
    padding: 0 2px;
    overflow-x: auto;
}

/* Поиск и кнопки */
.search {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 8px 0;
    align-items: center;
}

.search input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    background: #fff;
    color: var(--text);
    font: inherit;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search input:hover {
    border-color: #94a3b8;
}

.search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search button {
    padding: 8px 16px;
    border: none;
    background: linear-gradient(180deg, #6366f1, #4f46e5);
    color: #fff;
    font: inherit;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
    transition: transform 0.12s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.search button:hover {
    filter: brightness(1.05);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

.search button:active {
    transform: translateY(0);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 14px 16px;
    margin-bottom: 12px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.grid {
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: 4px 10px;
    font-size: 13px;
}

.grid dt {
    color: var(--text-muted);
}

ul.inline,
ul.set {
    margin: 4px 0 0;
    padding-left: 1.1rem;
}

ul.inline {
    list-style: none;
    padding: 0;
}

ul.inline li {
    display: inline;
    margin-right: 10px;
}

.count {
    color: var(--text-muted);
    font-size: 12px;
    margin: 0 0 6px;
}

.money,
.warn {
    color: #b45309;
    font-weight: 500;
}

footer {
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* Таблица как ListView */
.table-wrap.listview {
    border: 1px solid var(--grid-line);
    background: #fff;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    overflow-x: auto;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

table.creature-list {
    width: 328px;
    max-width: none;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 13px;
}

.creature-list col.c-cr-name {
    width: 280px;
}

.creature-list col.c-cr-lv {
    width: 48px;
}

.creature-name-link {
    font: inherit;
    color: var(--accent);
    font-weight: 500;
}

.creature-name-link:hover {
    text-decoration: none;
    color: var(--accent-hover);
}

th,
td {
    border: 1px solid var(--grid-line);
    padding: 4px 8px;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

th {
    background: var(--header-th);
    font-weight: 600;
    text-align: left;
    color: #334155;
    font-size: 11px;
    text-transform: none;
    letter-spacing: 0.01em;
}

.creature-list th:nth-child(2),
.creature-list td.num-cell {
    text-align: right;
}

.creature-list tbody tr:nth-child(even) {
    background: #fafbfc;
}

.creature-list tbody tr:hover {
    background: var(--row-hover);
}

.creature-list tbody tr {
    transition: background 0.12s ease;
}

.id-code,
.loot-cell code {
    font: 12px/1.35 var(--mono);
    background: var(--surface-2);
    padding: 1px 4px;
    border-radius: 4px;
    color: #475569;
}

.name-cell {
    text-align: left;
}

.loot-cell {
    text-align: left;
}

/* Детальные блоки лута */
.table-wrap:not(.listview) {
    border: 1px solid var(--grid-line);
    background: #fff;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin-top: 8px;
    box-shadow: var(--shadow-sm);
}

.table-wrap:not(.listview) table {
    width: 100%;
    min-width: 600px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.table-wrap:not(.listview) th,
.table-wrap:not(.listview) td {
    border: 1px solid var(--grid-line);
    padding: 6px 8px;
    text-align: left;
    vertical-align: top;
    white-space: normal;
}

.table-wrap:not(.listview) th {
    background: var(--header-th);
    color: #334155;
}

/* Четыре панели */
.app-top {
    display: grid;
    grid-template-columns:
        minmax(328px, 1fr) minmax(668px, 1.2fr) minmax(404px, 0.75fr) minmax(620px, 1fr);
    gap: 14px 16px;
    align-items: stretch;
    margin-bottom: 16px;
    min-width: 2028px;
}

.panel-catalog .search input {
    min-width: 0;
    flex: 1;
}

@media (max-width: 1200px) {
    .app-top {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 700px) {
    .app-top {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    min-height: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.panel:hover {
    box-shadow: var(--shadow-lg);
}

.panel-title {
    font-size: 0.8rem;
    font-weight: 700;
    margin: 0;
    padding: 10px 12px 8px;
    border-bottom: 1px solid var(--grid-line);
    color: #1e293b;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    letter-spacing: 0.02em;
}

.panel-meta,
.small {
    font-size: 12px;
    margin: 4px 10px;
    line-height: 1.4;
}

.panel-search {
    margin: 8px 10px;
    width: auto;
    flex: 0 0 auto;
}

.w-full {
    flex: 1;
    min-width: 0;
}

.table-panel {
    flex: 1 1 auto;
    min-height: 220px;
    max-height: min(52vh, 560px);
    overflow: auto;
    scrollbar-gutter: stable;
}

/* Тонкие полосы прокрутки (WebKit) */
.table-panel::-webkit-scrollbar,
.creature-list-wrap::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-panel::-webkit-scrollbar-thumb,
.creature-list-wrap::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
}

.table-panel::-webkit-scrollbar-track,
.creature-list-wrap::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 6px;
}

.panel-creatures .creature-list-wrap {
    flex: 1 1 auto;
    min-height: 220px;
    max-height: min(52vh, 560px);
    overflow: auto;
}

/* Таблицы: фиксированные ширины как в ListView */
table.grid-loot,
table.grid-sets {
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 12px;
    max-width: none;
}

table.grid-loot {
    width: 748px;
}

table.grid-loot th:nth-child(1),
table.grid-loot td:nth-child(1) {
    width: 72px;
}

table.grid-loot th:nth-child(2),
table.grid-loot td:nth-child(2) {
    width: 55px;
}

table.grid-loot th:nth-child(3),
table.grid-loot td:nth-child(3) {
    width: 273px;
}

table.grid-loot th:nth-child(4),
table.grid-loot td:nth-child(4) {
    width: 64px;
}

table.grid-loot th:nth-child(5),
table.grid-loot td:nth-child(5) {
    width: 64px;
}

table.grid-loot th:nth-child(6),
table.grid-loot td:nth-child(6) {
    width: 48px;
}

table.grid-loot th:nth-child(7),
table.grid-loot td:nth-child(7) {
    width: 48px;
}

table.grid-loot th:nth-child(8),
table.grid-loot td:nth-child(8) {
    width: 124px;
}

table.grid-sets {
    width: 404px;
}

table.grid-sets th:nth-child(1),
table.grid-sets td:nth-child(1) {
    width: 72px;
}

table.grid-sets th:nth-child(2),
table.grid-sets td:nth-child(2) {
    width: 108px;
}

table.grid-sets th:nth-child(3),
table.grid-sets td:nth-child(3) {
    width: 168px;
}

table.grid-sets th:nth-child(4),
table.grid-sets td:nth-child(4) {
    width: 56px;
}

table.grid-catalog {
    width: 100%;
    min-width: 620px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 12px;
}

.panel-catalog .table-wrap {
    overflow-x: auto;
}

table.grid-catalog th:nth-child(1),
table.grid-catalog td:nth-child(1) {
    width: 120px;
}

table.grid-catalog th:nth-child(2),
table.grid-catalog td:nth-child(2) {
    width: 100px;
}

table.grid-catalog th:nth-child(3),
table.grid-catalog td:nth-child(3) {
    width: auto;
}

table.grid-loot th,
table.grid-loot td,
table.grid-sets th,
table.grid-sets td,
table.grid-catalog th,
table.grid-catalog td {
    border: 1px solid var(--grid-line);
    padding: 4px 6px;
    vertical-align: middle;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

table.grid-sets th:nth-child(3),
table.grid-sets td:nth-child(3) {
    white-space: normal;
    word-break: break-word;
}

table.grid-loot th:nth-child(3),
table.grid-loot td:nth-child(3) {
    white-space: normal;
    word-break: break-word;
}

table.grid-catalog td:nth-child(3) {
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    text-overflow: clip;
}

table.grid-loot th,
table.grid-sets th,
table.grid-catalog th {
    background: var(--header-th);
    font-weight: 600;
    text-align: left;
    font-size: 11px;
    line-height: 1.2;
    padding: 6px 6px;
    color: #334155;
    position: sticky;
    top: 0;
    z-index: 1;
    box-shadow: 0 1px 0 var(--grid-line);
}

/* Первая строка заголовков внутри прокрутки */
.creature-list thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    box-shadow: 0 1px 0 var(--grid-line);
}

.row-selected {
    background: var(--row-selected) !important;
    box-shadow: inset 3px 0 0 #6366f1;
}

.creature-list tbody tr.row-selected:hover {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.24), rgba(59, 130, 246, 0.14)) !important;
    filter: none;
}

.msg-cell {
    white-space: normal;
    max-width: none;
}

.ch-group {
    text-align: left;
}

.panel-creatures {
    grid-column: 1;
}

.table-wrap {
    min-width: 0;
}

code {
    font-family: var(--mono);
    font-size: 0.92em;
    background: var(--surface-2);
    padding: 0.1em 0.35em;
    border-radius: 4px;
}

/* Зебра в общих data-таблицах */
table.grid-loot tbody tr:nth-child(even),
table.grid-sets tbody tr:nth-child(even),
table.grid-catalog tbody tr:nth-child(even) {
    background: #fafbfc;
}

table.grid-loot tbody tr:hover,
table.grid-sets tbody tr:hover,
table.grid-catalog tbody tr:hover {
    background: var(--row-hover);
}

table.grid-loot tbody tr,
table.grid-sets tbody tr,
table.grid-catalog tbody tr {
    transition: background 0.1s ease;
}

tr.row-placeholder {
    background: #fef3c7 !important;
    color: #92400e;
}

tr.row-placeholder:hover {
    background: #fde68a !important;
}
