:root {
  --c-primary: #0f766e;
  --c-secondary: #134e4a;
  --c-button: #0f766e;
  --c-header: #0f172a;
  --c-footer: #0f172a;
  --bg: #f6f7f9;
  --card: #fff;
  --text: #0f172a;
  --muted: #4b5563;
  --line: #e5e7eb;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(15, 23, 42, .06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
[data-theme="dark"] {
  --bg: #0b1220;
  --card: #121a2a;
  --text: #e8eef7;
  --muted: #9aa7b8;
  --line: #243044;
  --shadow: none;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
img { max-width: 100%; height: auto; display: block; }
a { color: #0d6b64; text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { width: min(1120px, calc(100% - 32px)); margin-inline: auto; }
.sr-only, .hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip-link { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px; }
.skip-link:focus { left: 8px; z-index: 10; }
.site-header { background: var(--c-header); color: #fff; position: sticky; top: 0; z-index: 20; }
.header-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "brand actions"
    "search search"
    "panel panel";
  align-items: center;
  gap: 12px 16px;
  padding: 14px 0;
}
.brand { grid-area: brand; display: flex; align-items: center; gap: 12px; color: #fff; font-weight: 700; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand img, .brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
}
.brand-mark {
  background: var(--c-primary);
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
}
.brand-name { font-size: 1.05rem; letter-spacing: -.01em; }
.header-actions { grid-area: actions; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.header-search .btn,
.header-advertise {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 108px;
  min-width: 108px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  font: inherit;
  font-size: .875rem;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1;
  text-transform: none;
  border-radius: 10px;
  white-space: nowrap;
}
.header-advertise {
  background: #f59e0b;
  color: #0f172a !important;
  box-shadow: 0 1px 4px rgba(245, 158, 11, .28);
}
.header-advertise:hover, .header-advertise:focus-visible {
  text-decoration: none;
  color: #0f172a !important;
  filter: brightness(1.08);
}
.fab-add {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  background: var(--c-primary);
  color: #fff !important;
  padding: .62rem .95rem .62rem .8rem;
  min-height: 42px;
  border-radius: 10px;
  font: inherit;
  font-size: .9375rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .01em;
  box-shadow:
    0 8px 20px rgba(15, 23, 42, .22),
    0 3px 8px rgba(15, 118, 110, .35);
  transform: translateY(0);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.fab-add:hover, .fab-add:focus-visible {
  text-decoration: none;
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow:
    0 10px 24px rgba(15, 23, 42, .26),
    0 4px 10px rgba(15, 118, 110, .4);
}
.fab-add svg { flex-shrink: 0; display: block; width: 16px; height: 16px; }
.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--c-button);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: .78rem 1.25rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .01em;
  min-height: 48px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; color: #fff; }
.btn-ghost { background: transparent; color: var(--c-primary); border: 1px solid var(--line); }
.btn-ghost:hover, .btn-ghost:focus-visible {
  color: var(--c-primary);
  background: color-mix(in srgb, var(--c-primary) 10%, var(--card));
  filter: none;
}
.btn-lg { padding: .85rem 1.45rem; font-size: 1.05rem; min-height: 52px; }
.icon-btn { background: transparent; border: 0; color: #fff; cursor: pointer; padding: 8px; }
.theme-toggle {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, #fff 18%, transparent);
  font-size: 1rem;
}
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  background: transparent;
  border: 1px solid color-mix(in srgb, #fff 18%, transparent);
  border-radius: 10px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
  transition: transform .15s ease, opacity .15s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.site-nav { grid-area: panel; display: none; min-width: 0; }
.theme-toggle-menu { display: none; }
.header-search {
  grid-area: search;
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-width: 0;
}
.header-search[hidden] { display: none; }
.header-search input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: 42px;
  min-height: 42px;
  padding: 0 .9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font: inherit;
}
.header-search .btn {
  background: var(--c-button);
  color: #fff;
}
.hero-search input, input, select, textarea {
  width: 100%; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--text); font: inherit;
}
textarea { min-height: 120px; }
.hero { background: linear-gradient(180deg, var(--c-header), #1e293b); color: #fff; padding: 40px 0 36px; }
.hero h1 { font-size: clamp(1.55rem, 3vw, 2.15rem); line-height: 1.25; margin: 0 0 12px; max-width: none; }
.muted { color: var(--muted); }
.lead { max-width: none; color: #e2e8f0; }
.hero-search { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 24px; max-width: 720px; }
.section { padding: 40px 0; }
.section.alt { background: color-mix(in srgb, var(--c-primary) 6%, var(--bg)); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.section-head h2, h1, h2, h3 { line-height: 1.25; }
.grid.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-ad { grid-column: 1 / -1; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 14px;
  align-items: start;
}
.card-media img, .card-fallback, .detail-icon {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: cover;
}
.card-fallback { background: var(--c-primary); color: #fff; display: grid; place-items: center; font-size: 1.4rem; font-weight: 700; }
.card-body { min-width: 0; }
.card-title { margin: .2rem 0 .4rem; font-size: 1.05rem; }
.card-title a { color: var(--text); }
.card-desc { color: var(--muted); margin: 0 0 8px; font-size: .92rem; }
.card-stats { list-style: none; padding: 0; margin: 0; color: var(--muted); font-size: .85rem; display: flex; flex-wrap: wrap; gap: 8px 12px; }
.card-actions { grid-column: 2; display: flex; gap: 8px; align-items: stretch; }
.card-actions .btn,
.detail-actions .btn {
  padding: .62rem .85rem;
  font-size: .9375rem;
  font-weight: 700;
  line-height: 1.2;
  min-height: 42px;
  border-radius: 10px;
  white-space: nowrap;
}
.card-actions .btn {
  flex: 1 1 0;
  min-width: 0;
}
.pill { font-size: .72rem; border-radius: 999px; padding: .15rem .5rem; background: #e2e8f0; color: #334155; }
.pill-group { background: #ccfbf1; color: #115e59; }
.pill-channel { background: #dbeafe; color: #1e3a8a; }
.pill-community { background: #fce7f3; color: #9d174d; }
.pill-ok { background: #dcfce7; color: #166534; }
.pill-feat { background: #fef3c7; color: #92400e; }
.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; }
.chip { display: inline-flex; gap: 8px; align-items: center; padding: .45rem .8rem; background: var(--card); border: 1px solid var(--line); border-radius: 999px; color: var(--text); }
.chip span { color: var(--muted); }
.page { padding: 28px 0 56px; }
.page-head h1 { margin-bottom: 8px; }
.toolbar, .filters, .sort-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 16px 0; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; color: var(--muted); }
.breadcrumbs a { text-decoration: underline; text-underline-offset: 2px; }
.facts a { text-decoration: underline; text-underline-offset: 2px; }
.breadcrumbs li:not(:last-child)::after { content: "/"; margin-left: 6px; color: #94a3b8; }
.detail-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 14px;
  align-items: start;
  margin-bottom: 24px;
}
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.share-panel { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 20px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.share-panel[hidden] { display: none; }
.share-panel p { margin: 0 8px 0 0; font-weight: 600; }
.share-panel a, .share-panel button { color: var(--c-primary); background: none; border: 0; padding: 4px 8px; cursor: pointer; font: inherit; }
.detail-grid { display: grid; grid-template-columns: 1fr 280px; gap: 24px; }
.facts { list-style: none; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.facts li { margin: 0 0 10px; }
.form label { display: block; margin: 0 0 12px; font-weight: 600; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form fieldset { border: 1px solid var(--line); border-radius: 12px; margin: 0 0 16px; padding: 16px; }
.type-pick { display: flex; flex-wrap: wrap; gap: 12px; }
.hint { color: var(--muted); font-weight: 400; font-size: .85rem; }
.hint.is-error { color: #b91c1c; font-weight: 600; }
#icon-preview img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; margin-top: 8px; border: 1px solid var(--line); }
.site-footer { background: var(--c-footer); color: #cbd5e1; padding: 40px 0 16px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 24px; }
.site-footer a, .site-footer h2 { color: #fff; }
.site-footer .brand-name { color: #fff; max-width: none; }
.site-footer .muted, .site-footer .footer-bottom p { color: #94a3b8; }
.site-footer nav { display: flex; flex-direction: column; gap: 6px; }
.site-footer h2 { font-size: .95rem; margin: 0 0 8px; }
.footer-bottom { border-top: 1px solid #334155; margin-top: 24px; padding-top: 12px; padding-bottom: 72px; }
.flash { width: min(1120px, calc(100% - 32px)); margin: 12px auto; padding: 12px 14px; border-radius: 10px; }
.flash-success { background: #dcfce7; color: #166534; }
.flash-error { background: #fee2e2; color: #991b1b; }
.empty { background: var(--card); border: 1px dashed var(--line); padding: 24px; border-radius: 12px; }
.pagination { display: flex; gap: 12px; align-items: center; margin-top: 24px; }
.table { width: 100%; border-collapse: collapse; background: var(--card); }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 10px; text-align: left; }
.posts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.post-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; padding: 0 0 14px; }
.post-card img { width: 100%; height: 160px; object-fit: cover; }
.post-card h2, .post-card h3, .post-card p { padding: 0 14px; }
.prose img { border-radius: 12px; }
.prose.plain { white-space: pre-line; }
.listing-related,
.comments {
  content-visibility: auto;
  contain-intrinsic-size: auto 480px;
}
.ad-slot { margin: 16px 0; text-align: center; }
.modal { border: 0; border-radius: 16px; padding: 20px; width: min(480px, 100%); }
.comment { border-bottom: 1px solid var(--line); padding: 12px 0; }
.comment p { white-space: pre-line; }
.focus-ring:focus-visible, a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--c-primary) 50%, white); outline-offset: 2px;
}
@media (max-width: 980px) {
  .grid.cards, .posts, .footer-grid, .detail-grid { grid-template-columns: 1fr 1fr; }
  .form .row { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .header-inner {
    grid-template-areas:
      "brand actions"
      "search search"
      "panel panel";
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 8px;
    padding: 10px 0 12px;
  }
  .nav-toggle { display: inline-flex; }
  .theme-toggle-bar { display: none; }
  .site-nav {
    display: none;
    flex-direction: column;
    gap: 0;
    padding: 4px 0 2px;
    border-top: 1px solid color-mix(in srgb, #fff 12%, transparent);
  }
  .site-nav.open { display: flex; }
  .site-nav a {
    color: #fff;
    font-weight: 600;
    padding: 12px 2px;
    border-bottom: 1px solid color-mix(in srgb, #fff 10%, transparent);
  }
  .site-nav a:hover { text-decoration: none; color: #5eead4; }
  .theme-toggle-menu {
    display: inline-flex;
    align-self: flex-start;
    gap: 8px;
    width: auto;
    min-width: 0;
    margin-top: 10px;
    padding: 0 12px;
    color: #fff;
    font: inherit;
    font-weight: 600;
  }
  .header-advertise {
    width: auto;
    min-width: 0;
    padding: 0 .85rem;
  }
  .grid.cards, .posts, .footer-grid, .detail-grid, .hero-search { grid-template-columns: 1fr; }
  .detail-hero { grid-template-columns: auto 1fr; }
  .brand .brand-name { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .card-media img, .card-fallback, .detail-icon {
    width: 64px;
    height: 64px;
    border-radius: 14px;
  }
  .card-actions,
  .detail-actions { gap: 8px; }
  .card-actions .btn,
  .detail-actions .btn {
    min-height: 42px;
    font-size: .9375rem;
    padding: .62rem .85rem;
  }
}
