/* ==========================================================================
   main.css  —  氣絶の衆 / Kizetsu no Shu   (unofficial alliance site)
   Zero dependencies. Mobile-first. Breakpoints: 360 / 768 / 1100.
   Colour tokens live in css/themes.css.
   ========================================================================== */

/* --- 1. reset ------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html {
  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2.25rem);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* anchor jumps (the skip link) must clear the sticky header */
  scroll-padding-top: 7rem;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Iowan Old Style", "Yu Mincho", "YuMincho", "Hiragino Mincho ProN",
               "Noto Serif JP", "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.85;
  letter-spacing: 0.01em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg, canvas { max-width: 100%; }
img { height: auto; display: block; }

ul, ol { padding-left: 1.25em; }

h1, h2, h3, h4 {
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN",
               "Yu Gothic", "Segoe UI", system-ui, sans-serif;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.04em;
  margin: 0 0 0.6em;
}

h1 { font-size: clamp(1.6rem, 1.25rem + 1.8vw, 2.5rem); }
h2 { font-size: clamp(1.25rem, 1.05rem + 1vw, 1.6rem); }
h3 { font-size: 1.08rem; }

p { margin: 0 0 1.1em; }

a {
  color: var(--accent-text);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}
a:hover { color: var(--gold-text); }

code, kbd, .mono {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.92em;
  letter-spacing: 0;
}

/* --- 2. focus / skip link ----------------------------------------------- */

:where(a, button, select, input, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 200;
  padding: 0.75rem 1rem;
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--gold);
  font-size: 0.9rem;
  transition: top 0.18s ease;
}
.skip:focus { top: 0.5rem; }

/* --- 3. layout ---------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: 68rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

main { display: block; position: relative; z-index: 1; }

.prose { max-width: 40rem; }

.section {
  padding-block: clamp(2.25rem, 1.5rem + 4vw, 4.25rem);
  position: relative;
}
.section + .section { border-top: 1px solid var(--line); }
.section--soft { background: var(--bg-soft); }

.stack > * + * { margin-top: 1.15rem; }

.eyebrow {
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.74rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gold-text);
  margin: 0 0 0.9rem;
}

.lede { font-size: 1.06rem; color: var(--fg); }

.muted  { color: var(--fg-dim); }
.faint  { color: var(--fg-faint); font-size: 0.86rem; }
.center { text-align: center; }

.rule {
  border: 0;
  height: 1px;
  margin: 2rem 0;
  background: linear-gradient(90deg, transparent, var(--gold) 18%, var(--gold) 82%, transparent);
  opacity: 0.55;
}

/* --- 4. decorative patterns (CSS/SVG only) ------------------------------ */

.pattern-asanoha,
.pattern-seigaiha { position: relative; isolation: isolate; }

.pattern-asanoha::before,
.pattern-seigaiha::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: var(--pattern-opacity);
  pointer-events: none;
}
/* The pattern SVGs are drawn with white strokes on transparency, which suits
   the dark themes directly. Where masking is supported the same file is used
   as an alpha mask over --fg instead, so the lattice stays visible on the
   light "pale-garden" parchment too. */
.pattern-asanoha::before  { background: url("../assets/svg/asanoha.svg")  repeat 0 0 / 92px 160px; }
.pattern-seigaiha::before { background: url("../assets/svg/seigaiha.svg") repeat 0 0 / 120px 60px; }

@supports ((mask-image: url("../assets/svg/asanoha.svg")) or (-webkit-mask-image: url("../assets/svg/asanoha.svg"))) {
  .pattern-asanoha::before {
    background: var(--fg);
    -webkit-mask: url("../assets/svg/asanoha.svg") repeat 0 0 / 92px 160px;
            mask: url("../assets/svg/asanoha.svg") repeat 0 0 / 92px 160px;
  }
  .pattern-seigaiha::before {
    background: var(--fg);
    -webkit-mask: url("../assets/svg/seigaiha.svg") repeat 0 0 / 120px 60px;
            mask: url("../assets/svg/seigaiha.svg") repeat 0 0 / 120px 60px;
  }
}

/* falling petals canvas (drawn by js/main.js) */
#petals {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: var(--petal-alpha);
}

/* --- 5. header ---------------------------------------------------------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

@supports (backdrop-filter: blur(4px)) {
  .site-head {
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(10px);
  }
}

.head-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  min-height: 56px;
  padding-block: 0.45rem;
}

.lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--fg);
  text-decoration: none;
  padding: 0.35rem 0.15rem;
  min-height: 44px;
}
.lockup:hover { color: var(--fg); }
.lockup-mark { display: block; width: 26px; height: 26px; flex: 0 0 auto; color: var(--gold); }
.lockup-mark svg { display: block; width: 100%; height: 100%; }
.lockup-text { display: flex; flex-direction: column; line-height: 1.15; }
.lockup-ja {
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 1.02rem;
  letter-spacing: 0.18em;
  font-weight: 600;
}
.lockup-en {
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.nav-toggle {
  margin-left: auto;
  display: none;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  min-width: 44px;
  padding: 0.4rem 0.7rem;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--line-strong);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
.js .nav-toggle { display: inline-flex; }

.nav-bars { display: inline-block; width: 16px; height: 10px; position: relative; }
.nav-bars::before,
.nav-bars::after,
.nav-bars i {
  content: ""; position: absolute; left: 0; right: 0; height: 1px; background: currentColor;
}
.nav-bars::before { top: 0; }
.nav-bars i       { top: 50%; }
.nav-bars::after  { bottom: 0; }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.1rem 0.35rem;
  width: 100%;
  order: 3;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.2rem 0.6rem;
  color: var(--fg-dim);
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.site-nav a:hover { color: var(--fg); border-bottom-color: var(--gold); }
.site-nav a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--accent); }
.site-nav a.is-members { color: var(--gold-text); }

.js .site-nav[hidden] { display: none; }

.head-ctl {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  order: 2;
  margin-left: auto;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
}
.lang-toggle button {
  min-width: 44px;
  min-height: 44px;
  padding: 0.2rem 0.5rem;
  background: transparent;
  color: var(--fg-dim);
  border: 0;
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  cursor: pointer;
}
.lang-toggle button + button { border-left: 1px solid var(--line); }
.lang-toggle button[aria-pressed="true"] { background: var(--accent-soft); color: var(--fg); }

.theme-field { display: inline-flex; align-items: center; }
.theme-field select {
  min-height: 44px;
  max-width: 9.5rem;
  padding: 0.2rem 0.5rem;
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

/* --- 6. hero ------------------------------------------------------------ */

.hero {
  position: relative;
  padding-block: clamp(2.75rem, 1.75rem + 7vw, 6rem);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  isolation: isolate;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 80% at 12% 0%,  var(--accent-soft), transparent 62%),
    radial-gradient(100% 70% at 92% 12%, var(--petal-soft),  transparent 58%),
    radial-gradient(80% 60% at 50% 108%, var(--gold-soft),   transparent 60%);
  pointer-events: none;
}
.hero h1 { margin-bottom: 0.35em; }
.hero-ja { display: block; letter-spacing: 0.2em; }
.hero-en {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.78rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--gold-text);
  font-weight: 500;
}
.hero-quote {
  max-width: 34rem;
  margin: 1.4rem 0 0;
  padding-left: 1rem;
  border-left: 2px solid var(--accent);
  color: var(--fg-dim);
  font-size: 1.02rem;
}

/* --- 7. cards / grid ---------------------------------------------------- */

.grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }

.card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem 1.15rem 1.35rem;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--gold), transparent 70%);
  opacity: 0.7;
}
.card h2, .card h3 { margin-bottom: 0.2rem; }
.card p { margin: 0; color: var(--fg-dim); font-size: 0.95rem; }
.card .card-foot { margin-top: auto; padding-top: 0.9rem; }

a.card { text-decoration: none; color: inherit; transition: border-color 0.16s ease, background 0.16s ease; }
a.card:hover { background: var(--panel-2); border-color: var(--line-strong); color: inherit; }
a.card:hover h2, a.card:hover h3 { color: var(--gold-text); }

.card-key {
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

/* --- 8. buttons --------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 48px;
  padding: 0.6rem 1.2rem;
  background: var(--panel-2);
  color: var(--fg);
  border: 1px solid var(--line-strong);
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}
.btn:hover { background: var(--panel); border-color: var(--gold); color: var(--fg); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff8f2; }
.btn--primary:hover { background: var(--accent); color: #fff8f2; filter: brightness(1.14); }
.btn--ghost { background: transparent; }
.btn--block { width: 100%; }
.btn-col { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 0.05rem; }
.btn-col small { font-size: 0.72rem; letter-spacing: 0.1em; opacity: 0.78; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.7rem; }

@media (prefers-reduced-motion: reduce) {
  .btn, a.card, .skip { transition: none; }
  .btn:hover { transform: none; }
}

/* --- 9. link lists ------------------------------------------------------ */

.linklist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.linklist li { border-bottom: 1px solid var(--line); }
.linklist a {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.7rem;
  min-height: 56px;
  padding: 0.85rem 0.2rem;
  text-decoration: none;
  color: var(--fg);
}
.linklist a:hover { color: var(--accent-text); }
.linklist .ll-name {
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.98rem;
}
.linklist .ll-url { color: var(--fg-faint); font-size: 0.78rem; word-break: break-all; }

.tag {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border: 1px solid var(--gold);
  color: var(--gold-text);
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

a[target="_blank"] .ll-name::after {
  content: " \2197";
  font-size: 0.8em;
  color: var(--fg-faint);
}

/* --- 10. tables --------------------------------------------------------- */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); }

table { width: 100%; min-width: 34rem; border-collapse: collapse; font-size: 0.92rem; }
caption { padding: 0.7rem 0.8rem; color: var(--fg-faint); font-size: 0.85rem; text-align: left; }
th, td {
  padding: 0.7rem 0.8rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
thead th {
  background: var(--panel-2);
  color: var(--fg);
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  white-space: nowrap;
}
tbody th { font-weight: 600; white-space: nowrap; }

/* --- 11. notice boxes / definition lists -------------------------------- */

.notice {
  padding: 1rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
}
.notice h2, .notice h3 { margin-bottom: 0.35rem; }
.notice p:last-child, .notice ul:last-child { margin-bottom: 0; }

/* Notices carry both languages side by side (data-only="ja" / "en"); show
   the one that matches <html lang>, which follows the JA/EN switch. With
   JavaScript off the page stays lang="ja", so the Japanese shows. A notice
   with no English simply shows its Japanese in both languages. */
html:not([lang="en"]) [data-only="en"] { display: none !important; }
/* kept as its own rule: a browser without :has() drops only this one */
html[lang="en"] [data-only="ja"]:has(+ [data-only="en"]) { display: none !important; }
/* the Japanese line is no longer the last child once English follows it */
.notice > [data-only="ja"]:nth-last-child(2) { margin-bottom: 0; }
/* a site address written as plain text, not a link */
.plain-domain {
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: var(--fg);
  pointer-events: none;
}
.notice--warn { border-left-color: var(--accent); }
.notice--op {
  background: transparent;
  border-style: dashed;
  border-left-style: solid;
  color: var(--fg-dim);
  font-size: 0.9rem;
}

dl.meta { margin: 0; }
dl.meta dt {
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-text);
}
dl.meta dd { margin: 0.1rem 0 1rem; }
dl.meta dd:last-child { margin-bottom: 0; }

/* 氣 / 絶 — single-character gloss pairs (about.html, "the name") */
.gloss {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 1.1rem;
  margin: 0;
  padding-left: 1rem;
  border-left: 1px solid var(--gold);
}
.gloss dt {
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.06em;
  color: var(--gold-text);
}
.gloss dd { margin: 0; align-self: center; color: var(--fg-dim); }

/* the two layered readings of the name */
.layers { list-style: none; margin: 0; padding: 0; counter-reset: layer; }
.layers li {
  position: relative;
  padding-left: 2.4rem;
  counter-increment: layer;
}
.layers li + li { margin-top: 0.5rem; }
.layers li::before {
  content: counter(layer);
  position: absolute;
  left: 0;
  top: 0.42rem;
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border: 1px solid var(--accent);
  color: var(--accent-text);
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.74rem;
  letter-spacing: 0;
}

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li {
  position: relative;
  padding: 0.35rem 0 0.35rem 1.6rem;
  border-bottom: 1px solid var(--line);
}
.checklist li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.85em;
  width: 0.7rem; height: 0.7rem;
  border: 1px solid var(--gold);
}

/* 名簿 — 20 seats, numbered, two columns from tablet up. Deliberately not a
   table: two short fields per row read better on a phone than a wide grid. */
.roster {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  counter-reset: seat;
  border-top: 1px solid var(--line);
}
.roster li {
  display: grid;
  grid-template-columns: 2.1rem 5rem 1fr;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.5rem 0.2rem;
  border-bottom: 1px solid var(--line);
  counter-increment: seat;
}
.roster li::before {
  content: counter(seat, decimal-leading-zero);
  color: var(--fg-faint);
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
}
.r-role {
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  color: var(--gold-text);
  white-space: nowrap;
}
.r-name { color: var(--fg); }
.roster li.is-lead .r-role { color: var(--accent-text); }
.roster li.is-open .r-role,
.roster li.is-open .r-name { color: var(--fg-faint); }

/* --- 配布素材 (downloads.html) ------------------------------------------ */

.dl-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin-top: 1.3rem;
}

.dl-card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: border-color 0.16s ease, transform 0.16s ease;
}
.dl-card:hover { border-color: var(--gold); color: inherit; transform: translateY(-2px); }
.dl-card:hover .dl-name { color: var(--gold-text); }

.dl-thumb {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

/* portrait art (phone wallpapers, stories) would tower over the grid */
.dl-card--tall .dl-thumb { max-height: 22rem; object-fit: cover; object-position: top; }

.dl-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.6rem;
  padding: 0.85rem 1rem 1rem;
}
.dl-name {
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  width: 100%;
}
.dl-spec {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
}
.dl-get {
  margin-left: auto;
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--accent-text);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .dl-card { transition: none; }
  .dl-card:hover { transform: none; }
}

@media (min-width: 768px) {
  .dl-grid { grid-template-columns: repeat(2, 1fr); }
  .dl-grid--tall { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1100px) {
  .dl-grid { grid-template-columns: repeat(3, 1fr); }
  .dl-grid--tall { grid-template-columns: repeat(4, 1fr); }
}

@media print { .dl-card { break-inside: avoid; } }

@media (min-width: 768px) {
  .roster {
    grid-auto-flow: column;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(10, auto);
    column-gap: 2.5rem;
  }
}

/* --- 12. members gate --------------------------------------------------- */

.gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding-block: clamp(2rem, 1rem + 6vw, 4.5rem);
}
/* The footer now stays at the bottom by itself (section 13), so the login
   panel just fills the space between header and footer instead of a fixed
   60vh, and the login fits one screen without a stray scrollbar. Browsers
   without :has() keep the 60vh above. */
@supports selector(:has(*)) {
  main:has(> .gate) { display: flex; flex-direction: column; }
  main > .gate { flex: 1 0 auto; min-height: 0; }
}
.gate-panel {
  width: 100%;
  max-width: 27rem;
  padding: 1.6rem 1.35rem 1.5rem;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.gate-panel h1 { font-size: 1.3rem; }
.gate-panel p { color: var(--fg-dim); font-size: 0.92rem; }
.gate-form { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 1.1rem; }
.gate-form label {
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--fg-dim);
}
.gate-form input[type="password"] {
  width: 100%;
  min-height: 48px;
  padding: 0.6rem 0.8rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0.18em;
}
.gate-msg { margin: 0; color: var(--accent-text); font-size: 0.88rem; min-height: 1.4em; }
.app-offer { margin: 0 0 0.6rem; }
.app-offer .btn { width: 100%; }

.member-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.8rem;
  padding-block: 0.6rem;
  border-bottom: 1px solid var(--line);
}
.member-bar .mb-label {
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  letter-spacing: 0.16em;
  color: var(--gold-text);
  text-transform: uppercase;
  font-size: 0.76rem;
}
.member-bar nav { display: flex; flex-wrap: wrap; gap: 0.1rem 0.3rem; }
.member-bar nav a {
  display: inline-flex; align-items: center;
  min-height: 44px; padding: 0.1rem 0.5rem;
  color: var(--fg-dim); text-decoration: none; font-size: 0.84rem;
  border-bottom: 1px solid transparent;
}
.member-bar nav a:hover { color: var(--fg); }
.member-bar nav a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--accent); }
.member-bar .btn { min-height: 44px; padding: 0.3rem 0.95rem; font-size: 0.82rem; }
.mb-logout { margin: 0; }

/* --- 13. footer ---------------------------------------------------------

   No host ad bar sits under the page on this server. Without one, a short
   page (404, the login) on a tall screen stopped with a band of a different
   colour below the footer. The page is a column at least one screen tall
   and main takes the slack, so the footer always reaches the bottom edge. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
}
main { flex: 1 0 auto; }
.site-head, .site-foot { flex-shrink: 0; }

/* ------------------------------------------------------------------------ */

.site-foot {
  position: relative;
  z-index: 1;
  margin-top: clamp(2.5rem, 1.5rem + 4vw, 4.5rem);
  padding-block: 2rem 1.5rem;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--fg-dim);
  font-size: 0.86rem;
}
.foot-grid { display: grid; gap: 1.4rem; grid-template-columns: 1fr; }
.site-foot h2 {
  font-size: 0.74rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-text);
  margin-bottom: 0.5rem;
}
.site-foot nav { display: flex; flex-direction: column; gap: 0.1rem; }
.site-foot nav a {
  display: inline-flex; align-items: center;
  min-height: 44px; color: var(--fg-dim); text-decoration: none;
}
.site-foot nav a:hover { color: var(--accent-text); }
.foot-copy { margin: 0.8rem 0 0; color: var(--fg-faint); font-size: 0.82rem; }
.foot-maint { margin: 0; font-size: 0.82rem; color: var(--fg-faint); }
.foot-ours { margin: 0 0 0.35rem; font-size: 0.85rem; }
.foot-ours a { color: var(--fg-dim); text-decoration: none; }
.foot-ours a:hover { color: var(--accent-text); }
.foot-lockup { letter-spacing: 0.16em; color: var(--fg); }

/* --- 13b. Little Server look (蒼) ----------------------------------------
   The FC2 copy keeps the original look; this build has its own: a deep blue
   island night, thin gold rules, a lotus watermark and a clear "official
   alliance site" seal. Pure CSS plus one small SVG - no extra images.
   ------------------------------------------------------------------------ */

/* header: a solid gradient instead of backdrop blur, which repaints on every
   scroll frame and is the most expensive thing on a phone */
.site-head {
  background: var(--bg);
  background: linear-gradient(180deg, var(--bg), color-mix(in srgb, var(--bg) 90%, var(--accent)));
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 0;
  box-shadow: 0 1px 0 var(--line), 0 8px 20px -16px rgba(0, 0, 0, 0.8);
}
.site-head::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold) 28%, var(--gold) 72%, transparent);
  opacity: 0.5;
  pointer-events: none;
}
.lockup-mark { color: var(--gold-text); }

/* hero: mist, a lotus over water, and room to breathe */
.hero {
  padding-block: clamp(3rem, 2rem + 7vw, 6.5rem);
  background: url("../assets/svg/lotus.svg") no-repeat right -2.5rem bottom -1.5rem / min(58vw, 30rem);
}
.hero::after {
  background:
    radial-gradient(90% 70% at 88% 8%,  var(--accent-soft), transparent 62%),
    radial-gradient(70% 60% at 6% 100%, var(--petal-soft),  transparent 60%),
    linear-gradient(180deg, transparent 50%, color-mix(in srgb, var(--accent) 9%, transparent));
}
.hero h1 { font-size: clamp(1.9rem, 1.3rem + 3vw, 3rem); }
.hero-ja { letter-spacing: 0.24em; }
.hero-quote { border-left-color: var(--gold); }

/* the "official alliance site" seal at the top of the home page */
.seal-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0.3rem 0.85rem 0.3rem 0.45rem;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold-text);
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}
.seal-badge::before {
  content: "";
  width: 1.15rem; height: 1.15rem;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--gold-text) 0 18%, transparent 20%),
    radial-gradient(circle, transparent 0 56%, var(--gold-text) 58% 66%, transparent 68%);
}

/* section headings carry a small diamond (菱) */
.section .wrap > h2,
.section .stack > h2,
.section .prose > h2 {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.section .wrap > h2::before,
.section .stack > h2::before,
.section .prose > h2::before {
  content: "";
  flex: 0 0 auto;
  width: 0.5em; height: 0.5em;
  transform: rotate(45deg);
  border: 1px solid var(--gold);
  background: var(--accent-soft);
}
.section--soft { background: linear-gradient(180deg, var(--bg-soft), color-mix(in srgb, var(--bg-soft) 85%, var(--accent))); }

/* cards: rounded, a blue-to-gold rule along the top, lift on hover */
.card {
  border-radius: 6px;
  background: linear-gradient(180deg, var(--panel), color-mix(in srgb, var(--panel) 80%, var(--bg)));
}
.card::before {
  left: 0; right: 0; top: 0; bottom: auto;
  width: auto; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--gold) 60%, transparent);
  opacity: 0.85;
}
a.card { transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease; }
a.card:hover { transform: translateY(-2px); }

.notice { border-radius: 4px; border-left-color: var(--accent); }
.notice--warn { border-left-color: var(--gold); }
.notice--ok { border-left-color: var(--accent-text); }

/* buttons: rounded, a quiet blue gradient for the main one */
.btn { border-radius: 999px; }
.btn--primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, #fff), var(--accent));
  border-color: var(--accent);
  color: #fff;
}
.btn--primary:hover { color: #fff; }

/* footer: faint waves and a gold hairline */
.site-foot { isolation: isolate; border-top: 0; }
.site-foot::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url("../assets/svg/seigaiha.svg") repeat 0 0 / 64px;
  opacity: var(--pattern-opacity);
  pointer-events: none;
}
.site-foot::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold) 30%, var(--gold) 70%, transparent);
  opacity: 0.45;
}

/* members page: logged-in count, ranks, vice-leaders */
.mb-online {
  font-size: 0.82rem;
  color: var(--fg-dim);
  padding: 0.15rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}
.mb-online b { color: var(--gold-text); }
.roster li { grid-template-columns: 2.1rem 5rem minmax(0, 1fr) auto; }
.roster li.is-vice .r-role { color: var(--accent-text); }
.r-rank {
  font-size: 0.75rem;
  color: var(--fg-dim);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  white-space: nowrap;
}

/* "coming soon" blocks (voting, the play page) */
.soon-card {
  padding: 1.5rem 1.2rem;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  text-align: center;
}
.soon-card p { margin: 0.4rem 0 0; color: var(--fg-dim); }
.soon-badge {
  display: inline-block;
  margin: 0 0 0.4rem;
  padding: 0.2rem 0.95rem;
  border: 1px solid var(--gold);
  border-radius: 999px;
  color: var(--gold-text);
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.3em;
}

/* members page: roadmap image */
.roadmap { margin: 1.2rem auto 0; max-width: 32rem; }
.roadmap img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 14px 34px -20px rgba(0, 0, 0, 0.85);
}

/* members page: voting */
.vote-flash { margin: 1rem 0; }
.vote-card {
  margin-top: 1.2rem;
  padding: 1.1rem 1.2rem 1.2rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
}
.vote-card.is-open { border-color: color-mix(in srgb, var(--accent-text) 45%, var(--line-strong)); }
.vote-card h3 { margin: 0.35rem 0 0.4rem; }
.vote-state {
  display: inline-block;
  margin: 0;
  padding: 0.05rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--fg-dim);
}
.vote-card.is-open .vote-state { border-color: var(--accent-text); color: var(--accent-text); }
.vote-card.is-closed .vote-state { border-color: var(--gold); color: var(--gold-text); }
.vote-desc { color: var(--fg-dim); }
.vote-meta { display: grid; gap: 0.15rem; margin: 0.6rem 0 0.9rem; font-size: 0.9rem; }
.vote-meta div { display: flex; flex-wrap: wrap; gap: 0 0.8rem; }
.vote-meta dt { color: var(--fg-faint); min-width: 8.5em; }
.vote-meta dd { margin: 0; }
.vote-meta b { color: var(--gold-text); }
.vote-form { display: grid; gap: 0.9rem; }
/* "投票する" first; the choices unfold under it */
.vote-fold > summary { list-style: none; cursor: pointer; width: fit-content; min-width: 10rem; justify-content: center; }
.vote-fold > summary::-webkit-details-marker { display: none; }
.vote-fold > summary .vf-close { display: none; }
.vote-fold[open] > summary { background: transparent; border-color: var(--line-strong); color: var(--fg-dim); margin-bottom: 1rem; }
.vote-fold[open] > summary .vf-open { display: none; }
.vote-fold[open] > summary .vf-close { display: inline; }
.vote-opts { display: grid; gap: 0.45rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.vote-opt {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 48px;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg-soft);
  cursor: pointer;
}
.vote-opt:hover { border-color: var(--gold); }
.vote-opt input { width: 1.15rem; height: 1.15rem; margin: 0; flex: 0 0 auto; accent-color: var(--accent); }
.vote-opt:has(input:checked) { border-color: var(--accent-text); background: var(--accent-soft); }
.vote-opt:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.vote-done { margin: 0; color: var(--fg-dim); }
.vote-confirm h4 { margin: 0 0 0.4rem; font-size: 1rem; }
.vote-sure { display: flex; gap: 0.55rem; align-items: flex-start; margin: 0.6rem 0 0.9rem; cursor: pointer; }
.vote-sure input { width: 1.15rem; height: 1.15rem; margin-top: 0.3rem; flex: 0 0 auto; }
.vote-verdict { margin: 0.2rem 0 0.6rem; }
.vote-verdict.is-ok b { color: var(--accent-text); }
.vote-result { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.vote-result li {
  display: grid;
  grid-template-columns: minmax(0, 9rem) minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.95rem;
}
.vote-result .vr-name { overflow-wrap: anywhere; }
.vote-result .vr-bar { height: 0.55rem; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.vote-result .vr-bar i { display: block; height: 100%; background: var(--line-strong); border-radius: inherit; }
.vote-result .is-win .vr-name { color: var(--gold-text); font-weight: 700; }
.vote-result .is-win .vr-bar i { background: var(--gold); }
.vote-result .vr-n { white-space: nowrap; color: var(--fg-dim); }
.vote-result .vr-n b { color: var(--fg); margin-right: 0.1rem; }
@media (max-width: 479px) {
  .vote-result li { grid-template-columns: minmax(0, 1fr) auto; }
  .vote-result .vr-bar { grid-column: 1 / -1; grid-row: 2; }
}

/* contact form */
.form { display: grid; gap: 1.15rem; margin-top: 1.5rem; }
.field { display: grid; gap: 0.35rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > label, .field > legend {
  padding: 0;
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.92rem;
  color: var(--fg);
}
.field input[type="text"], .field input[type="email"], .field input[type="url"], .field select, .field textarea {
  width: 100%;
  min-height: 46px;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font: inherit;
  font-size: 1rem;              /* 16px keeps iOS from zooming in */
}
.field textarea { min-height: 10rem; resize: vertical; line-height: 1.7; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--gold);
}
.field [aria-invalid="true"], fieldset.field[aria-invalid="true"] { border-color: var(--danger); }
.field-err { margin: 0; color: var(--danger); font-size: 0.86rem; }
.hint { margin: 0; color: var(--fg-faint); font-size: 0.82rem; }
.req {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0 0.45rem;
  border: 1px solid var(--accent-text);
  border-radius: 999px;
  color: var(--accent-text);
  font-size: 0.68rem;
  vertical-align: 0.15em;
}
.opt {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0 0.45rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--fg-faint);
  font-size: 0.68rem;
  vertical-align: 0.15em;
}
.choice {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0.35rem 0;
  cursor: pointer;
  color: var(--fg);
}
.choice input { flex: 0 0 auto; width: 1.2rem; height: 1.2rem; margin: 0.32rem 0 0; accent-color: var(--accent); }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* 娯楽: a page that suggests Sagiri - ivory, ink and crimson, one blade
   line, whatever the site theme */
.play-hero {
  --ink: #241a1a;
  --crimson: #9e1b25;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: clamp(3rem, 2rem + 6vw, 6rem);
  background: linear-gradient(160deg, #f6f0e6 0%, #ede3d4 62%, #e2d3c0 100%);
  color: var(--ink);
}
.play-hero::before {
  content: "";
  position: absolute;
  inset: -20% -10%;
  z-index: -1;
  background: linear-gradient(118deg, transparent 49.55%, rgba(158, 27, 37, 0.32) 49.7%, rgba(158, 27, 37, 0.32) 50.05%, transparent 50.2%);
  pointer-events: none;
}
/* the blade line must never cut through the text: faint on phones, and on
   wide screens it runs only behind the emblem side */
@media (max-width: 859px) { .play-hero::before { opacity: 0.3; } }
@media (min-width: 860px) { .play-hero::before { left: 48%; } }
.play-wrap { display: grid; gap: 2rem; align-items: center; }
@media (min-width: 860px) { .play-wrap { grid-template-columns: 1.15fr 0.85fr; } }
.play-hero .eyebrow { color: var(--crimson); }
.play-hero h1 { color: var(--ink); font-size: clamp(2rem, 1.4rem + 3vw, 3.2rem); letter-spacing: 0.3em; }
.play-hero .soon-badge { border-color: var(--crimson); color: var(--crimson); }
.play-big {
  margin: 0.3rem 0 1rem;
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: clamp(1.6rem, 1.2rem + 2vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--crimson);
}
.play-lead { max-width: 34rem; color: #3a2e2b; font-size: 1.05rem; }
.play-note { max-width: 34rem; color: #5f504c; font-size: 0.82rem; }
.play-art { margin: 0; justify-self: center; }
.play-art img { display: block; width: min(64vw, 340px); height: auto; filter: drop-shadow(0 18px 30px rgba(36, 26, 26, 0.25)); }
.play-back { color: var(--ink); border-color: rgba(36, 26, 26, 0.4); background: transparent; }
.play-back:hover { color: var(--ink); background: rgba(158, 27, 37, 0.08); border-color: var(--crimson); }

@media (prefers-reduced-motion: reduce) {
  a.card:hover { transform: none; }
}

/* --- 14. utilities ------------------------------------------------------ */

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- 15. breakpoints ---------------------------------------------------- */

/* Below the desktop breakpoint the header stacks into two rows: identity +
   menu button, then language + theme. Every control keeps a 44px touch
   target while the bar stays about 100px tall. */
@media (max-width: 999.98px) {
  .head-inner { min-height: 48px; padding-block: 0.3rem; gap: 0.3rem 0.6rem; }
  .site-nav { padding-bottom: 0.3rem; }
}

@media (max-width: 359px) {
  body { font-size: 0.95rem; }
  .lockup-ja { font-size: 0.94rem; letter-spacing: 0.12em; }
  .head-ctl { gap: 0.35rem; }
  .theme-field select { max-width: 6.5rem; }
}

@media (min-width: 768px) {
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .foot-grid { grid-template-columns: 1.5fr 1fr 1fr; }
  .btn--block { width: auto; }
}

@media (min-width: 1000px) {
  .head-inner { flex-wrap: nowrap; min-height: 64px; }
  .site-nav { order: 1; width: auto; margin-left: 1rem; gap: 0.1rem; }
  .site-nav a { padding-inline: 0.45rem; }
  .theme-field select { max-width: 8.5rem; }
  .head-ctl { order: 2; }
  .js .nav-toggle { display: none; }
  .js .site-nav[hidden] { display: flex; }
  .hero-quote { font-size: 1.08rem; }
}



/* Between 1000 and 1280 the one-row header only just fits: trim the nav a
   little so tablets in landscape keep the full menu instead of a hamburger. */

/* 320px phones: the identity block plus a labelled menu button overflows the
   first row and pushes the bar to three lines. Trim both. */
@media (max-width: 359px) {
  .lockup-en { display: none; }
  .lockup-mark { width: 22px; height: 22px; }
  .nav-toggle { min-width: 44px; padding-inline: 0.55rem; gap: 0; }
  .nav-toggle > span:not(.nav-bars) {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (min-width: 1000px) and (max-width: 1279px) {
  .site-nav a { font-size: 0.82rem; padding-inline: 0.38rem; }
  .theme-field select { max-width: 7.2rem; font-size: 0.74rem; }
  .lang-toggle button { min-width: 40px; }
  .lockup { gap: 0.45rem; }
  /* eight menu items since 娯楽 was added: drop the small English line
     under the name so the menu still fits on one row */
  .lockup-en { display: none; }
}

/* --- 17. device fitting -------------------------------------------------
   Measured fixes rather than guesses: a four-column table cannot be read in
   a 360px window, notched phones need their insets respected, and a phone
   held sideways has almost no vertical room.
   ------------------------------------------------------------------------ */

/* Notched and rounded phones: keep content out of the corners, and keep the
   last footer line clear of the home indicator. */
@supports (padding: max(0px, env(safe-area-inset-left))) {
  .wrap {
    padding-left: max(var(--gutter), env(safe-area-inset-left));
    padding-right: max(var(--gutter), env(safe-area-inset-right));
  }
  .site-foot { padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
}

/* Phone held sideways: almost no height, so stop reserving so much of it. */
@media (max-height: 520px) and (orientation: landscape) {
  .hero { padding-block: 1.4rem 1.6rem; }
  .section { padding-block: 1.6rem; }
  .gate { min-height: 0; padding-block: 1.4rem; }
  .site-head { position: static; }
}

/* Mobile browsers shrink the viewport as their chrome hides; svh keeps the
   gate from jumping. */
@supports (height: 60svh) {
  .gate { min-height: 60svh; }
}

/* A tapped link should not flash the default blue box. */
a, button, select, summary, [tabindex] { -webkit-tap-highlight-color: rgba(176, 141, 69, 0.20); }

/* Japanese sets better with strict line breaking; headings read better
   balanced, body text with the last line not left orphaned. */
:where(h1, h2, h3, .lede) { text-wrap: balance; }
:where(p, li, dd) { text-wrap: pretty; }
body { line-break: strict; }


/* --- 17a. "viewing now" count -------------------------------------------
   One count, three homes, filled in by js/main.js from members/presence.php:
     PC (1000px and up)  a small box at the right end of the header
     phones / tablets    a thin line under the bottom tab bar (17b)
     installed app       the same thin line under the app's tab bar (18)
   Both start as "-" and only appear with JavaScript; if the count cannot be
   fetched, js/main.js sets .kz-online-off and both disappear.
   ------------------------------------------------------------------------ */
.head-online,
.tab-online { display: none; }
.on-dot {
  width: 7px; height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent-text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-text) 22%, transparent);
}
.head-online b,
.tab-online b {
  color: var(--gold-text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-left: 0.15rem;
}

@media (min-width: 1000px) {
  /* the header row gets more width than the text column so the count fits
     at its right end without pushing the menu onto a second line */
  .site-head .wrap { max-width: 84rem; }
  .js .head-online {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    min-height: 44px;
    padding: 0 0.75rem;
    border: 1px solid var(--line-strong);
    color: var(--fg-dim);
    font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    line-height: 1;
    white-space: nowrap;
  }
}
/* The one-row header is tight: below 1360px the count keeps only the dot
   and the number (the word stays for screen readers), and below 1280px the
   spacing tightens as well (see also section 15). English drops the unit,
   reading "Online 12". */
html[lang="en"] .on-unit { display: none; }
@media (min-width: 1000px) and (max-width: 1359px) {
  .js .head-online { padding-inline: 0.5rem; gap: 0.3rem; }
  .head-online > span[data-i18n="ui.online"] {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}
@media (min-width: 1000px) and (max-width: 1279px) {
  .head-inner { column-gap: 0.55rem; }
  .site-nav { margin-left: 0.4rem; }
  .head-ctl { gap: 0.4rem; }
  .lockup { flex-shrink: 0; }
}
@media (min-width: 1000px) and (max-width: 1099px) {
  .site-nav { gap: 0; }
  .site-nav a { padding-inline: 0.25rem; }
  .head-ctl { gap: 0.3rem; }
  .theme-field select { max-width: 6.2rem; }
}
/* English menu words are longer: at the very narrowest PC widths they set a
   size smaller so the row still holds the count */
@media (min-width: 1000px) and (max-width: 1059px) {
  html[lang="en"] .site-nav a { font-size: 0.74rem; padding-inline: 0.22rem; }
  .lang-toggle button { min-width: 38px; }
}

.tab-online {
  grid-column: 1 / -1;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 24px;
  margin: 0;
  border-top: 1px solid var(--line);
  color: var(--fg-faint);
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  line-height: 1;
  white-space: nowrap;
}
.tab-online .on-dot { width: 6px; height: 6px; }
.js .tab-online { display: flex; }

.kz-online-off .head-online,
.kz-online-off .tab-online { display: none !important; }


/* --- 17b. mobile tab bar -------------------------------------------------
   Phones and tablets (below the 1000px desktop breakpoint, the same one
   js/main.js uses) get a fixed bar along the bottom with every page, Home
   through Members, instead of the header menu. Language and theme stay in
   the header. The bar sits in the HTML, so it works with JavaScript off.
   The look is defined once here; the installed app (section 18) reuses the
   same bar with only its data-app tabs.
   ------------------------------------------------------------------------ */
.tabbar {
  display: none;
  /* eight pages, each at least a 44px tap target; on the narrowest
     phones the bar scrolls sideways a little rather than shrink them */
  grid-template-columns: repeat(8, minmax(44px, 1fr));
  overflow-x: auto;
  scrollbar-width: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--bg-soft);
  border-top: 1px solid var(--line-strong);
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.18);
}
.tabbar a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
  min-height: 58px;
  padding: 0.4rem 0.1rem 0.35rem;
  color: var(--fg-dim);
  text-decoration: none;
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  font-size: 0.66rem;
  line-height: 1.15;
  letter-spacing: 0.02em;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.tabbar svg {
  width: 22px; height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tabbar a.is-members { color: var(--gold-text); }
.tabbar a[aria-current="page"] { color: var(--accent-text); }
.tabbar a[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 0; left: 22%; right: 22%;
  height: 2px;
  background: var(--accent);
}
.tabbar a:hover { color: var(--fg); }
.tabbar a:focus-visible { outline: 2px solid var(--gold); outline-offset: -4px; }
.tb-app { display: none; }

@media (max-width: 999.98px) {
  .site-nav, .nav-toggle { display: none !important; }
  .tabbar { display: grid; }

  /* the page must end above the bar (and its count line), and the bar
     already clears the home indicator, so the footer no longer needs that
     inset itself */
  body { padding-bottom: calc(59px + env(safe-area-inset-bottom)); }
  .js body { padding-bottom: calc(83px + env(safe-area-inset-bottom)); }
  .kz-online-off body { padding-bottom: calc(59px + env(safe-area-inset-bottom)); }
  .site-foot { padding-bottom: 1.5rem; }
}

/* With the menu button gone, the header is just identity + language/theme.
   Keep it to one row on phones so the page gets the height back; only the
   narrowest (under 360px) still wraps to two rows. */
@media (max-width: 999.98px) {
  .head-inner { flex-wrap: nowrap; }
  .head-ctl { margin-left: auto; }
}
@media (max-width: 479px) {
  .lockup-en { display: none; }
  .lockup-ja { white-space: nowrap; }
  .theme-field select { max-width: 6.4rem; }
}
@media (max-width: 359px) {
  .head-inner { flex-wrap: wrap; }
  .tabbar a { font-size: 0.6rem; letter-spacing: 0; }
  .tabbar svg { width: 20px; height: 20px; }
}

/* --- 18. installed app (PWA) --------------------------------------------
   The app is the whole site (manifest.json scope "./") and always starts on
   Home (start_url, plus a first-launch check in js/theme.js). At every
   width it shows the bottom bar with four tabs only - Home, Files, Play and
   Members (the links marked data-app) - with the "viewing now" line under
   it, and a welcome line on Home. The header keeps the alliance name and
   the language and theme controls; the header menu, the footer and the
   install offer are left out.

   The same rules are written twice on purpose: once against .standalone,
   which js/theme.js sets in the <head>, and once under the display-mode
   media query, so the app still looks like an app if that script never runs.
   Edit both halves together.
   ------------------------------------------------------------------------ */

.app-welcome {
  display: none;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 1.1rem;
  padding: 0.55rem 0.95rem;
  border-left: 2px solid var(--gold);
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  color: var(--fg);
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.92rem;
  line-height: 1.6;
  letter-spacing: 0.06em;
}

/* -- what the app removes -- */
.standalone .site-nav,
.standalone .nav-toggle,
.standalone .site-foot,
.standalone .gate-back,
.standalone .app-tip,
.standalone .app-offer,
.standalone .app-ios,
.standalone .head-online,
.standalone .tabbar a:not([data-app]),
.standalone .tabbar .tb-web { display: none !important; }

/* -- the four-tab bar, at every width, centred in a wide window -- */
.standalone .tabbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 8.5rem));
  justify-content: center;
  overflow-x: visible;
}
.standalone .tabbar .tb-app { display: inline; }
.standalone .tabbar a { font-size: 0.7rem; }
.standalone body { padding-bottom: calc(59px + env(safe-area-inset-bottom)); }
.standalone.js body { padding-bottom: calc(83px + env(safe-area-inset-bottom)); }
.standalone.kz-online-off body { padding-bottom: calc(59px + env(safe-area-inset-bottom)); }
.standalone .app-welcome { display: block; }

/* -- one compact bar, clear of the status bar on a notched phone -- */
.standalone .site-head { padding-top: env(safe-area-inset-top); }
.standalone .head-inner { flex-wrap: nowrap; min-height: 52px; gap: 0.5rem; }
.standalone .head-ctl { margin-left: auto; order: 2; }
.standalone .lockup { flex: 0 0 auto; }
.standalone .lockup-ja { font-size: 0.98rem; letter-spacing: 0.14em; }
.standalone .lockup-ja,
.standalone .lockup-en { white-space: nowrap; }
.standalone .theme-field select { max-width: 6.8rem; }

/* -- tighter rhythm: a phone screen is short -- */
.standalone .hero { padding-block: 1.5rem 1.4rem; }
.standalone .section { padding-block: 1.5rem; }
.standalone .gate { min-height: 0; padding-block: 2rem; }
.standalone main { padding-bottom: 1.5rem; }

/* -- a desktop app window can be very wide; hold a readable column -- */
.standalone .wrap { max-width: 54rem; }

@media (display-mode: standalone), (display-mode: minimal-ui), (display-mode: fullscreen) {
  .site-nav,
  .nav-toggle,
  .site-foot,
  .gate-back,
  .app-tip,
  .app-offer,
  .app-ios,
  .head-online,
  .tabbar a:not([data-app]),
  .tabbar .tb-web { display: none !important; }

  .tabbar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 8.5rem));
    justify-content: center;
    overflow-x: visible;
  }
  .tabbar .tb-app { display: inline; }
  .tabbar a { font-size: 0.7rem; }
  body { padding-bottom: calc(59px + env(safe-area-inset-bottom)); }
  .js body { padding-bottom: calc(83px + env(safe-area-inset-bottom)); }
  .kz-online-off body { padding-bottom: calc(59px + env(safe-area-inset-bottom)); }
  .app-welcome { display: block; }

  .site-head { padding-top: env(safe-area-inset-top); }
  .head-inner { flex-wrap: nowrap; min-height: 52px; gap: 0.5rem; }
  .head-ctl { margin-left: auto; order: 2; }
  .lockup { flex: 0 0 auto; }
  .lockup-ja { font-size: 0.98rem; letter-spacing: 0.14em; }
  .lockup-ja,
  .lockup-en { white-space: nowrap; }
  .theme-field select { max-width: 6.8rem; }

  .hero { padding-block: 1.5rem 1.4rem; }
  .section { padding-block: 1.5rem; }
  .gate { min-height: 0; padding-block: 2rem; }
  main { padding-bottom: 1.5rem; }

  .wrap { max-width: 54rem; }
}

/* 320px screens cannot hold name + language + theme on one line */
@media (max-width: 359px) {
  .standalone .lockup-en { display: none; }
  .standalone .head-inner { flex-wrap: wrap; }
  .standalone .head-ctl { width: 100%; justify-content: flex-end; margin-left: 0; }
}
@media (display-mode: standalone) and (max-width: 359px) {
  .lockup-en { display: none; }
  .head-inner { flex-wrap: wrap; }
  .head-ctl { width: 100%; justify-content: flex-end; margin-left: 0; }
}
@media (max-width: 479px) {
  .standalone .lockup-en { display: none; }
}
@media (display-mode: standalone) and (max-width: 479px) {
  .lockup-en { display: none; }
}

@media (min-width: 768px) {
  .standalone .head-inner { min-height: 56px; }
  .standalone .hero { padding-block: 2rem 1.8rem; }
  .standalone .section { padding-block: 2rem; }
}
@media (display-mode: standalone) and (min-width: 768px) {
  .head-inner { min-height: 56px; }
  .hero { padding-block: 2rem 1.8rem; }
  .section { padding-block: 2rem; }
}

/* --- 16. print ---------------------------------------------------------- */

@media print {
  .site-head, .site-foot nav, .nav-toggle, .head-ctl, #petals, .tabbar,
  .skip, .member-bar .btn { display: none !important; }
  html, body { background: #fff !important; color: #000 !important; }
  .hero::after, .card::before { display: none !important; }
  a { color: #000 !important; text-decoration: underline; }
  .card, .notice, .gate-panel, .table-scroll { border-color: #999 !important; box-shadow: none !important; }
  .linklist a::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #444; }
  .section { padding-block: 1rem; page-break-inside: avoid; }
  .hero { padding-block: 0.5rem 1rem; border-color: #999; }
  .pattern-asanoha::before, .pattern-seigaiha::before { display: none; }
}

/* --- 19. 2026-11 UI refresh ---------------------------------------------
   Written after the first month on Little Server. Everything here only
   adjusts what is above: a consistent left edge for every section, a theme
   picker that looks like the language switch next to it, a two-column
   footer on phones, in-page jump bars on the long pages, a back-to-top
   button, and a better fit for the login panel and member bar.
   ------------------------------------------------------------------------ */

/* -- a. one reading column, one left edge --
   Text sections used to centre a 40rem column while card grids ran from
   the left gutter, so the eye had to find a new margin at every section.
   Now the text column keeps the same left edge as the hero and the grids,
   and is a little wider (44rem ≈ 42 Japanese characters per line). */
.wrap.prose { max-width: 68rem; }
.wrap.prose > * { max-width: 44rem; }
.prose:not(.wrap) { max-width: 44rem; }
.lede { max-width: 44rem; }
.hero .wrap > p:not(.seal-badge):not(.eyebrow) { max-width: 44rem; }

/* -- b. theme picker: same shape as the JA | EN switch beside it -- */
.theme-field { position: relative; }
.theme-field select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 1.9rem;
  padding-left: 0.7rem;
  background: transparent;
  color: var(--fg-dim);
  border: 1px solid var(--line-strong);
  cursor: pointer;
}
.theme-field select:hover { color: var(--fg); border-color: var(--gold); }
.theme-field select option { background: var(--panel); color: var(--fg); }
.theme-field::after {
  content: "";
  position: absolute;
  right: 0.7rem;
  top: 50%;
  width: 0.42rem; height: 0.42rem;
  margin-top: -0.32rem;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg);
  color: var(--gold-text);
  pointer-events: none;
}
.lang-toggle button:hover { color: var(--fg); }

/* -- c. header menu: the current page gets a short gold rule, hover a
   soft lift, and the members link a small seal dot -- */
.site-nav a { position: relative; border-bottom: 0; border-radius: 4px; transition: color 0.14s ease, background 0.14s ease; }
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0.6rem; right: 0.6rem; bottom: 0.35rem;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.18s ease;
}
.site-nav a:hover { background: color-mix(in srgb, var(--fg) 6%, transparent); }
.site-nav a:hover::after,
.site-nav a[aria-current="page"]::after { transform: scaleX(1); }
.site-nav a[aria-current="page"]::after { background: var(--accent-text); }

/* -- d. hero: a little less height on phones, the lotus kept clear of the text -- */
@media (max-width: 767.98px) {
  .hero { padding-block: 2.2rem 2.4rem; background-size: min(70vw, 20rem); background-position: right -3rem bottom -2rem; }
  .hero h1 { font-size: clamp(1.8rem, 1.2rem + 4vw, 2.4rem); }
  .seal-badge { font-size: 0.74rem; }
}

/* -- e. entry cards: the whole card is the link, and the tag says so -- */
a.card .tag { transition: background 0.16s ease, color 0.16s ease, padding 0.16s ease; }
a.card .tag::after { content: " \2192"; display: inline-block; transition: transform 0.16s ease; }
a.card:hover .tag { background: var(--gold); color: var(--bg); }
a.card:hover .tag::after { transform: translateX(3px); }
a.card:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

/* -- f. notices read as a dated list: the date sits on a hairline -- */
.notice .card-key {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.35rem;
}
.notice .card-key::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--line); }

/* -- g. in-page jump bar (downloads, members) --
   Sticks under the header on PC, scrolls sideways on phones. The link for
   the section on screen is marked by js/main.js (aria-current="true"). */
.jump {
  position: sticky;
  top: var(--head-h, 56px);
  z-index: 30;
  margin: 0;
  padding: 0.35rem 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
}
.jump ul {
  display: flex;
  gap: 0.3rem;
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.jump ul::-webkit-scrollbar { display: none; }
.jump li { flex: 0 0 auto; scroll-snap-align: start; }
.jump a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.2rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--fg-dim);
  text-decoration: none;
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
  transition: color 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}
.jump a:hover { color: var(--fg); border-color: var(--line-strong); }
.jump a[aria-current="true"] { color: var(--fg); border-color: var(--gold); background: var(--gold-soft); }
.jump a:focus-visible { outline-offset: 0; }
@media (min-width: 1000px) {
  .jump ul { flex-wrap: wrap; overflow: visible; }
}
/* phone held sideways: the header is not sticky there (section 17) */
@media (max-height: 520px) and (orientation: landscape) { .jump { top: 0; } }
/* anchors land below the sticky bars */
.section[id] { scroll-margin-top: calc(var(--head-h, 56px) + 3.6rem); }

/* -- h. back to top: appears after a screen and a half of scrolling,
   above the tab bar on phones -- */
.to-top {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1.2rem, env(safe-area-inset-bottom));
  z-index: 35;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--gold-text);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}
.to-top svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.to-top:hover { border-color: var(--gold); color: var(--fg); }
.to-top.is-on { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
@media (max-width: 999.98px) {
  .to-top { bottom: calc(60px + 1rem + env(safe-area-inset-bottom)); }
  .js .to-top { bottom: calc(84px + 1rem + env(safe-area-inset-bottom)); }
  .kz-online-off .to-top { bottom: calc(60px + 1rem + env(safe-area-inset-bottom)); }
}
.standalone .to-top { display: none; }
@media (prefers-reduced-motion: reduce) { .to-top, .site-nav a, .site-nav a::after, .jump a, a.card .tag { transition: none; } }

/* -- i. footer: two columns of links on phones instead of a long list -- */
@media (max-width: 767.98px) {
  .foot-grid > div:nth-child(2) nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1rem;
  }
  .site-foot nav a { min-height: 40px; }
  .foot-grid { gap: 1.6rem; }
}
.site-foot nav a { width: fit-content; border-bottom: 1px solid transparent; transition: color 0.14s ease; }
.site-foot nav a:hover { border-bottom-color: var(--accent-text); }

/* -- j. login panel: breathing room on phones, a soft glow on the field -- */
.gate { padding-inline: var(--gutter); }
.gate-panel { border-radius: 8px; padding: 1.8rem 1.5rem 1.6rem; }
.gate-panel h1 { margin-top: 0.1rem; }
.gate-form input[type="password"] { border-radius: 6px; transition: border-color 0.14s ease, box-shadow 0.14s ease; }
.gate-form input[type="password"]:focus-visible {
  outline: 0;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.gate-form .btn { margin-top: 0.3rem; }
@media (max-width: 479px) { .gate-panel { padding: 1.5rem 1.15rem 1.4rem; } }

/* -- k. member bar: a quiet strip with the count and the exit -- */
.member-bar { padding-block: 0.5rem; gap: 0.4rem 0.7rem; }
.member-bar .mb-logout { margin-left: auto; }

/* -- l. forms: the contact form's fields match the login field -- */
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px var(--gold-soft);
}

/* -- m. download cards: the name and size line up, "save" reads as a button -- */
.dl-card { border-radius: 6px; }
.dl-get {
  padding: 0.15rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}
.dl-card:hover .dl-get { border-color: var(--gold); background: var(--gold-soft); color: var(--gold-text); }

/* -- n. tables and notice boxes get the same corner as the cards -- */
.table-scroll { border-radius: 6px; }
.soon-card { border-radius: 8px; }

/* --- 20. 2026-11 UX pass -------------------------------------------------
   A second pass over section 19, made after looking at every page on a
   375px phone and a 1366px PC: shorter scrolling on phones, a clearer place
   for what people come for (the join conditions, the downloads, an open
   vote), and a few fixes to spacing. Only adjusts what is above.
   ------------------------------------------------------------------------ */

/* -- a. jump bar: the chips keep the page margin when scrolled, and on a
   phone the cut-off edge fades so it reads as "more this way" -- */
.jump ul { scroll-padding-inline: var(--gutter); }
@media (max-width: 999.98px) {
  .jump ul {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 0.6rem, #000 calc(100% - 1.6rem), transparent);
            mask-image: linear-gradient(90deg, transparent 0, #000 0.6rem, #000 calc(100% - 1.6rem), transparent);
  }
}

/* -- b. home hero: the quote and the line under it no longer touch -- */
.hero-quote + p { margin-top: 1rem; }

/* -- c. home entry cards on phones: one compact row each (number, title,
   arrow; the sentence under it) instead of three tall boxes -- */
@media (max-width: 767.98px) {
  .grid > a.card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: baseline;
    column-gap: 0.75rem;
    row-gap: 0.15rem;
    padding: 0.95rem 1rem 1rem;
  }
  .grid > a.card .card-key { grid-column: 1; grid-row: 1; margin: 0; }
  .grid > a.card h3 { grid-column: 2; grid-row: 1; margin: 0; font-size: 1.05rem; }
  .grid > a.card > p:not(.card-key):not(.card-foot) { grid-column: 1 / 3; grid-row: 2; font-size: 0.9rem; line-height: 1.7; }
  .grid > a.card .card-foot { grid-column: 3; grid-row: 1 / span 2; align-self: center; margin: 0; padding: 0; }
  .grid > a.card .tag { padding: 0.2rem 0.55rem; }
}

/* -- d. definition lists (join conditions, game facts): a ruled table, so
   each condition can be found at a glance -- */
dl.meta {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 55%, transparent);
  overflow: hidden;
}
dl.meta dt { padding: 0.75rem 1rem 0; }
dl.meta dd { margin: 0; padding: 0.15rem 1rem 0.8rem; border-bottom: 1px solid var(--line); }
dl.meta dd:last-child { border-bottom: 0; }
@media (min-width: 600px) {
  dl.meta { display: grid; grid-template-columns: minmax(7.5rem, max-content) 1fr; }
  dl.meta dt { padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); align-self: stretch; background: color-mix(in srgb, var(--panel) 60%, transparent); }
  dl.meta dd { padding: 0.75rem 1.1rem; }
  dl.meta dt:nth-last-of-type(1) { border-bottom: 0; }
}

/* -- e. downloads on phones: square icons and phone wallpapers two to a
   row, so the page is half as long; wide images stay one to a row -- */
@media (max-width: 767.98px) {
  #icons .dl-grid, .dl-grid--tall { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  #icons .dl-meta, .dl-grid--tall .dl-meta { padding: 0.6rem 0.7rem 0.75rem; }
  #icons .dl-name, .dl-grid--tall .dl-name { font-size: 0.86rem; }
  #icons .dl-spec, .dl-grid--tall .dl-spec { font-size: 0.72rem; letter-spacing: 0.01em; }
  .dl-grid--tall .dl-card--tall .dl-thumb { max-height: 17rem; }
  /* the terms boxes: same words, less height */
  #terms .notice { padding: 0.9rem 1rem; }
  #terms .notice p { font-size: 0.9rem; line-height: 1.75; }
}

/* -- f. login: no empty gap under the field when there is no message, and
   a show / hide button inside the field -- */
.gate-msg:empty { min-height: 0; margin-top: -0.7rem; }
.pass-field { position: relative; }
/* the same look whether the field shows dots or the plain text */
#gate-pass {
  width: 100%;
  min-height: 48px;
  padding: 0.6rem 3.2rem 0.6rem 0.8rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0.18em;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
#gate-pass[type="text"] { letter-spacing: 0.08em; }
#gate-pass:focus-visible { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.pass-eye {
  position: absolute;
  top: 50%; right: 0.3rem;
  transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  padding: 0;
  border: 0; border-radius: 6px;
  background: transparent;
  color: var(--fg-faint);
  cursor: pointer;
}
.pass-eye:hover, .pass-eye[aria-pressed="true"] { color: var(--gold-text); }
.pass-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pass-eye .eye-off, .pass-eye[aria-pressed="true"] .eye-on { display: none; }
.pass-eye[aria-pressed="true"] .eye-off { display: block; }

/* -- g. members page: an open vote is announced at the top, and notices
   past the latest three fold away behind one line -- */
.vote-call {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem;
  margin-top: 1.1rem;
  max-width: 44rem;
}
.vote-call p { margin: 0; }
.vote-call .btn { margin-left: auto; }
.notice-fold { border-top: 1px solid var(--line); padding-top: 0.4rem; }
.notice-fold > summary {
  display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
  color: var(--accent-text);
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
}
.notice-fold > summary::-webkit-details-marker { display: none; }
.notice-fold > summary::before {
  content: "";
  width: 0.45rem; height: 0.45rem;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.16s ease;
}
.notice-fold[open] > summary::before { transform: rotate(45deg); }
.notice-fold > summary:hover { color: var(--fg); }
.notice-fold > .notice + .notice, .notice-fold > summary + .notice { margin-top: 1rem; }
@media (prefers-reduced-motion: reduce) { .notice-fold > summary::before { transition: none; } }

/* -- h. tab bar on 320px phones: all eight tabs fit (40px each, still
   58px tall) instead of the last one, 同盟員, sitting half off screen -- */
@media (max-width: 359px) {
  .tabbar { grid-template-columns: repeat(8, minmax(0, 1fr)); overflow-x: hidden; }
  .tabbar a { padding-inline: 0; }
}
.fold-n {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.5rem; height: 1.5rem; padding: 0 0.4rem;
  border: 1px solid var(--line-strong); border-radius: 999px;
  color: var(--fg-dim); font-size: 0.78rem; letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

/* --- 21. theme picker: the whole name always shows (2026-11-11) ----------
   Measured in a browser: at the old size "蒼（既定）" lost its bracket and
   the English names were cut on phones and at 1000-1279px. Smaller type
   and a narrower arrow gutter keep every name whole at every width, in
   both languages and in the app, without making the header taller. The
   app rules are written twice (class and display-mode), as in section 18. */
.theme-field select { font-size: 0.72rem; letter-spacing: 0.01em; padding-left: 0.6rem; padding-right: 1.35rem; }
.theme-field::after { right: 0.6rem; }
@media (max-width: 479px) { .theme-field select { max-width: 7.2rem; } }
@media (max-width: 359px) { .theme-field select { max-width: 9.5rem; } }
@media (min-width: 1000px) and (max-width: 1279px) { .theme-field select { max-width: 7.4rem; font-size: 0.72rem; } }
.standalone .theme-field select { max-width: 7.2rem; }
@media (display-mode: standalone), (display-mode: minimal-ui), (display-mode: fullscreen) {
  .theme-field select { max-width: 7.2rem; }
}
