/* ==========================================================================
   servera-l2.ru — single stylesheet (modern CSS only, no frameworks)
   Identity: dark blue-gray surfaces, red accent (#f73a3c), blue "elite", Onest.
   Sections: tokens · base · header · hero · layout · chips/quick-links · frame
             · server list · chronicle grid · description · widgets · pages
             · server card · forms · page content · pagination · error · footer
             · to-top · admin · responsive · motion
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  --bg: #1b2026;
  --surface: #22262b;
  --surface-2: #2a2d33;
  --surface-3: #2e333a;
  --surface-hover: #373a41;
  --line: #33363c;
  --line-2: #3c3f45;
  --row-border: #262930;
  --text: #eaeaea;
  --text-strong: #fff;
  --muted: #a1a1a1;
  --muted-2: #7d7e80;
  --dim: #5d636f;
  --accent: #f73a3c;
  --accent-hover: #ff4f51;
  --accent-dark: #c22f31;
  --elite: #0a7eae;
  --elite-hover: #1999ce;
  --elite-dark: #0a709a;
  --link: #1999ce;
  --ok: #3fae6a;
  --radius: 8px;
  --radius-lg: 12px;
  --header-h: 60px;
  --container: 1100px;
  --font: 'Onest', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --shadow: 0 10px 28px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/assets/fonts/onest-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/assets/fonts/onest-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--line-2) var(--bg);
}

body {
  margin: 0;
  padding-top: var(--header-h);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

main { flex: 1 0 auto; }

h1, h2, h3, h4 { color: var(--text-strong); line-height: 1.3; margin: 0; }
p { margin: 0; }
ul, ol { margin: 0; }
img { max-width: 100%; }
button { font: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; background: var(--surface-3); padding: 1px 6px; border-radius: 4px; color: var(--text); }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.container {
  width: 100%;
  max-width: calc(var(--container) + 40px);
  margin: 0 auto;
  padding: 0 20px;
}
.container--narrow { max-width: 860px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
}

/* buttons ------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--accent-hover); color: #fff; text-decoration: none; }
.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn--light { background: #fff; color: var(--accent); }
.btn--light:hover { background: #fff; color: var(--accent-dark); }
.btn--ghost { background: var(--surface-3); color: var(--text); border-color: var(--line-2); }
.btn--ghost:hover { background: var(--surface-hover); color: var(--text-strong); }
.btn-ok { background: var(--ok); }
.btn-ok:hover { background: #4fc07b; }
.btn-del { background: var(--accent-dark); }
.btn-del:hover { background: var(--accent); }
.btn--sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-play { min-height: 48px; padding: 12px 24px; font-size: 16px; font-weight: 700; }

/* chips -------------------------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.chip:hover { border-color: var(--accent); color: var(--text-strong); text-decoration: none; }
.chip__count { color: var(--dim); font-size: 12px; }
.chip--current, .chip--current:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip--current .chip__count { color: rgba(255, 255, 255, .8); }
.chip--term { cursor: default; }

/* breadcrumbs -------------------------------------------------------------- */
.crumbs {
  padding: 12px 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted-2);
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text-strong); text-decoration: none; }
.crumbs [aria-current] { color: var(--text); }
.crumb-sep { margin: 0 6px; color: var(--dim); }

/* empty state -------------------------------------------------------------- */
.empty-list {
  padding: 14px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  color: var(--muted-2);
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   3. Header (fixed, rounded bottom corners on desktop)
   -------------------------------------------------------------------------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(35, 38, 43, .94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-row {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text-strong);
  text-decoration: none;
  flex-shrink: 0;
  line-height: 1;
}
.logo:hover { text-decoration: none; }
.logo__mark { display: block; flex-shrink: 0; }
.logo__word {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text-strong);
  white-space: nowrap;
}
.logo__accent { color: var(--accent); }
.logo__tld { color: var(--muted); font-weight: 500; }

.nav { display: none; }
.nav__cta { display: none; }

.header-cta { margin-left: auto; }

.burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.burger:hover { background: var(--surface-hover); border-color: var(--line-2); }
.burger__close { display: none; }
.nav-open .burger__open { display: none; }
.nav-open .burger__close { display: block; }

@media (min-width: 900px) {
  .burger { display: none; }
  .nav {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
  }
  .nav a {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s, color .15s;
  }
  .nav a:hover { background: var(--surface-hover); color: var(--text-strong); text-decoration: none; }
  .nav a[aria-current] { color: var(--text-strong); background: var(--surface-3); }
  .header-cta { margin-left: 8px; }
}

@media (max-width: 899px) {
  .site-header.nav-open .nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 4px 16px 14px;
    box-shadow: var(--shadow);
  }
  .site-header.nav-open .nav a {
    padding: 12px 8px;
    border-bottom: 1px solid var(--row-border);
    color: var(--text);
    font-size: 15px;
    text-decoration: none;
  }
  .site-header.nav-open .nav a:hover { background: transparent; color: var(--text-strong); }
  .site-header.nav-open .nav a[aria-current] { color: var(--accent); }
  .site-header.nav-open .nav .nav__cta {
    display: flex;
    justify-content: center;
    margin-top: 12px;
    padding: 12px;
    border-bottom: 0;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
  }
}

@media (max-width: 479px) {
  .header-row { gap: 8px; }
  .logo { gap: 7px; }
  .logo__word { font-size: 17px; }
  .logo__mark { width: 28px; height: 28px; }
  .header-cta { padding: 0 10px; font-size: 13px; }
}

/* --------------------------------------------------------------------------
   4. Hero (home only)
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  margin-top: 12px;
  min-height: 140px;
  padding: 22px 20px 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background:
    radial-gradient(ellipse 55% 90% at 50% 35%, rgba(247, 58, 60, .12), transparent 70%),
    linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 55%, var(--bg) 100%);
}
.hero__inner { position: relative; z-index: 1; max-width: 600px; }
.hero__title {
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.01em;
}
.hero__tagline { margin-top: 6px; font-size: 14px; color: var(--muted); }
.hero__stats { margin-top: 8px; font-size: 13px; color: var(--muted-2); }
.hero__stats b { color: var(--accent); font-weight: 700; }
.hero__art { display: none; }

@media (min-width: 1024px) {
  .hero { margin-top: 16px; min-height: 250px; padding: 32px 24px 40px; }
  .hero__tagline { margin-top: 8px; font-size: 16px; }
  .hero__stats { margin-top: 10px; }
  .hero__art {
    display: block;
    position: absolute;
    bottom: 0;
    height: 100%;
    max-width: 31%;
    object-fit: contain;
    object-position: bottom;
    pointer-events: none;
    user-select: none;
  }
  .hero__art--left { left: 0; object-position: bottom left; }
  .hero__art--right { right: 0; object-position: bottom right; }
}

/* --------------------------------------------------------------------------
   5. Page grid: content + 300px sidebar
   -------------------------------------------------------------------------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: 16px 0;
}
.layout__main {
  display: grid;
  gap: 20px;
  min-width: 0;
}
.sidebar { min-width: 0; }

.page-head h1 {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}
.intro { font-size: 14px; color: var(--muted); }
.intro strong { color: var(--text-strong); }
.category-desc { margin-top: 8px; font-size: 14px; line-height: 1.6; color: var(--muted); }

/* --------------------------------------------------------------------------
   6. Quick links (home) + chip switcher (category)
   -------------------------------------------------------------------------- */
.quick-links {
  display: grid;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.quick-links__row, .chip-switcher__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}
.quick-links__label, .chip-switcher__label {
  margin-right: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.chip-switcher { display: grid; gap: 10px; }

/* --------------------------------------------------------------------------
   7. Frames
   -------------------------------------------------------------------------- */
.frames-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}
.frames-col {
  display: grid;
  gap: 20px;
  align-content: start;
  min-width: 0;
}

.frame {
  min-width: 0;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  scroll-margin-top: calc(var(--header-h) + 12px);
}
.frame--vip { border-color: var(--accent); }
.frame--elite { border-color: var(--elite); }

.frame-title {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding-left: 12px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-strong);
  line-height: 1.3;
}
.frame-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 1px;
  bottom: 1px;
  width: 4px;
  border-radius: 2px;
  background: var(--accent);
}
.frame--elite .frame-title::before { background: var(--elite); }
.frame-count {
  margin-left: auto;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted-2);
}

/* --------------------------------------------------------------------------
   8. Server list (44px cards)
   -------------------------------------------------------------------------- */
.server-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.server__link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 76px;
  grid-template-areas:
    "name name name"
    "chron rate date";
  align-items: center;
  column-gap: 10px;
  row-gap: 2px;
  min-height: 56px;
  padding: 8px 12px;
  background: var(--surface-3);
  border-bottom: 2px solid var(--row-border);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: background .15s, box-shadow .15s;
}
.server__link:hover, .server__link:focus-visible {
  background: var(--surface-hover);
  box-shadow: inset 0 0 0 1px rgba(247, 58, 60, .55);
  text-decoration: none;
}

.server__name {
  grid-area: name;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.server__name b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
}
.server__crown { flex-shrink: 0; }
.server__type {
  flex-shrink: 0;
  padding: 1px 5px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  line-height: 1.3;
  color: var(--muted-2);
}
.server__chron {
  grid-area: chron;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
}
.server__rate {
  grid-area: rate;
  justify-self: start;
  font-size: 13px;
  font-weight: 600;
  color: var(--link);
  white-space: nowrap;
}
.server__date {
  grid-area: date;
  justify-self: end;
  font-size: 13px;
  white-space: nowrap;
  text-align: right;
}
.server__date--soon { color: var(--accent); font-weight: 700; }
.server__date--future { color: var(--accent); }
.server__date--past { color: var(--muted-2); }
.server__date--none { color: var(--dim); }

/* VIP / elite cards ------------------------------------------------------ */
.server--vip .server__link, .server--vip .server__link:hover {
  background: linear-gradient(90deg, #f73a3c, #c22f31);
  border-bottom-color: rgba(0, 0, 0, .28);
  box-shadow: none;
}
.server--elite .server__link, .server--elite .server__link:hover {
  background: linear-gradient(90deg, #1999ce, #0a7eae);
  border-bottom-color: rgba(0, 0, 0, .28);
  box-shadow: none;
}
.server--vip .server__name b, .server--elite .server__name b { color: #fff; }
.server--vip .server__link { color: #fff; }
.server--elite .server__link { color: #fff; }
.server--vip .server__chron { color: #ffc3b9; }
.server--elite .server__chron { color: #cdeefb; }
.server--vip .server__rate { color: #472a23; }
.server--elite .server__rate { color: #063a52; }
.server--vip .server__date, .server--elite .server__date,
.server--vip .server__date--past, .server--elite .server__date--past { color: #fff; }
.server--vip .server__date--none, .server--elite .server__date--none { color: rgba(255, 255, 255, .7); }
.server--vip .server__type, .server--elite .server__type { color: #fff; border-color: rgba(255, 255, 255, .4); }
.server--pre-vip .server__name b { color: var(--accent); }
.server--pre-elite .server__name b { color: var(--elite-hover); }

/* wide cards: 4 columns --------------------------------------------------- */
@media (min-width: 640px) {
  .server__link {
    grid-template-columns: minmax(0, 1fr) 112px 60px 92px;
    grid-template-areas: "name chron rate date";
    min-height: 44px;
    padding: 6px 12px;
  }
  .server__chron { font-size: 13px; }
  .server__rate { justify-self: start; }
}

@media (min-width: 1024px) {
  /* two-column frames: compact card, chronicle under the name */
  .frames-col .server__link {
    grid-template-columns: minmax(0, 1fr) 50px 80px;
    grid-template-areas:
      "name rate date"
      "chron rate date";
    column-gap: 8px;
  }
  .frames-col .server__type { display: none; }
  .frames-col .server__chron { font-size: 12px; }
}

/* --------------------------------------------------------------------------
   9. Chronicle grid (home)
   -------------------------------------------------------------------------- */
.chronicle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.chronicle-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.chronicle-card:hover { border-color: var(--accent); background: var(--surface-hover); text-decoration: none; }
.chronicle-card__name { font-size: 14px; font-weight: 600; color: var(--text-strong); }
.chronicle-card__count { font-size: 12px; color: var(--muted-2); }

/* --------------------------------------------------------------------------
   10. SEO description (home)
   -------------------------------------------------------------------------- */
.description {
  padding: 20px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted-2);
  text-align: left;
}
.description h2 { margin: 0 0 10px; font-size: 16px; font-weight: 700; }
.description p { margin: 0 0 10px; }
.description p:last-child { margin-bottom: 0; }
.description strong { color: var(--muted); }

/* --------------------------------------------------------------------------
   11. Sidebar widgets
   -------------------------------------------------------------------------- */
.widget {
  margin-bottom: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.widget-title {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
.widget-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.widget-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 7px 9px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
  transition: border-color .15s;
}
.widget-chip:hover { border-color: var(--accent); color: var(--text-strong); text-decoration: none; }
.widget-chip__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget-chip__cnt { color: var(--dim); font-size: 12px; }
.widget-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.widget-text { margin: 0 0 12px; font-size: 13px; line-height: 1.5; color: var(--muted); }

.widget--promo {
  background: linear-gradient(135deg, #f73a3c, #c22f31);
  border-color: transparent;
  color: #fff;
}
.widget--promo .widget-title { color: rgba(255, 255, 255, .85); }
.widget-promo__text { margin: 0 0 14px; font-size: 15px; font-weight: 600; line-height: 1.4; color: #fff; }

/* --------------------------------------------------------------------------
   12. Server page
   -------------------------------------------------------------------------- */
.server-card {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.server-card h1 {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 16px;
  overflow-wrap: anywhere;
}
.server-facts {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  padding: 16px;
  background: var(--surface-3);
  border-radius: var(--radius);
}
.server-facts dt {
  margin-bottom: 3px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted-2);
}
.server-facts dd { margin: 0; font-size: 15px; font-weight: 500; color: var(--text-strong); overflow-wrap: anywhere; }
.server-facts dd a { color: var(--link); }
.server-facts__rel { display: block; margin-top: 2px; font-size: 13px; font-weight: 400; color: var(--muted); }

.chips {
  list-style: none;
  padding: 0;
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.server-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}
.server-host { font-size: 13px; color: var(--muted-2); word-break: break-all; }

@media (min-width: 640px) {
  .server-facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* --------------------------------------------------------------------------
   13. Forms (add / admin)
   -------------------------------------------------------------------------- */
.add-form { max-width: 640px; }
.add-form p, .admin-form p { margin: 0 0 14px; }
.add-form label, .admin-form label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.add-form input[type="text"],
.add-form input[type="date"],
.add-form select,
.add-form input[type="url"],
.admin-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: 15px/1.3 var(--font);
  transition: border-color .15s, box-shadow .15s;
}
.add-form select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 19px, calc(100% - 15px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }
.add-form input::placeholder { color: var(--dim); }
.add-form input:focus, .add-form select:focus, .admin-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(247, 58, 60, .25);
}
.add-form small { display: block; margin-top: 5px; font-size: 12px; color: var(--muted-2); }
.form-submit { margin-top: 18px; }
.form-note { font-size: 12px; color: var(--muted-2); line-height: 1.5; }
.hp-field { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

.form-ok {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: rgba(63, 174, 106, .12);
  border: 1px solid var(--ok);
  border-radius: var(--radius);
  color: #a6dfbd;
  font-size: 14px;
}
.form-errors {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: rgba(247, 58, 60, .1);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: #ffb9ba;
  font-size: 14px;
  line-height: 1.5;
}
.form-errors ul { margin: 6px 0 0; padding-left: 18px; }
.form-errors strong { color: #fff; }
.admin-form { max-width: 360px; }
.logout-form { display: inline-block; margin: 4px 0 0; }

/* --------------------------------------------------------------------------
   14. Page content typography (store pages, instructions)
   -------------------------------------------------------------------------- */
.page-content { font-size: 14px; line-height: 1.7; color: var(--text); }
.page-content h2 { margin: 22px 0 8px; font-size: 18px; font-weight: 700; }
.page-content h3 { margin: 18px 0 6px; font-size: 16px; font-weight: 700; }
.page-content h2:first-child, .page-content h3:first-child { margin-top: 0; }
.page-content p { margin: 0 0 12px; }
.page-content a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.page-content ul, .page-content ol { margin: 0 0 12px; padding-left: 20px; }
.page-content li { margin-bottom: 4px; }
.page-content img { max-width: 100%; height: auto; border-radius: var(--radius); }
.page-content table { width: 100%; margin: 0 0 12px; border-collapse: collapse; font-size: 13px; }
.page-content th, .page-content td { padding: 8px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.page-content th { background: var(--surface-2); color: var(--text-strong); }
.page-content blockquote { margin: 0 0 12px; padding: 4px 0 4px 12px; border-left: 3px solid var(--accent); color: var(--muted); }
.add-instructions { margin-top: 20px; }

/* --------------------------------------------------------------------------
   15. Pagination
   -------------------------------------------------------------------------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.pagination a, .pagination .pg-current, .pagination .pg-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius);
  background: var(--surface-3);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.pagination a:hover { background: var(--surface-hover); color: var(--text-strong); text-decoration: none; }
.pagination .pg-current, .pagination .pg-current:hover { background: var(--accent); color: #fff; font-weight: 700; }
.pagination .pg-dots { background: transparent; color: var(--muted-2); }
.pagination .pg-prev, .pagination .pg-next { padding: 0 14px; }

/* --------------------------------------------------------------------------
   16. Error page
   -------------------------------------------------------------------------- */
.error-page {
  padding: 48px 16px 56px;
  text-align: center;
}
.error-code {
  margin: 0 0 12px;
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
}
.error-page h1 { margin: 0 0 10px; font-size: 24px; font-weight: 700; }
.error-message { margin: 0 0 22px; font-size: 15px; color: var(--muted); }

/* --------------------------------------------------------------------------
   17. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: 32px;
  padding: 28px 0;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}
.footer-brand .logo { margin-bottom: 12px; }
.footer-mail, .footer-copy { font-size: 13px; color: var(--muted-2); line-height: 1.6; }
.footer-mail a { color: var(--muted); }
.footer-mail a:hover { color: var(--text-strong); }
.footer-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer-col a { font-size: 13px; color: var(--muted-2); }
.footer-col a:hover { color: var(--text-strong); text-decoration: none; }
@media (min-width: 768px) {
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr; }
}

/* --------------------------------------------------------------------------
   18. To-top button
   -------------------------------------------------------------------------- */
.to-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 40;
  width: 44px;
  height: 44px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .2s, transform .2s, color .15s, border-color .15s;
}
.to-top span { font-size: 11px; line-height: 1; }
.to-top:hover { color: var(--text-strong); border-color: var(--accent); }
.to-top.visible { opacity: 1; transform: none; pointer-events: auto; }

/* --------------------------------------------------------------------------
   19. Admin
   -------------------------------------------------------------------------- */
.admin-wrap { padding-top: 12px; padding-bottom: 16px; }
.admin-subtitle { margin: 22px 0 10px; font-size: 16px; font-weight: 700; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th {
  padding: 10px 12px;
  background: var(--surface-2);
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  text-align: left;
  white-space: nowrap;
}
.admin-table td { padding: 10px 12px; border-top: 1px solid var(--row-border); vertical-align: top; }
.admin-table tbody tr:first-child td { border-top: 0; }
.admin-table tbody tr:hover td { background: var(--surface-3); }
.admin-table small { color: var(--muted-2); font-size: 12px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-actions form { margin: 0; }
.admin-table .server-host { color: var(--text); }

/* --------------------------------------------------------------------------
   20. Wide screens: sidebar right, two frame columns, rounded header
   -------------------------------------------------------------------------- */
@media (min-width: 1024px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; padding-bottom: 8px; }
  .frames-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-header {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

/* tall viewports: the widgets fit entirely, so the sidebar follows the scroll */
@media (min-width: 1024px) and (min-height: 1060px) {
  .sidebar { position: sticky; top: calc(var(--header-h) + 12px); }
}

@media (min-width: 640px) {
  .container { padding: 0 20px; }
  .error-page { padding: 64px 16px 72px; }
}

/* --------------------------------------------------------------------------
   21. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
