/* Тёмная тема — по умолчанию. Светлая включается через <html data-theme="light"> */
:root {
  color-scheme: dark;
  --paper: #0c1b1b; --card: #122524; --ink: #e3efea; --muted: #93ada7;
  --teal: #43b9a6; --coral: #ff6b5b; --line: #264745; --input: #0c1b1b;
  --on-accent: #0c1b1b; --rooms: #132625;
  --ok-bg: #16352f; --err-bg: #3a1f1c;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Figtree", "Segoe UI", system-ui, sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --paper: #e6ede9; --card: #f7faf8; --ink: #0f2d2c; --muted: #5c7270;
  --teal: #1f7a6d; --coral: #ff5b4a; --line: #c9d6d0; --input: #ffffff;
  --on-accent: #ffffff; --rooms: #0f2d2c;
  --ok-bg: #cfe9df; --err-bg: #ffe0dc;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 4rem; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--paper); color: var(--ink); font: 400 1.0625rem/1.55 var(--body); }
main { flex: 1; }
a { color: inherit; }
h1, h2, .brand { font-family: var(--display); letter-spacing: -0.02em; }
h1 { font-size: clamp(2.1rem, 5vw, 3.6rem); line-height: 1.05; font-weight: 800; margin: 0 0 1rem; }
h2 { font-size: 1.25rem; font-weight: 600; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }

.nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem clamp(1rem, 4vw, 3rem); }
.brand { font-weight: 800; font-size: 1.4rem; text-decoration: none; }
.nav nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.nav nav a:not(.btn) { text-decoration: none; font-weight: 500; }
.nav nav a:not(.btn):hover { text-decoration: underline; }
select, input { font: inherit; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--input); color: var(--ink); width: 100%; }
.nav form.inline { margin: 0; display: inline; }
.linklike { background: none; border: 0; padding: 0; font: inherit; font-weight: 500; color: inherit; cursor: pointer; }
.linklike:hover { text-decoration: underline; }
.nav select { width: auto; padding: .35rem .5rem; }

/* переключатель темы: в тёмной теме показываем солнце, в светлой — луну */
.theme { font: inherit; font-size: 1.15rem; line-height: 1; width: 2.2rem; height: 2.2rem; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.theme:hover { border-color: var(--teal); }
.theme .to-dark { display: none; }
:root[data-theme="light"] .theme .to-light { display: none; }
:root[data-theme="light"] .theme .to-dark { display: inline; }

.btn { display: inline-block; background: var(--ink); color: var(--paper) !important; text-decoration: none; border: 2px solid var(--ink); padding: .7rem 1.2rem; border-radius: 10px; font: 600 1rem var(--body); cursor: pointer; }
.btn:hover { background: var(--teal); border-color: var(--teal); color: var(--on-accent) !important; }
.btn.ghost { background: transparent; color: var(--ink) !important; }
.btn.ghost:hover { background: var(--ink); border-color: var(--ink); color: var(--paper) !important; }
.btn.small { padding: .4rem .85rem; font-size: .95rem; }

main { padding: 0 clamp(1rem, 4vw, 3rem) 4rem; max-width: 1120px; margin: 0 auto; width: 100%; }

/* hero */
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; align-items: center; padding: 3rem 0 4rem; }
.lead { font-size: 1.2rem; max-width: 34rem; color: var(--muted); margin: 0 0 1.6rem; }
.actions { display: flex; gap: .8rem; flex-wrap: wrap; }
.mock { display: grid; gap: 1rem; }
.rooms { background: var(--rooms); color: #dff0ea; border: 1px solid var(--line); border-radius: 16px; padding: 1.1rem 1.2rem; display: grid; gap: .25rem; font-weight: 500; }
.room-cat { color: #86a8a0; font-size: .9rem; margin-bottom: .3rem; }
.room { padding: .35rem .6rem; border-radius: 8px; display: flex; justify-content: space-between; }
.room.creator { background: rgba(255,255,255,.08); }
.room.live span { color: #86a8a0; }
.room.gone { opacity: .35; text-decoration: line-through; text-decoration-color: var(--coral); animation: vanish 5s ease-in-out infinite; }
@keyframes vanish { 0%, 55% { opacity: .9; } 80%, 100% { opacity: .15; } }
.keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.keys span { background: var(--card); border: 1px solid var(--line); border-radius: 10px; text-align: center; padding: .55rem 0; font-size: 1.25rem; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; border-top: 2px solid var(--ink); padding-top: 1.5rem; }
.steps p { margin: 0; color: var(--muted); }
.features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.2rem; border-top: 2px solid var(--ink); padding-top: 1.5rem; }
.feature { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1.3rem 1.5rem; }
.feature ul { margin: .6rem 0 0; padding-left: 1.1rem; color: var(--muted); }
.feature li { margin: .35rem 0; }
.chat-mock { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.1rem; }
.chat-mock span { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: .4rem .9rem; font-weight: 600; font-size: .95rem; }
.langs { margin-top: 3rem; }
.chip { display: inline-block; margin: 0 .5rem .5rem 0; padding: .3rem .8rem; border: 1px solid var(--ink); border-radius: 99px; text-decoration: none; font-weight: 500; }
.chip:hover { background: var(--ink); color: var(--paper); }

/* dashboard */
.page { padding-top: 1.5rem; }
.narrow { max-width: 640px; margin: 0 auto; }
.servers { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .6rem; }
.servers li { display: flex; align-items: center; gap: .9rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .7rem 1rem; }
.servers li strong { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.servers li.dim { background: transparent; border-style: dashed; }
.servers img, .ico { width: 40px; height: 40px; border-radius: 12px; flex: none; }
.ico { display: grid; place-items: center; background: var(--teal); color: var(--on-accent); font-weight: 600; }
.back { color: var(--muted); text-decoration: none; }
.guild-title { display: flex; align-items: center; gap: .8rem; font-size: 2rem; margin-top: 1rem; }
.guild-title img { width: 48px; height: 48px; border-radius: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1.4rem 1.5rem; margin-bottom: 1.2rem; }
.card h2.sub { margin-top: 2rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.card label { display: block; font-weight: 600; margin: 1.1rem 0 .35rem; }
.card .field-label { font-weight: 600; margin: 1.1rem 0 .35rem; }
details.dropdown { position: relative; }
details.dropdown > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--input); }
details.dropdown > summary::-webkit-details-marker { display: none; }
details.dropdown > summary::after { content: "▾"; color: var(--muted); flex: none; }
details.dropdown[open] > summary, details.dropdown > summary:hover { border-color: var(--teal); }
.dd-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-panel { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + .3rem); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .5rem; box-shadow: 0 12px 32px rgba(0, 0, 0, .28); }
.dd-search { margin-bottom: .4rem; }
.dd-list { max-height: 14rem; overflow-y: auto; }
.card .dd-item { display: flex; align-items: center; gap: .55rem; font-weight: 500; margin: 0; padding: .35rem .4rem; border-radius: 6px; cursor: pointer; }
.card .dd-item:hover { background: var(--paper); }
.card .dd-item[hidden] { display: none; }
.dd-item input { width: auto; flex: none; }
.role-dot { width: .7rem; height: .7rem; border-radius: 50%; flex: none; }
.card small { display: block; color: var(--muted); margin: .3rem 0 0; }
.card .btn { margin-top: 1.4rem; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.2rem; margin: .5rem 0 0; }
dt { color: var(--muted); } dd { margin: 0; font-weight: 500; }
.flash { padding: .75rem 1rem; border-radius: 10px; font-weight: 500; }
.flash.ok { background: var(--ok-bg); border: 1px solid var(--teal); }
.flash.err { background: var(--err-bg); border: 1px solid var(--coral); }

/* админка */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin: 1rem 0 2rem; }
.admin-table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.admin-table th, .admin-table td { text-align: left; padding: .65rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table th { color: var(--muted); font-weight: 500; white-space: nowrap; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tr[hidden] { display: none; }
.admin-table .num { font-variant-numeric: tabular-nums; }
.srv { display: flex; align-items: center; gap: .7rem; min-width: 14rem; }
.srv img, .srv .ico { width: 34px; height: 34px; border-radius: 10px; flex: none; }
.srv small { display: block; color: var(--muted); }
.badge { display: inline-block; padding: .05rem .5rem; border-radius: 99px; background: var(--err-bg); border: 1px solid var(--coral); font-size: .8rem; margin-left: .4rem; }
.row-actions { display: flex; gap: .5rem; align-items: flex-start; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.btn.danger { background: var(--coral); border-color: var(--coral); color: #fff !important; }
.btn.danger:hover { filter: brightness(1.1); background: var(--coral); border-color: var(--coral); color: #fff !important; }
details.ban summary { list-style: none; cursor: pointer; display: inline-block; }
details.ban summary::-webkit-details-marker { display: none; }
details.ban form { display: grid; gap: .5rem; margin-top: .5rem; min-width: 15rem; }
.inline-form { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; margin-bottom: 1.2rem; }
.inline-form input { width: auto; flex: 1 1 12rem; }
#filter { max-width: 24rem; margin-top: .6rem; }

/* юридические страницы */
.prose { max-width: 70ch; }
.prose h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.prose h2 { margin: 2rem 0 .4rem; font-size: 1.2rem; }
.prose p, .prose li { color: var(--ink); }
.prose ul { padding-left: 1.2rem; }
.prose a { color: var(--teal); }
.prose table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.prose th, .prose td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }

/* футер */
.footer { border-top: 1px solid var(--line); padding: 1.6rem clamp(1rem, 4vw, 3rem); color: var(--muted); font-size: .95rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer nav { display: flex; gap: .4rem 1.4rem; flex-wrap: wrap; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--ink); text-decoration: underline; }
.footer p { margin: 0; }

@media (max-width: 760px) {
  .hero, .steps, .features { grid-template-columns: 1fr; }
  .hero { padding-top: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) { .room.gone { animation: none; } }
