:root {
  --font-inter: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-condensed: "Arial Narrow", "Roboto Condensed", "Segoe UI", Arial, sans-serif;
  --font-geist-mono: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --background: #0b0e0c;
  --panel: #171c18;
  --panel-raised: #202621;
  --border: #364039;
  --text: #edf1eb;
  --muted: #9ca69f;
  --accent: #b6f000;
  --accent-active: #92c500;
  --php-bg: var(--background);
  --php-panel: var(--panel);
  --php-panel2: var(--panel-raised);
  --php-line: var(--border);
  --php-text: var(--text);
  --php-muted: var(--muted);
  --php-green: var(--accent);
}

html { color-scheme: dark; background: var(--background); }
body {
  margin: 0;
  min-width: 320px;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-inter);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; }
h1, h2, h3, .brand { text-wrap: balance; }

/* Header */
.site-header.php-header {
  height: 76px;
  padding-inline: max(24px, calc((100vw - 1440px) / 2));
  border-color: rgba(191, 204, 194, .18);
  background: rgba(8, 11, 9, .96) !important;
}
.php-header .brand { flex: 0 0 auto; gap: 11px; font-size: 24px; letter-spacing: -.02em; }
.gml-logo { width: 34px; height: 34px; object-fit: contain; }
.php-header .main-nav { gap: 5px; margin-left: 35px; }
.php-header .main-nav a {
  padding: 10px 11px;
  border-radius: 5px;
  color: #bdc5bf;
  font-size: 14px;
  font-weight: 700;
}
.php-header .main-nav a:hover,
.php-header .main-nav a[aria-current="page"] { background: #1a211b; color: var(--accent); }
.php-header .header-actions { gap: 8px; }
.php-header .saved-button,
.php-header .account-link,
.php-header .submit-header-button { min-height: 42px; border-radius: 6px; }
.php-header .saved-button { padding: 0; }
.php-header .account-link { max-width: 180px; }

/* Generic page shell */
.php-shell { width: min(1280px, calc(100% - 48px)); padding: 54px 0 100px; }
.php-narrow { width: min(880px, calc(100% - 48px)); padding: 58px 0 100px; }
.php-page-title {
  margin: 8px 0 16px;
  font-family: var(--font-condensed);
  font-size: clamp(48px, 6vw, 76px);
  font-weight: 850;
  letter-spacing: -.045em;
  line-height: .98;
}
.php-kicker, .eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.php-lead { max-width: 760px; margin: 0; color: var(--muted); font-size: 18px; line-height: 1.65; }
.php-section { padding: 54px 0 0; }
.php-section-head { margin-bottom: 25px; }
.php-section h2, .php-section-head h2 { font-family: var(--font-condensed); font-size: 44px; line-height: 1; }
.php-section-head > a { color: var(--accent); font-weight: 800; }

/* Homepage */
.php-home { width: 100%; padding: 0; }
.php-home .php-hero {
  position: relative;
  min-height: 620px;
  display: block;
  overflow: hidden;
  padding: 0;
  border-bottom: 1px solid var(--border);
  background: #0a0d0b;
}
.php-home .php-hero-image {
  position: absolute;
  inset: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  filter: saturate(.82) contrast(1.04);
}
.php-home .php-hero-image::after {
  background: linear-gradient(90deg, #090c0a 0%, rgba(9,12,10,.96) 32%, rgba(9,12,10,.64) 55%, rgba(9,12,10,.08) 82%), linear-gradient(0deg, rgba(8,11,9,.75), transparent 48%);
}
.php-hero-copy {
  position: relative;
  z-index: 2;
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
  padding: 100px 0 84px;
}
.php-home .php-hero h1 {
  max-width: 780px;
  margin: 10px 0 24px;
  font-family: var(--font-condensed);
  font-size: clamp(72px, 8.3vw, 118px);
  font-weight: 900;
  letter-spacing: -.06em;
  line-height: .86;
}
.php-home .php-hero .php-lead { max-width: 650px; color: #b9c2bb; font-size: 20px; }
.php-home .php-actions { margin-top: 30px; }
.php-home-content { width: min(1280px, calc(100% - 48px)); margin: 0 auto; padding-bottom: 110px; }
.php-quick-grid {
  position: relative;
  z-index: 3;
  width: min(1400px, calc(100% - 40px));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: -1px auto 0;
  border-left: 1px solid var(--border);
}
.php-quick-card {
  position: relative;
  min-height: 132px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 15px;
  padding: 24px;
  border: solid var(--border);
  border-width: 1px 1px 1px 0;
  background: #111512;
  transition: background-color 150ms ease, box-shadow 150ms ease, color 150ms ease;
}
.php-quick-card:hover,
.php-quick-card:focus-visible {
  z-index: 2;
  border-color: var(--accent);
  background: #171d18;
  box-shadow: inset 0 0 0 1px var(--accent);
  outline: 0;
}
.php-quick-card > .gml-icon { width: 36px; height: 36px; color: var(--accent); }
.php-quick-card span { display: grid; gap: 5px; }
.php-quick-card b { font-family: var(--font-condensed); font-size: 23px; }
.php-quick-card small { color: var(--muted); }
.php-quick-card strong { color: var(--accent); font-size: 21px; }
.gallery-sort-item { cursor: grab; transition: opacity .15s, transform .15s; }
.gallery-sort-item.dragging { opacity: .45; transform: scale(.97); }
.drag-handle { display: block; color: var(--accent); font-size: 12px; font-weight: 800; margin-bottom: 8px; }
.gallery-sort-form { margin-top: 14px; }
.search-live { position: relative; }
.search-suggestions { position: absolute; z-index: 30; left: 0; right: 110px; top: calc(100% - 18px); display: grid; background: #0d120f; border: 1px solid var(--border); box-shadow: 0 18px 50px #000; }
.search-suggestions:empty { display: none; }
.search-suggestions a { display: flex; justify-content: space-between; gap: 16px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.search-suggestions a:hover { background: #171d18; color: var(--accent); }
.search-suggestions small { color: var(--muted); }

/* Buttons and inputs */
.php-button, .button {
  min-height: 46px;
  padding: 0 17px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #161b17;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}
.php-button:hover, .button:hover { border-color: #71806f; background: #1e251f; }
.php-button.primary, .button.primary, button.primary { border-color: var(--accent); background: var(--accent); color: #0a0d0b; }
.php-button.primary:hover, .button.primary:hover { background: var(--accent-active); }
.php-input, .php-form input, .php-form select, .php-form textarea, .php-toolbar input, .php-toolbar select {
  min-height: 48px;
  padding: 11px 13px;
  border-color: var(--border);
  border-radius: 6px;
  background: #0c100d;
  color: var(--text);
  font-size: 15px;
}
.php-form textarea { min-height: 145px; }
.php-toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) 230px auto; margin: 30px 0; }

/* Catalog */
.catalog-page-hero {
  min-height: 340px;
  display: grid;
  grid-template-columns: 1fr minmax(320px, 470px);
  align-items: end;
  gap: 45px;
  padding: 70px max(24px, calc((100vw - 1280px) / 2));
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, #0b0f0c 0%, rgba(11,15,12,.94) 52%, rgba(11,15,12,.52)), url("../media/hero-workshop.png") center/cover;
}
.catalog-page-hero h1 { margin: 0; font-family: var(--font-condensed); font-size: clamp(55px, 6vw, 78px); line-height: .95; }
.catalog-page-hero p:not(.php-kicker) { max-width: 680px; color: var(--muted); font-size: 18px; }
.catalog-page-content { width: min(1280px, calc(100% - 48px)); margin: 0 auto; padding: 50px 0 110px; }
.catalog-page-content .php-toolbar { margin-top: 0; }
.php-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.php-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.catalog-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
  transition: transform 160ms ease, border-color 160ms ease;
}
.catalog-card:hover { transform: translateY(-3px); border-color: #79867c; }
.catalog-image { position: relative; display: block; aspect-ratio: 4/3; overflow: hidden; background: #0e120f; }
.catalog-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 220ms ease; }
.catalog-card:hover .catalog-image img { transform: scale(1.025); }
.catalog-body { padding: 19px; }
.catalog-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.catalog-meta span { display: inline-flex; align-items: center; gap: 6px; }
.catalog-meta span:first-child { color: #c9eb83; }
.catalog-body h3 { margin: 13px 0 8px; font-size: 21px; line-height: 1.2; }
.catalog-body > p { min-height: 66px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.catalog-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.catalog-footer a { color: var(--text); font-weight: 800; }
.type-badge { z-index: 2; }

/* Detail */
.detail-page.php-shell { padding-top: 36px; }
.php-material-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr);
  min-height: 570px;
  margin-top: 22px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.php-material-media { min-height: 570px; background: #0a0d0b; }
.php-material-media img { width: 100%; height: 100%; object-fit: cover; }
.php-material-panel { padding: 38px; background: var(--panel); }
.php-material-panel h1 { margin: 18px 0 12px; font-family: var(--font-condensed); font-size: clamp(39px, 4vw, 55px); line-height: .98; }
.php-material-panel > p { color: var(--muted); line-height: 1.65; }
.php-material-info { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 24px 0; padding: 20px 0; border-block: 1px solid var(--border); }
.php-material-info span { display: grid; gap: 2px; color: var(--muted); font-size: 12px; }
.php-material-info b { color: var(--text); font-size: 14px; }
.php-material-actions { display: grid; gap: 9px; }
.php-material-actions > *, .php-material-actions form .php-button { width: 100%; }
.php-material-content { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 55px; padding: 60px 0; }
.php-material-content > article { font-size: 17px; line-height: 1.8; }
.php-material-content h2 { font-family: var(--font-condensed); font-size: 42px; line-height: 1; }
.php-material-side { display: grid; align-content: start; gap: 12px; }
.php-material-stat { display: grid; grid-template-columns: 34px 1fr; gap: 2px 10px; padding: 20px; border: 1px solid var(--border); border-radius: 7px; background: var(--panel); }
.php-material-stat .gml-icon { grid-row: 1/3; color: var(--accent); }
.php-material-stat b { font-size: 23px; }
.php-material-stat small { color: var(--muted); }

/* Tools and wiki */
.tools-hero, .community-hero { min-height: 390px; }
.tools-hero h1, .community-hero h1 { margin: 0; font-family: var(--font-condensed); font-size: clamp(58px, 7vw, 86px); line-height: .92; }
.tools-hero p:not(.php-kicker), .community-hero p:not(.php-kicker) { max-width: 760px; color: var(--muted); font-size: 18px; line-height: 1.65; }
.tools-hero .hero-symbol { width: 145px; height: 145px; color: rgba(182,240,0,.27); }
.tools-search { margin: 0 0 20px; }
.tool-group { padding-top: 52px; }
.tool-group > header { grid-template-columns: 58px 1fr; }
.tool-group > header > span { width: 58px; height: 58px; }
.tool-group h2 { font-size: 39px; }
.tool-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tool-card { min-height: 120px; grid-template-columns: 40px 1fr auto 20px; }
.tool-card > div { min-width: 0; }
.tool-card h3, .tool-card p { overflow-wrap: anywhere; }
.tool-card .gml-icon:first-child { width: 29px; height: 29px; color: var(--accent); }
.tool-card .gml-arrow { color: var(--muted); }
.guide-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.guide-card .gml-icon { width: 36px; height: 36px; margin-bottom: 28px; color: var(--accent); }
.guide-card .php-badge { margin-bottom: 12px; }
.guide-card h3 { margin: 0 0 10px; }
.guide-card small { display: inline-flex; align-items: center; gap: 6px; }
.wiki-stats { display: grid; gap: 10px; }

/* Existing CMS/admin/form components */
.php-panel, .php-card { border-radius: 8px; box-shadow: none; }
.php-card { background: var(--panel); }
.php-card-body { padding: 20px; }
.php-card h3 { font-size: 20px; }
.php-badge { border-radius: 4px; }
.php-notice { border-radius: 7px; }
.php-admin-grid { grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.php-admin-menu { position: sticky; top: 96px; padding: 12px; }
.php-admin-menu a { min-height: 43px; display: flex; align-items: center; padding: 0 12px; border-radius: 5px; }
.php-stat { min-height: 105px; display: grid; align-content: center; border-radius: 7px; }
.php-stat strong { font-size: 32px; color: var(--accent); }
.php-list-row { min-height: 66px; border-radius: 7px; }
.php-table th, .php-table td { padding: 14px; }
.php-login { padding: 30px; }
.php-login h1 { margin-top: 0; font-family: var(--font-condensed); font-size: 42px; }
.php-tool-layout { grid-template-columns: minmax(360px, .8fr) minmax(460px, 1.2fr); align-items: start; }
.php-preview { position: sticky; top: 96px; }
.php-code { min-height: 360px; font-family: var(--font-geist-mono); font-size: 13px; line-height: 1.65; }
.workshop-import { display: grid; grid-template-columns: minmax(0,1fr) minmax(260px,420px) auto; align-items: end; gap: 14px; margin-bottom: 24px; }
.workshop-import h2 { margin: 0 0 6px; font-family: var(--font-condensed); font-size: 30px; }
.workshop-import p { margin: 0; }
.workshop-import input { min-height: 46px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; background: #0c100d; color: var(--text); }
.rich-editor-field { overflow: hidden; padding-top: 8px; border: 1px solid var(--border); border-radius: 7px; background: #0c100d; }
.rich-editor-field > .rich-editor-source { border: 0; border-radius: 0; }
.rich-editor-toolbar { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; padding: 8px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: #151a16; }
.rich-editor-toolbar button { min-height: 34px; padding: 0 9px; border: 1px solid var(--border); border-radius: 4px; background: #202620; color: var(--text); font-size: 12px; font-weight: 750; cursor: pointer; }
.rich-editor-toolbar button:last-child { margin-left: auto; color: var(--accent); }
.rich-editor-preview { min-height: 340px; padding: 20px; }
.rich-content { color: #c4ccc6; font-size: 17px; line-height: 1.78; }
.rich-content h2,.rich-content h3,.rich-content h4 { color: var(--text); font-family: var(--font-condensed); line-height: 1.1; }
.rich-content h2 { margin: 34px 0 13px; font-size: 36px; }.rich-content h3 { margin: 28px 0 11px; font-size: 28px; }
.rich-content a { color: var(--accent); text-decoration: underline; }.rich-content code { padding: 2px 5px; border-radius: 4px; background: #090c0a; color: #d5efb1; font-family: var(--font-geist-mono); }
.rich-content pre { overflow: auto; padding: 18px; border: 1px solid var(--border); border-radius: 6px; background: #080b09; }.rich-content pre code { padding: 0; background: none; }
.rich-content blockquote { margin: 20px 0; padding: 12px 17px; border-left: 3px solid var(--accent); background: #131914; }.rich-content img { max-width: 100%; margin: 20px 0; border-radius: 7px; }
.material-assets { margin-top: 18px; }.admin-gallery { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }.admin-gallery figure { overflow: hidden; margin: 0; border: 1px solid var(--border); border-radius: 7px; background: #101411; }.admin-gallery img { width: 100%; aspect-ratio: 16/10; object-fit: cover; }.admin-gallery figcaption { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px; }.admin-gallery figcaption form { margin: 0; }.admin-gallery figcaption .php-button { min-height: 38px; padding: 8px 10px; font-size: 12px; }
.version-admin-list { display: grid; gap: 8px; }.version-admin-list article { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 6px; background: #111512; }.version-admin-list article.current { border-color: #687d45; }.version-admin-list article > div:first-child { display: grid; gap: 3px; }.version-admin-list small,.version-admin-list article > span { color: var(--muted); }.version-admin-list p { margin: 3px 0 0; }.version-admin-list article > div:last-child { display: flex; gap: 5px; }.version-admin-list form { display: inline; }
.public-gallery { padding-top: 20px; }.public-gallery-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }.public-gallery-grid figure { overflow: hidden; margin: 0; border: 1px solid var(--border); border-radius: 7px; }.public-gallery-grid img { width: 100%; aspect-ratio: 16/10; object-fit: cover; }.public-version-list { display: grid; gap: 8px; }.public-version-list article { display: grid; grid-template-columns: 110px minmax(0,1fr) auto; gap: 14px; padding: 15px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); }.public-version-list article.current { border-color: #647942; }.public-version-list small { color: var(--muted); }

/* Footer */
.site-footer.php-footer {
  width: 100%;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 55px;
  padding: 54px max(24px, calc((100vw - 1280px) / 2));
  background: #080b09 !important;
}
.php-footer > div { gap: 10px; }
.php-footer b { margin-bottom: 5px; }
.php-footer a:hover { color: var(--accent); }

@media (max-width: 1180px) {
  .php-header .main-nav { gap: 0; margin-left: 20px; }
  .php-header .main-nav a { padding-inline: 8px; font-size: 13px; }
  .php-header .submit-header-button span { display: none; }
  .php-grid.four, .php-quick-grid { grid-template-columns: repeat(2, 1fr); }
  .guide-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .portal-nav { display: none !important; }
  .php-header .header-actions { margin-left: auto; }
  .catalog-page-hero, .tools-hero, .community-hero { grid-template-columns: 1fr; min-height: 310px; }
  .tools-hero .hero-symbol { display: none; }
  .php-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .php-material-grid, .php-material-content, .php-tool-layout { grid-template-columns: 1fr; }
  .php-material-media { min-height: 420px; }
  .php-material-content { gap: 24px; }
  .php-preview { position: static; }
  .php-admin-grid { grid-template-columns: 1fr; }
  .php-admin-menu { position: static; flex-direction: row; overflow-x: auto; }
  .site-footer.php-footer { grid-template-columns: 1fr 1fr; }
  .workshop-import { grid-template-columns: 1fr; align-items: stretch; }
  .admin-gallery { grid-template-columns: 1fr 1fr; }
  .version-admin-list article { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .site-header.php-header { height: 66px; padding-inline: 12px; }
  .php-header .brand { font-size: 20px; }
  .gml-logo { width: 30px; height: 30px; }
  .php-header .saved-button { display: none; }
  .php-header .account-link { min-width: 42px; padding: 0; justify-content: center; }
  .php-header .account-link span { display: none; }
  .php-shell, .php-narrow, .php-home-content, .php-hero-copy, .catalog-page-content { width: min(100% - 24px, 1280px); }
  .php-home .php-hero { min-height: 530px; }
  .php-hero-copy { padding: 75px 0 55px; }
  .php-home .php-hero h1 { font-size: clamp(58px, 18vw, 78px); }
  .php-home .php-hero .php-lead { font-size: 17px; }
  .php-quick-grid, .php-grid, .php-grid.four, .tool-card-grid, .guide-grid { grid-template-columns: 1fr; }
  .php-quick-grid { width: calc(100% - 24px); }
  .php-toolbar { grid-template-columns: 1fr; }
  .catalog-page-hero { padding: 55px 12px; }
  .catalog-page-hero h1, .tools-hero h1, .community-hero h1 { font-size: 51px; }
  .tools-hero, .community-hero { padding: 55px 12px 45px; }
  .php-material-panel { padding: 24px; }
  .php-material-media { min-height: 280px; }
  .php-material-info { grid-template-columns: 1fr; }
  .tool-card { width: 100%; min-width: 0; grid-template-columns: 34px minmax(0, 1fr) 18px !important; padding: 16px; }
  .tool-card .ready-badge { display: none !important; }
  .php-form-grid { grid-template-columns: 1fr; }
  .php-form .full { grid-column: auto; }
  .php-stat-grid { grid-template-columns: 1fr 1fr; }
  .site-footer.php-footer { grid-template-columns: 1fr; gap: 28px; }
  .admin-gallery,.public-gallery-grid { grid-template-columns: 1fr; }
  .public-version-list article { grid-template-columns: 1fr; }
}
