:root {
    --bg: #050505;
    --bg2: #0b0b0b;
    --panel: rgba(255,255,255,.055);
    --panel2: rgba(255,255,255,.085);
    --card: #0d0d0d;
    --card2: #131313;
    --text: #f5f5f5;
    --muted: #9e9e9e;
    --soft: #d9d9d9;
    --line: rgba(255,255,255,.14);
    --line2: rgba(255,255,255,.25);
    --white: #fff;
    --black: #000;
    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 16px;
    --shadow: 0 24px 80px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
    margin: 0;
    color: var(--text);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai", Arial, sans-serif;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(255,255,255,.14), transparent 27rem),
        radial-gradient(circle at bottom right, rgba(255,255,255,.07), transparent 26rem),
        linear-gradient(135deg, #030303 0%, #101010 42%, #000 100%);
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.shell {
    width: min(1160px, 100%);
    margin: 0 auto;
    padding: 22px 18px 54px;
}

.hero {
    min-height: 330px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: clamp(22px, 5vw, 46px);
    background:
        linear-gradient(145deg, rgba(255,255,255,.10), rgba(255,255,255,.02)),
        linear-gradient(90deg, rgba(255,255,255,.02), rgba(255,255,255,.065));
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(to bottom, #000, transparent 70%);
    opacity: .42;
    pointer-events: none;
}

.brand-line,
.hero-text,
.hero-grid { position: relative; z-index: 1; }

.brand-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand-mark {
    width: 74px;
    height: 74px;
    display: grid;
    place-items: center;
    border-radius: 24px;
    border: 1px solid var(--line2);
    background: #fff;
    color: #000;
    font-weight: 950;
    letter-spacing: -1px;
    box-shadow: 0 18px 38px rgba(255,255,255,.08);
}

.admin-link,
.outline-btn,
.video-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid var(--line2);
    border-radius: 999px;
    color: var(--text);
    background: rgba(0,0,0,.34);
    transition: .18s ease;
}
.admin-link:hover,
.outline-btn:hover,
.video-btn:hover { background: #fff; color: #000; }

.hero-text { margin-top: 52px; max-width: 760px; }
.eyebrow,
.mini-label {
    display: inline-flex;
    margin: 0 0 12px;
    color: #000;
    background: #fff;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .12em;
}
.hero h1 {
    margin: 0;
    font-size: clamp(42px, 9vw, 94px);
    line-height: .94;
    letter-spacing: -4px;
    font-weight: 950;
}
.hero p {
    margin: 18px 0 0;
    color: var(--soft);
    font-size: clamp(15px, 2.4vw, 20px);
}

.hero-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 38px;
}
.stat-card {
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(0,0,0,.28);
    padding: 18px;
}
.stat-card span { display: block; font-size: 30px; font-weight: 900; }
.stat-card small { color: var(--muted); }

.maintenance-banner,
.notice-card,
.control-panel,
.fix-card,
.info-card,
.category-block {
    border: 1px solid var(--line);
    background: rgba(0,0,0,.42);
    backdrop-filter: blur(14px);
    box-shadow: 0 20px 60px rgba(0,0,0,.28);
}

.maintenance-banner {
    margin-top: 16px;
    border-radius: 22px;
    padding: 16px 18px;
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
}
.maintenance-banner strong {
    color: #000;
    background: #fff;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 12px;
}
.maintenance-banner span { color: var(--soft); }

.notice-card {
    margin-top: 18px;
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}
.notice-card p { margin: 0; color: var(--soft); line-height: 1.75; }

.control-panel {
    margin-top: 18px;
    border-radius: var(--radius-lg);
    padding: 14px;
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto;
    align-items: center;
    gap: 12px;
}
.search-wrap {
    height: 52px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255,255,255,.06);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
}
.search-wrap span { color: var(--muted); font-size: 24px; }
.search-wrap input {
    width: 100%;
    border: 0;
    outline: 0;
    color: #fff;
    background: transparent;
}
.search-wrap input::placeholder { color: #777; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.filter-chip {
    min-height: 42px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: #fff;
    background: transparent;
}
.filter-chip.active { background: #fff; color: #000; border-color: #fff; font-weight: 800; }

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 18px;
    margin-top: 18px;
    align-items: start;
}
.group-title {
    margin: 26px 0 10px;
    color: #fff;
    font-size: 13px;
    font-weight: 950;
    letter-spacing: .15em;
    opacity: .78;
}
.group-title:first-child { margin-top: 0; }

.category-block {
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 14px;
}
.category-header {
    width: 100%;
    border: 0;
    color: #fff;
    background: transparent;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 18px;
    text-align: left;
}
.category-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: #fff;
    color: #000;
    font-weight: 950;
}
.category-header strong { display: block; font-size: 22px; letter-spacing: -.5px; }
.category-header small { display: block; color: var(--muted); margin-top: 3px; }
.category-header em {
    font-style: normal;
    color: #000;
    background: #fff;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 850;
}
.item-grid {
    display: grid;
    gap: 10px;
    padding: 0 14px 14px;
}
.item-card {
    border: 1px solid var(--line);
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(255,255,255,.055), rgba(255,255,255,.02));
    overflow: hidden;
}
.item-card.is-pinned { border-color: rgba(255,255,255,.5); }
.item-top {
    width: 100%;
    border: 0;
    color: #fff;
    background: transparent;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 14px;
    text-align: left;
}
.thumb-wrap {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    overflow: hidden;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    background: #fff;
    color: #000;
    font-weight: 950;
    font-size: 26px;
}
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-name-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.item-main h3 {
    margin: 0;
    font-size: 18px;
    letter-spacing: -.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pin {
    color: #000;
    background: #fff;
    border-radius: 999px;
    padding: 3px 7px;
    font-size: 10px;
    font-weight: 950;
}
.item-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; color: var(--muted); font-size: 13px; }
.item-side { display: flex; align-items: center; gap: 10px; }
.badge {
    min-width: 96px;
    text-align: center;
    border: 1px solid var(--line2);
    border-radius: 999px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 850;
}
.badge.active { background: #fff; color: #000; border-color: #fff; }
.badge.updating { color: #fff; background: rgba(255,255,255,.10); }
.badge.closed { color: #9c9c9c; background: rgba(0,0,0,.30); }
.open-dot {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--line);
    color: #fff;
    transition: .18s ease;
}
.item-card.open .open-dot { transform: rotate(45deg); background: #fff; color: #000; }
.item-detail {
    display: none;
    border-top: 1px solid var(--line);
    padding: 14px;
}
.item-card.open .item-detail { display: block; }
.detail-text {
    color: var(--soft);
    line-height: 1.75;
    padding: 14px;
    border-radius: 16px;
    background: rgba(0,0,0,.28);
    border: 1px solid var(--line);
}
.disabled-note {
    margin-top: 10px;
    color: #fff;
    border: 1px dashed var(--line2);
    border-radius: 16px;
    padding: 12px;
    background: rgba(255,255,255,.045);
}
.download-list { display: grid; gap: 10px; margin-top: 12px; }
.download-btn {
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-radius: 18px;
    padding: 0 16px;
    background: #fff;
    color: #000;
    font-weight: 900;
}
.download-btn b { font-size: 19px; }
.video-btn { margin-top: 12px; width: 100%; }

.side-panel { position: sticky; top: 18px; display: grid; gap: 14px; }
.fix-card,
.info-card {
    border-radius: var(--radius-lg);
    padding: 20px;
}
.fix-card h2 { margin: 4px 0 10px; }
.fix-card p,
.info-card p { color: var(--soft); line-height: 1.75; margin: 0; }
.info-card strong { display: block; margin-bottom: 8px; }
.empty-state {
    border: 1px dashed var(--line2);
    border-radius: var(--radius-lg);
    padding: 30px;
    color: var(--muted);
    text-align: center;
}

.toast {
    position: fixed;
    z-index: 99;
    left: 50%;
    top: 16px;
    transform: translateX(-50%) translateY(-14px);
    opacity: 0;
    pointer-events: none;
    width: min(520px, calc(100% - 28px));
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line2);
    border-radius: 18px;
    padding: 14px;
    background: rgba(8,8,8,.92);
    color: #fff;
    box-shadow: var(--shadow);
    transition: .18s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast-dot { width: 10px; height: 10px; border-radius: 50%; background: #fff; flex: 0 0 auto; }
.toast-close { margin-left: auto; border: 0; color: #fff; background: transparent; font-size: 24px; }

/* Admin */
.admin-body {
    background:
        radial-gradient(circle at top right, rgba(255,255,255,.12), transparent 28rem),
        linear-gradient(135deg, #050505, #111);
}
.admin-wrap {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 22px 16px 60px;
}
.admin-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 20px;
    background: rgba(0,0,0,.35);
}
.admin-head h1 { margin: 0; font-size: clamp(28px, 5vw, 46px); letter-spacing: -1.5px; }
.admin-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-nav a,
.admin-btn {
    border: 1px solid #fff;
    border-radius: 999px;
    min-height: 42px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #000;
    font-weight: 850;
}
.admin-nav a.ghost,
.admin-btn.ghost { background: transparent; color: #fff; border-color: var(--line2); }
.admin-card,
.login-box {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(0,0,0,.40);
    padding: 20px;
    margin-bottom: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-box { width: min(440px, calc(100% - 28px)); margin: 9vh auto; }
.admin-card h2,
.login-box h1 { margin: 0 0 16px; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.admin-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.admin-grid.full { grid-template-columns: 1fr; }
.admin-field { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.admin-field input,
.admin-field select,
.admin-field textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255,255,255,.055);
    color: #fff;
    min-height: 46px;
    padding: 10px 12px;
    outline: 0;
}
.admin-field textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.admin-field select option { background: #111; color: #fff; }
.checkbox-row { display: flex; align-items: center; gap: 9px; color: #fff; margin: 12px 0; }
.checkbox-row input { width: 18px; height: 18px; accent-color: #fff; }
.category-admin {
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 14px;
    margin-bottom: 12px;
    background: rgba(255,255,255,.035);
}
.item-admin {
    border: 1px dashed var(--line2);
    border-radius: 18px;
    padding: 14px;
    margin-top: 12px;
}
.item-admin h3 { margin: 0 0 12px; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.success,
.error {
    border-radius: 16px;
    padding: 12px 14px;
    margin-bottom: 12px;
    border: 1px solid var(--line2);
}
.success { background: rgba(255,255,255,.12); color: #fff; }
.error { background: rgba(255,255,255,.06); color: #fff; }
.mini-note { color: var(--muted); margin: 4px 0 0; line-height: 1.65; }
pre.detail-box {
    white-space: pre-wrap;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 12px;
    color: var(--soft);
    background: rgba(0,0,0,.35);
}

@media (max-width: 900px) {
    .hero-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .control-panel { grid-template-columns: 1fr; }
    .filter-row { justify-content: flex-start; }
    .content-grid { grid-template-columns: 1fr; }
    .side-panel { position: static; }
    .admin-grid,
    .admin-grid.three { grid-template-columns: 1fr; }
    .admin-head { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
    .shell { padding: 12px 10px 40px; }
    .hero { border-radius: 24px; min-height: 300px; }
    .brand-mark { width: 62px; height: 62px; border-radius: 20px; }
    .hero h1 { letter-spacing: -2px; }
    .notice-card { flex-direction: column; align-items: stretch; }
    .category-header { grid-template-columns: auto 1fr; }
    .category-header em { grid-column: 1 / -1; width: fit-content; }
    .item-top { grid-template-columns: auto 1fr; }
    .item-side { grid-column: 1 / -1; justify-content: space-between; }
    .badge { min-width: auto; }
}
