/* ============================================================
   Mobariku! — "Clan Board" light theme (2026-07)
   Full rewrite. Warm ivory paper x navy x cobalt x sun.
   All JS hook classes / [data-*] selectors are preserved.
   Sections:
     1.  Tokens / Reset / Base
     2.  Layout primitives
     3.  Header
     4.  Footer
     5.  Buttons
     6.  Pills / Chips / Badges
     7.  Cards (clan / player lists)
     8.  Search / Filter panel
     9.  Forms
     10. Home / Hero
     11. Detail pages
     12. Mypage & Inbox
     13. Register / Edit forms
     14. Modals & Toast
     15. News page
     16. Admin
     17. Misc states
     18. Responsive
     19. Bottom navigation
     20. Search bottom sheet
     21. Role colors (lanes)
     22. Favorites
   ============================================================ */

/* ---------- 1. Tokens / Reset / Base ---------- */
:root {
  color-scheme: light;
  /* Paper palette */
  --paper: #fdf9f0;
  --card: #ffffff;
  --line: #eadfc8;
  --line-strong: #d9c9a6;
  --navy: #233054;
  --ink: #2b2b33;
  /* Text neutrals darkened to clear WCAG AA on paper/white (was 5.1:1 / 2.6:1) */
  --dim: #5c5647;
  --faint: #756b50;
  --cobalt: #2b59c3;
  --cobalt-soft: #e9effc;
  --sun: #f6b731;
  --sun-soft: #fdf1d4;
  /* Role colors: foreground darkened for legible chip text (~4.5:1 on its -bg); bg stays light */
  --r-roam: #0e7a52;
  --r-roam-bg: #e2f5ec;
  --r-jg: #6238ad;
  --r-jg-bg: #f0e9fb;
  --r-mid: #196f8f;
  --r-mid-bg: #e4f3fa;
  --r-gold: #8a6208;
  --r-gold-bg: #fbf0d7;
  --r-exp: #b03626;
  --r-exp-bg: #fbe6e2;
  /* State colors */
  --ok: #2eaf7d;
  --warn: #d99a1d;
  --err: #d95c49;
  --err-soft: #fbe6e2;

  /* Legacy aliases: re-pointed to the new palette so the many
     existing references keep working. New code uses the names above. */
  --bg-deep: var(--paper);
  --bg-mid: var(--paper);
  --bg-soft: var(--paper);
  --surface: var(--card);
  --surface-2: var(--paper);
  --surface-glass: rgba(253, 249, 240, 0.92);
  --slate: var(--ink);
  --fog: var(--dim);
  --border: var(--line);
  --border-strong: var(--line-strong);
  --cyan: var(--cobalt);
  --cyan-deep: var(--cobalt);
  --cyan-soft: var(--cobalt-soft);
  --red: var(--err);
  --red-soft: var(--err-soft);
  --gold: var(--r-gold);
  --gold-soft: var(--sun-soft);
  --green: var(--ok);
  --accent: var(--cobalt);
  --accent-soft: var(--cobalt-soft);
  --sea: var(--cobalt);
  --sea-soft: var(--cobalt-soft);
  --mist: var(--card);
  --glass: var(--surface-glass);
  --midnight: var(--paper);

  /* Shape & motion */
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(35, 48, 84, 0.10);
  --shadow-soft: 0 6px 18px rgba(35, 48, 84, 0.08);
  --tile-shadow: 0 4px 0 var(--line);
  --transition: 0.18s ease;

  /* Typography */
  --font-display: "Zen Maru Gothic", "Noto Sans JP", sans-serif;
  --font-body: "Noto Sans JP", "Noto Sans", sans-serif;
  /* Legacy alias */
  --font-pixel: var(--font-display);

  --safe-fs-2xs: clamp(0.72rem, 0.68rem + 0.2vw, 0.78rem);
  --safe-fs-xs: clamp(0.78rem, 0.74rem + 0.25vw, 0.86rem);
  --safe-fs-sm: clamp(0.86rem, 0.82rem + 0.3vw, 0.95rem);
  font-size: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: auto;
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--paper);
  /* Faint dotted graph paper */
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 26px 26px;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  touch-action: pan-x pan-y pinch-zoom;
  line-height: 1.7;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

::selection {
  background: var(--sun-soft);
}

:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 2px;
}

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 3.5rem;
  padding-top: 28px;
}

/* Ambient orbs / decorative grid from the old theme are neutralized
   in the light theme (kept in DOM but visually inert). */
.ambient {
  display: none;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 900;
  color: var(--navy);
  line-height: 1.35;
}

h1 {
  font-size: clamp(1.8rem, 1.4rem + 2vw, 2.5rem);
}
h2 {
  font-size: clamp(1.3rem, 1.1rem + 1vw, 1.55rem);
}
h3 {
  font-size: 1.15rem;
}

p {
  color: var(--ink);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--cobalt);
  background: var(--cobalt-soft);
  padding: 4px 14px;
  border-radius: 999px;
}

.hint {
  display: block;
  font-size: 0.8rem;
  color: var(--dim);
}

.hidden,
[hidden] {
  display: none !important;
}

.pixel-art {
  image-rendering: auto;
}

/* ---------- 2. Layout primitives ---------- */
.page-hero {
  margin-bottom: 26px;
}
.page-hero h1 {
  margin: 8px 0 6px;
}
.page-hero > p {
  color: var(--dim);
  font-size: 0.92rem;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.section-head.stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.section-head h2 {
  margin-top: 6px;
}
.section-sub {
  color: var(--dim);
  font-size: 0.92rem;
}
.section-link {
  flex: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--cobalt);
  background: var(--cobalt-soft);
  padding: 7px 16px;
  border-radius: 999px;
  transition: background var(--transition), color var(--transition);
}
.section-link:hover {
  background: var(--cobalt);
  color: #fff;
}

.grid {
  display: grid;
  gap: 18px;
}
.stack {
  display: flex;
  flex-direction: column;
}
.span-full {
  grid-column: 1 / -1;
}

.note-card {
  background: var(--sun-soft);
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  display: grid;
  gap: 10px;
}
.note-card p {
  color: var(--dim);
}

.result-count {
  font-size: 0.85rem;
  color: var(--dim);
  font-weight: 700;
}
.result-count [data-result-count],
.result-count [data-scout-count] {
  color: var(--cobalt);
}

.pagination {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.page-controls {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.page-status {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
  min-width: 3.5em;
  text-align: center;
}
.page-meta {
  font-size: 0.8rem;
  color: var(--faint);
}

/* ---------- 3. Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-surface {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  background: rgba(253, 249, 240, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.35rem;
  color: var(--navy);
}
/* Title logo image (Miya + pixel wordmark) is the brand */
.brand-logo {
  display: block;
  height: 40px;
  width: auto;
}
.brand-subtitle {
  display: none;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.axis-nav {
  position: relative;
  display: flex;
  gap: 2px;
}

.axis-link {
  position: relative;
  z-index: 1;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--dim);
  padding: 9px 14px;
  min-height: 44px;
  border-radius: 999px;
  transition: color var(--transition), background var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.axis-link:hover {
  background: var(--cobalt-soft);
  color: var(--cobalt);
}
.axis-link.is-active,
.axis-link.active {
  background: var(--navy);
  color: #fff;
}
/* Sliding indicator from ui.js is not needed in the pill design. */
.axis-indicator {
  display: none;
}

.header-utility {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--dim);
  padding: 9px 14px;
  border-radius: 999px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-body);
  transition: color var(--transition), background var(--transition);
  position: relative;
  white-space: nowrap;
}
.header-utility:hover {
  background: var(--cobalt-soft);
  color: var(--cobalt);
}
.header-utility.is-active {
  background: var(--navy);
  color: #fff;
}
.header-news-icon {
  display: inline-flex;
}
.header-news-badge {
  position: absolute;
  top: 5px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--err);
  box-shadow: 0 0 0 2px var(--paper);
}
.inbox-nav-badge {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--err);
}

.header-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 44px;
  height: 44px;
  padding: 0 9px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
}
.header-toggle span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--navy);
  transition: transform var(--transition), opacity var(--transition);
}
.header-toggle.is-open span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.header-toggle.is-open span:nth-child(2) {
  opacity: 0;
}
.header-toggle.is-open span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ---------- 4. Footer ---------- */
.site-footer {
  flex: none;
  border-top: 2px solid var(--line);
  background: var(--paper);
  margin-top: 40px;
}
.footer-surface {
  max-width: 1100px;
  margin: 0 auto;
  padding: 34px 24px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 28px 48px;
  justify-content: space-between;
}
.footer-brand {
  max-width: 24em;
}
.footer-mark {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.footer-sub {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--navy);
}
.footer-logo {
  display: block;
  height: 34px;
  width: auto;
}
.footer-brand p {
  font-size: 0.85rem;
  color: var(--dim);
}
.footer-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 28px 40px;
}
.footer-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.footer-col h4 {
  font-size: 0.82rem;
  color: var(--faint);
  margin-bottom: 2px;
}
.footer-col a {
  font-size: 0.85rem;
  color: var(--ink);
  transition: color var(--transition);
}
.footer-col a:hover {
  color: var(--cobalt);
}
.footer-bottom {
  border-top: 2px solid var(--line);
  padding: 16px 24px 40px;
  text-align: center;
}
.footer-bottom p {
  font-size: 0.78rem;
  color: var(--faint);
}

/* ---------- 5. Buttons ---------- */
.primary,
.ghost,
.toggle {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
  border-radius: 999px;
  padding: 11px 22px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: filter var(--transition), background var(--transition),
    color var(--transition), border-color var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1.2;
}

.primary {
  background: var(--cobalt);
  color: #fff;
}
.primary:hover {
  filter: brightness(1.1);
}
.primary.is-danger {
  background: var(--err);
}
.primary.scout {
  background: var(--navy);
}
.primary.is-disabled,
.primary:disabled {
  background: var(--line-strong);
  color: #fff;
  cursor: not-allowed;
  filter: none;
}

.ghost {
  background: var(--card);
  color: var(--navy);
  border-color: var(--navy);
}
.ghost:hover {
  background: var(--cobalt-soft);
  border-color: var(--cobalt);
  color: var(--cobalt);
}
.ghost.is-danger {
  color: var(--err);
  border-color: var(--err);
}
.ghost.is-danger:hover {
  background: var(--err-soft);
  color: var(--err);
  border-color: var(--err);
}
.ghost.is-disabled,
.ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.toggle {
  background: var(--card);
  color: var(--dim);
  border-color: var(--line);
  padding: 8px 16px;
}
.toggle.is-active,
.toggle.active {
  background: var(--cobalt);
  color: #fff;
  border-color: var(--cobalt);
}

.compact {
  padding: 8px 16px;
  font-size: 0.82rem;
  min-height: 44px;
}

button[data-auth-login] {
  background: #5865f2;
  color: #fff;
  border-color: #5865f2;
}
button[data-auth-login]:hover {
  filter: brightness(1.08);
}

/* ---------- 6. Pills / Chips / Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.7rem;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--r-gold-bg);
  color: var(--r-gold);
  white-space: nowrap;
}
.badge--rank {
  background: var(--r-gold-bg);
  color: var(--r-gold);
}
.badge--looking {
  background: var(--cobalt-soft);
  color: var(--cobalt);
}
.badge.is-open {
  background: var(--r-roam-bg);
  color: var(--ok);
}
.badge.is-closed {
  background: var(--paper);
  color: var(--faint);
}
.badge.pro,
.badge.is-pro {
  background: var(--r-jg-bg);
  color: var(--r-jg);
}
.badge.is-tournament {
  background: var(--r-mid-bg);
  color: var(--r-mid);
}

.card-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
}
.card-badges--looking {
  flex-direction: column;
  align-items: flex-end;
}

.recruit-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--r-roam-bg);
  color: var(--ok);
  white-space: nowrap;
}
.recruit-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
}
.recruit-pill.is-closed {
  background: var(--paper);
  color: var(--faint);
}
.recruit-pill.is-closed::before {
  background: var(--faint);
}
.scout-pill,
.scout-rank-pill {
  background: var(--sun-soft);
  color: var(--r-gold);
}
.scout-pill::before,
.scout-rank-pill::before {
  display: none;
}

/* Chips: filter chips + tag options */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 15px;
  min-height: 44px;
  border-radius: 999px;
  background: var(--card);
  border: 1.5px solid var(--line);
  color: var(--dim);
  cursor: pointer;
  transition: background var(--transition), color var(--transition),
    border-color var(--transition);
}
.chip:hover {
  border-color: var(--line-strong);
}
.chip.active {
  background: var(--cobalt);
  border-color: var(--cobalt);
  color: #fff;
}

/* Tag option (checkbox pills in forms) */
.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-option {
  position: relative;
  cursor: pointer;
}
.tag-option input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}
.tag-option span {
  display: inline-flex;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--card);
  border: 1.5px solid var(--line);
  color: var(--dim);
  transition: background var(--transition), color var(--transition),
    border-color var(--transition);
}
.tag-option input:checked + span {
  background: var(--cobalt);
  border-color: var(--cobalt);
  color: #fff;
}
.tag-option input:focus-visible + span {
  outline: 2px solid var(--cobalt);
  outline-offset: 2px;
}

.news-tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  padding: 3px 11px;
  border-radius: 999px;
}
.news-tag--feature {
  background: var(--cobalt-soft);
  color: var(--cobalt);
}
.news-tag--improve {
  background: var(--r-roam-bg);
  color: var(--ok);
}
.news-tag--fix {
  background: var(--sun-soft);
  color: var(--r-gold);
}

/* ---------- 7. Cards (clan / player lists) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.clan-card,
.scout-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  transition: border-color var(--transition), transform var(--transition);
}
.clan-card:hover,
.scout-card:hover {
  border-color: var(--line-strong);
}
.clan-card.is-paged-out,
.scout-card.is-paged-out {
  display: none;
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.card-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.clan-logo {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 16px;
  background: var(--navy);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.15rem;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.clan-logo.has-image span {
  display: none;
}
/* Uploaded clan logos: show the whole image at its true aspect ratio (no square-crop zoom) */
.clan-logo.has-image,
.detail-logo.has-image {
  background-color: #fff;
  background-size: contain;
  background-repeat: no-repeat;
  border: 2px solid var(--line);
  padding: 3px;
  background-origin: content-box;
  background-clip: content-box;
}
/* Player photo avatars keep filling their circle */
.scout-card .clan-logo.has-image,
.player-detail-page .detail-logo.has-image {
  background-color: var(--cobalt-soft);
  background-size: cover;
  border: 2px solid #cfdcf6;
  padding: 0;
  background-origin: padding-box;
  background-clip: border-box;
}
/* Player avatars are circular + cobalt */
.scout-card .clan-logo {
  border-radius: 50%;
  background: var(--cobalt-soft);
  color: var(--cobalt);
  border: 2px solid #cfdcf6;
}
.card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--navy);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  font-size: 0.76rem;
  color: var(--faint);
  margin-top: 12px;
  line-height: 1.7;
}

.card-compact {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  background: var(--paper);
  border-radius: 12px;
  padding: 12px 14px;
}
.card-compact-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
}
.card-compact-row span {
  flex: none;
  color: var(--faint);
  font-weight: 700;
  font-size: 0.74rem;
}
.card-compact-row strong {
  color: var(--navy);
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scout-compact .card-compact-row strong {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-desc {
  font-size: 0.86rem;
  color: var(--dim);
  margin-top: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.card-tags span {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  color: var(--dim);
}
.card-tags-more {
  background: var(--cobalt-soft) !important;
  border-color: transparent !important;
  color: var(--cobalt) !important;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}
.card-detail {
  margin-left: auto;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  color: #fff;
  background: var(--cobalt);
  padding: 8px 20px;
  border-radius: 999px;
  transition: filter var(--transition), transform var(--transition);
}
.card-detail:hover {
  filter: brightness(1.1);
}
.card-detail.is-pressing {
  transform: scale(0.96);
}

/* Empty states */
.discover-empty,
.scout-empty,
.home-empty,
.member-empty,
.mypage-inbox-empty {
  text-align: center;
  color: var(--dim);
  font-size: 0.9rem;
  padding: 32px 20px;
  background: var(--card);
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  margin-top: 4px;
}

/* ---------- 8. Search / Filter panel ---------- */
.discover,
.scout {
  display: block;
}
.discover .section-head,
.scout .section-head {
  margin-bottom: 18px;
}

.search-panel {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 6px 20px 18px;
  margin-bottom: 24px;
}
.search-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}
.search-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--navy);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 0;
}
.search-toggle svg {
  color: var(--cobalt);
}
.search-close {
  margin-left: auto;
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  padding: 4px;
}
.search-body {
  display: grid;
  gap: 18px;
}
.search-panel.is-collapsed .search-body {
  display: none;
}
.search-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: end;
}
.search-field {
  display: grid;
  gap: 6px;
}
.search-field label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--navy);
}
.sort-field {
  min-width: 12em;
}
.search-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  grid-column: 1 / -1;
  flex-wrap: wrap;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.filter-group {
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  overflow: hidden;
}
.filter-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 15px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.filter-summary::-webkit-details-marker {
  display: none;
}
.filter-summary-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--navy);
}
.filter-summary-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.filter-summary-count {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--cobalt);
  background: var(--cobalt-soft);
  padding: 2px 10px;
  border-radius: 999px;
}
.filter-summary-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--faint);
  border-bottom: 2px solid var(--faint);
  transform: rotate(45deg);
  transition: transform var(--transition);
}
.filter-group[open] .filter-summary-chevron {
  transform: rotate(-135deg);
}
.filter-group .chips {
  padding: 0 15px 14px;
}

/* Floating search button (mobile) */
.floating-search-btn {
  position: fixed;
  right: 18px;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  z-index: 35;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--cobalt);
  color: #fff;
  display: none;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.floating-search-btn.is-visible {
  display: grid;
}

/* ---------- 9. Forms ---------- */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="password"],
input[type="number"],
input[type="tel"],
select,
textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input::placeholder,
textarea::placeholder {
  color: var(--faint);
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px var(--cobalt-soft);
}
.is-invalid,
input.is-invalid,
textarea.is-invalid,
select.is-invalid {
  border-color: var(--err);
}
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236f6a5e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.6;
}

input[type="file"] {
  width: 100%;
  font-size: 0.82rem;
  color: var(--dim);
  border: 2px dashed var(--line-strong);
  background: var(--paper);
  border-radius: 12px;
  padding: 10px 12px;
}
input[type="file"]::file-selector-button {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  margin-right: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid var(--navy);
  background: var(--card);
  color: var(--navy);
  cursor: pointer;
}

/* Form containers */
.form-card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  display: grid;
  gap: 18px;
}
.form-card > h3 {
  margin-bottom: -4px;
}

.form-step[hidden] {
  display: none;
}
.form-step-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.form-step-grid label,
.form-card > label {
  display: grid;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--navy);
}
.form-step-grid label input,
.form-step-grid label select,
.form-step-grid label textarea {
  font-family: var(--font-body);
  font-weight: 400;
}
.form-step-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.field {
  display: grid;
  gap: 8px;
}
.field-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--navy);
}
.field-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.char-count {
  font-size: 0.74rem;
  color: var(--faint);
  font-weight: 700;
}
.form-error {
  font-size: 0.78rem;
  color: var(--err);
  min-height: 0;
}
.form-note {
  font-size: 0.85rem;
  color: var(--dim);
}

.form-stepper {
  display: flex;
  align-items: center;
  gap: 12px;
}
.stepper-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--navy);
}
.stepper-label [data-step-current] {
  color: var(--cobalt);
}
.stepper-dots {
  display: inline-flex;
  gap: 6px;
}
.stepper-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line);
  transition: background var(--transition);
}
.stepper-dot.is-active {
  background: var(--cobalt);
}
.step-label {
  display: inline-flex;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--cobalt);
  background: var(--cobalt-soft);
  padding: 3px 12px;
  border-radius: 999px;
}
.step-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1rem;
  color: var(--navy);
  margin-bottom: 12px;
}

.auth-panel {
  background: var(--sun-soft);
  border: 2px solid var(--line-strong);
  border-radius: 14px;
  padding: 16px 18px;
  display: grid;
  gap: 12px;
}
.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.logo-upload-preview {
  width: 84px;
  height: 84px;
  margin-top: 10px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--navy);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 900;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

/* ---------- 10. Home / Hero ---------- */
.home-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 44px;
  align-items: center;
  padding: 12px 0 32px;
}
.home-hero__copy .eyebrow {
  margin-bottom: 14px;
}
.home-hero__copy h1 {
  margin: 8px 0 12px;
}
.home-hero__copy h1 > span {
  /* keep each phrase unbroken; wrap only between phrases */
  display: inline-block;
}
.home-hero__copy h1 .hl {
  background: linear-gradient(transparent 62%, var(--sun-soft) 62%);
  border-radius: 2px;
  box-shadow: 0 0 0 2px var(--sun-soft);
}
.home-hero__copy > p {
  color: var(--dim);
  font-size: 0.95rem;
  max-width: 32em;
}
/* Miya mascot waves at the end of the counts row (in flow: never clips or covers) */
.hero-miya {
  align-self: flex-end;
  image-rendering: pixelated;
  width: auto;
  height: 118px;
  margin-left: 10px;
  margin-bottom: -6px;
  transform: rotate(2deg);
  pointer-events: none;
  filter: drop-shadow(0 3px 0 rgba(35, 48, 84, 0.12));
}
@media (max-width: 900px) {
  .hero-miya {
    height: 96px;
    margin-left: auto;
    margin-bottom: -4px;
  }
}

/* Empty states with the Miya searching illustration */
.empty-state {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 34px 20px 38px;
  text-align: center;
  color: var(--dim);
  font-size: 0.92rem;
  line-height: 1.8;
}
.empty-state img {
  width: 130px;
  height: auto;
  image-rendering: pixelated;
}

/* Logged-out mypage: Miya welcomes the visitor */
.auth-panel.mypage-login-hero {
  display: flex;
  align-items: center;
  gap: 24px;
}
.login-miya {
  width: 88px;
  height: auto;
  flex: none;
  image-rendering: pixelated;
}
.login-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--navy);
  margin-bottom: 4px;
}
.mypage-login-hero .form-note {
  margin-bottom: 12px;
}
.login-desc {
  font-size: 0.9rem;
  color: var(--dim);
  margin-bottom: 12px;
}
@media (max-width: 480px) {
  .auth-panel.mypage-login-hero {
    flex-direction: column;
    text-align: center;
  }
  .mypage-login-hero .auth-actions {
    justify-content: center;
  }
}
/* Decorative hero sprite from the old theme is dropped in the board look. */
.home-hero__sprite {
  display: none;
}

/* Hero count tiles */
.home-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}
.home-count {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 10px 18px;
  text-align: center;
  min-width: 92px;
}
.home-count b {
  display: block;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.5rem;
  line-height: 1.1;
  color: var(--cobalt);
}
.home-count span {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--faint);
}

/* Entry tiles */
.home-entry-grid {
  display: grid;
  gap: 18px;
}
.home-entry {
  position: relative;
  display: block;
  background: var(--card);
  border: 2px solid var(--line-strong);
  border-radius: 20px;
  padding: 24px 26px 26px;
  box-shadow: var(--tile-shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.home-entry:hover {
  transform: translateY(-3px);
  box-shadow: 0 7px 0 var(--line);
}
.home-entry--player {
  transform: rotate(-0.6deg);
}
.home-entry--clan {
  transform: rotate(0.5deg);
}
.home-entry--player:hover {
  transform: rotate(-0.6deg) translateY(-3px);
}
.home-entry--clan:hover {
  transform: rotate(0.5deg) translateY(-3px);
}
.home-entry__label {
  display: inline-flex;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  padding: 3px 12px;
  border-radius: 999px;
}
.home-entry--player .home-entry__label {
  background: var(--cobalt-soft);
  color: var(--cobalt);
}
.home-entry--clan .home-entry__label {
  background: var(--sun-soft);
  color: var(--r-gold);
}
.home-entry__title {
  display: block;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.3rem;
  color: var(--navy);
  margin: 10px 0 4px;
}
.home-entry__desc {
  display: block;
  font-size: 0.85rem;
  color: var(--dim);
  max-width: 22em;
}
.home-entry__arrow {
  position: absolute;
  right: 22px;
  bottom: 20px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.home-latest {
  margin-top: 36px;
}
.home-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

/* Usage / FAQ */
.usage-steps,
.usage-note,
.usage-faq {
  margin-top: 48px;
}
.usage-step-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.usage-step-card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: grid;
  gap: 12px;
}
.usage-step-card h3 {
  margin: 2px 0;
}
.usage-step-card ol {
  padding-left: 1.2em;
  display: grid;
  gap: 6px;
  color: var(--dim);
  font-size: 0.88rem;
}
.usage-step-card ol::marker {
  color: var(--cobalt);
}
.usage-step-link {
  color: var(--cobalt);
  font-weight: 700;
  border-bottom: 2px solid var(--cobalt-soft);
}
.usage-step-link:hover {
  border-bottom-color: var(--cobalt);
}

.usage-faq-list {
  display: grid;
  gap: 10px;
}
.usage-faq-item {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 4px 18px;
}
.usage-faq-item summary {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  padding: 12px 0;
  list-style: none;
  position: relative;
  padding-right: 24px;
}
.usage-faq-item summary::-webkit-details-marker {
  display: none;
}
.usage-faq-item summary::after {
  content: "";
  position: absolute;
  right: 4px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--faint);
  border-bottom: 2px solid var(--faint);
  transform: translateY(-70%) rotate(45deg);
  transition: transform var(--transition);
}
.usage-faq-item[open] summary::after {
  transform: translateY(-30%) rotate(-135deg);
}
.usage-faq-item p {
  padding: 0 0 14px;
  font-size: 0.88rem;
  color: var(--dim);
}

/* ---------- 11. Detail pages ---------- */
.detail-hero,
.detail-hero-v2 {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  margin-bottom: 22px;
}
.detail-hero-shell {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 18px;
}
.detail-logo {
  width: 72px;
  height: 72px;
  flex: none;
  border-radius: 18px;
  background: var(--navy);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.5rem;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.player-detail-page .detail-logo {
  border-radius: 50%;
  background: var(--cobalt-soft);
  color: var(--cobalt);
  border: 2px solid #cfdcf6;
}
.detail-title {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.detail-title h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.4rem, 1.1rem + 1.5vw, 1.9rem);
  color: var(--navy);
}
.detail-tags,
.detail-tags-scroll {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.detail-tags span,
.detail-tags-scroll span {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  color: var(--dim);
}
.detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.detail-actions,
.detail-actions-mobile {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  width: 100%;
}
/* breathing room between the action row and the panel that follows inside the hero card */
.detail-hero .detail-panel,
.detail-hero-v2 .detail-panel {
  margin-top: 22px;
}

.detail-content,
.detail-content-v2 {
  display: grid;
  gap: 20px;
}
.detail-content-col {
  display: grid;
  gap: 20px;
}
.detail-content-col-main,
.detail-content-col-side {
  display: grid;
  gap: 20px;
  align-content: start;
}

.detail-panel,
.detail-panel-v2,
.detail-info-card,
.detail-meta-card,
.detail-members-card,
.detail-note-card,
.detail-roles-card,
.detail-story-card,
.detail-gallery-card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: grid;
  gap: 14px;
}
.detail-panel-v2 {
  gap: 20px;
}
.detail-panel h2,
.detail-panel h3,
.detail-info-card h2,
.detail-meta-card h2,
.detail-members-card h2,
.detail-note-card h2,
.detail-roles-card h2,
.detail-story-card h2,
.detail-gallery-card h2 {
  font-size: 1.05rem;
}

.detail-condition-list {
  display: grid;
  gap: 10px;
}
.detail-condition-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 14px;
  background: var(--paper);
  border-radius: 12px;
}
.detail-condition-label,
.detail-label {
  flex: none;
  min-width: 6em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--faint);
}
.detail-condition-value,
.detail-value {
  color: var(--navy);
  font-weight: 700;
  font-size: 0.9rem;
}
.detail-story-copy,
.detail-story-card p,
.detail-note-card p {
  color: var(--dim);
  font-size: 0.9rem;
  line-height: 1.8;
  white-space: pre-wrap;
}
.detail-inline-field {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
}
.detail-pace {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--cobalt);
}
/* Category theme accents */
.detail-theme-pro,
.detail-hero-v2.is-pro {
  border-color: var(--r-jg);
}
.detail-theme-tournament {
  border-color: var(--r-mid);
}

/* Members */
.member-list,
.member-grid {
  display: grid;
  gap: 10px;
}
.member-item,
.member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  flex-wrap: wrap;
}
.member-name {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
}
.member-role {
  font-size: 0.8rem;
  color: var(--dim);
}
.member-meta {
  font-size: 0.78rem;
  color: var(--faint);
}
.member-label {
  flex: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.74rem;
  color: var(--faint);
}
.member-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--cobalt-soft);
  color: var(--cobalt);
}
.add-member,
.remove-member {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  border-radius: 999px;
  border: 2px solid var(--navy);
  background: var(--card);
  color: var(--navy);
  padding: 7px 15px;
  cursor: pointer;
}
.remove-member {
  border-color: var(--err);
  color: var(--err);
  margin-left: auto;
}
.add-member.is-disabled,
.add-member:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Gallery / lightbox */
.detail-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.detail-gallery-item {
  border-radius: 12px;
  border: 2px solid var(--line);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  cursor: pointer;
  background: var(--paper);
}
.detail-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.detail-gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
}
.detail-gallery-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(35, 48, 84, 0.6);
}
.detail-gallery-lightbox__dialog {
  position: relative;
  z-index: 1;
  max-width: 92vw;
  max-height: 88vh;
}
.detail-gallery-lightbox__image {
  /* Present small originals nicely too: scale up onto a card-like panel */
  width: auto;
  max-width: min(92vw, 1100px);
  max-height: 85vh;
  min-width: min(480px, 86vw);
  min-height: min(300px, 50vh);
  object-fit: contain;
  border-radius: 16px;
  background: #fff;
  padding: 10px;
  box-shadow: 0 24px 64px rgba(18, 32, 63, 0.42);
}
.detail-gallery-lightbox__close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--navy);
  cursor: pointer;
}

/* Loading skeletons: shown while [data-*-detail] carries .is-loading,
   hidden once clan-detail.js / player-detail.js sets .is-ready. */
.detail-hero-skeleton {
  display: grid;
  gap: 12px;
}
.is-ready .detail-hero-skeleton {
  display: none;
}
.sk {
  background: linear-gradient(
    100deg,
    var(--paper) 30%,
    var(--sun-soft) 50%,
    var(--paper) 70%
  );
  background-size: 200% 100%;
  animation: sk-shimmer 1.4s ease infinite;
  border-radius: 8px;
}
.sk-title {
  height: 28px;
  width: 60%;
}
.sk-eyebrow {
  height: 14px;
  width: 30%;
}
.sk-chip {
  height: 24px;
  width: 80px;
  border-radius: 999px;
}
.sk-btn {
  height: 40px;
  width: 130px;
  border-radius: 999px;
}
.sk-row {
  height: 16px;
  width: 100%;
}
@keyframes sk-shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

/* ---------- 12. Mypage & Inbox ---------- */
.mypage-shell {
  display: grid;
  gap: 22px;
}
.mypage-login {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  display: grid;
  gap: 14px;
}
.mypage-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.mypage-card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: grid;
  gap: 12px;
  align-content: start;
}
.mypage-card--wide {
  grid-column: 1 / -1;
}
.mypage-card__text {
  font-size: 0.88rem;
  color: var(--dim);
}

.mypage-inbox-tabs {
  display: inline-flex;
  gap: 6px;
  background: var(--paper);
  padding: 4px;
  border-radius: 999px;
}
.mypage-inbox-tab {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--dim);
  background: transparent;
  border: none;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.mypage-inbox-tab.is-active {
  background: var(--cobalt);
  color: #fff;
}
.mypage-inbox-panel {
  display: grid;
  gap: 12px;
}
.mypage-inbox-row {
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}
.mypage-inbox-row__top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mypage-inbox-row__meta {
  font-size: 0.78rem;
  color: var(--faint);
  margin-left: auto;
}
.mypage-inbox-avatar {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  background: var(--cobalt-soft);
  color: var(--cobalt);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 900;
  background-size: cover;
  background-position: center;
}
.mypage-inbox-message {
  font-size: 0.88rem;
  color: var(--ink);
}
.mypage-inbox-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.mypage-inbox-contact {
  background: var(--sun-soft);
  border-radius: 12px;
  padding: 12px 14px;
  display: grid;
  gap: 6px;
}
.mypage-inbox-contact__guide {
  font-size: 0.78rem;
  color: var(--dim);
}
.mypage-inbox-contact__line {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
}
.mypage-inbox-empty__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
}

/* ---------- 13. Register / Edit forms ---------- */
.apply {
  display: grid;
  gap: 20px;
}
.apply-tabs {
  display: inline-flex;
  gap: 6px;
  background: var(--card);
  border: 2px solid var(--line);
  padding: 5px;
  border-radius: 999px;
}
.apply-tab {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--dim);
  background: transparent;
  border: none;
  padding: 9px 20px;
  border-radius: 999px;
  cursor: pointer;
}
.apply-tab.is-active {
  background: var(--cobalt);
  color: #fff;
}
.apply-grid {
  display: grid;
  gap: 18px;
}
.apply-panel[hidden] {
  display: none;
}
.apply-tier {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--navy);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
}
.apply-tier-icon {
  color: var(--cobalt);
  width: 18px;
  height: 18px;
  flex: none;
  margin-left: auto;
  transition: transform 0.15s ease;
}
.apply-tier[aria-expanded="true"] .apply-tier-icon {
  transform: rotate(180deg);
}
.apply-tier-panel {
  display: none;
  padding: 4px 2px 0;
}
.apply-tier-panel.is-open {
  display: grid;
  gap: 12px;
}

.edit-form,
.edit-grid {
  display: grid;
  gap: 16px;
}
.edit-fieldset {
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  display: grid;
  gap: 14px;
}
.edit-fieldset > legend {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
  padding: 0 8px;
}
.edit-lock {
  font-size: 0.8rem;
  color: var(--warn);
  font-weight: 700;
}
.edit-snapshot {
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 0.86rem;
  color: var(--dim);
}

.recruiting-section {
  display: grid;
  gap: 14px;
}
.recruiting-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.recruiting-option {
  position: relative;
  cursor: pointer;
}
.recruiting-option input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}
.recruiting-option-label {
  display: inline-flex;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--card);
  border: 1.5px solid var(--line);
  color: var(--dim);
  transition: background var(--transition), color var(--transition),
    border-color var(--transition);
}
.recruiting-option input:checked + .recruiting-option-label {
  background: var(--cobalt);
  border-color: var(--cobalt);
  color: #fff;
}

/* ---------- 14. Modals & Toast ---------- */
.contact-request-modal,
.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
}
.contact-request-modal__backdrop,
.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(35, 48, 84, 0.55);
}
.contact-request-modal__panel,
.admin-modal-panel {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow);
}
.admin-modal-panel {
  width: min(640px, 100%);
}
.contact-request-modal__head,
.admin-modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.contact-request-modal__close,
.admin-modal-head button {
  margin-left: auto;
}
.contact-request-modal__close {
  border: none;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  font-size: 1.2rem;
}
.contact-request-modal__lead {
  font-size: 0.88rem;
  color: var(--dim);
}
.contact-request-modal__field,
.admin-modal-grid {
  display: grid;
  gap: 8px;
}
.contact-request-modal__meta {
  font-size: 0.78rem;
  color: var(--faint);
}
.contact-request-modal__actions,
.admin-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

body.is-contact-request-modal-open,
body.is-gallery-lightbox-open {
  overflow: hidden;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(20px);
  z-index: 80;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  font-size: 0.86rem;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.is-error {
  background: var(--err);
}
.toast.is-success {
  background: var(--ok);
}

.load-error {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 28px 20px;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--dim);
  text-align: center;
}
.load-error p {
  font-weight: 700;
}

.share-success {
  display: grid;
  gap: 10px;
}
.share-success-lead {
  font-size: 0.88rem;
  color: var(--dim);
}
.share-x-btn {
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-family: var(--font-display);
  font-weight: 700;
  cursor: pointer;
}

/* ---------- 15. News page ---------- */
.news-head {
  margin-bottom: 26px;
}
.news-head h1 {
  margin: 8px 0 6px;
}
.news-head__sub {
  color: var(--dim);
  font-size: 0.92rem;
}
.news-release {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  margin-bottom: 20px;
  display: grid;
  gap: 20px;
}
.news-release__header {
  display: grid;
  gap: 10px;
}
.news-release__date {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--faint);
  font-weight: 700;
}
.news-release__badge {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.7rem;
  color: var(--cobalt);
  background: var(--cobalt-soft);
  padding: 3px 10px;
  border-radius: 999px;
}
.news-release__title {
  font-size: 1.3rem;
}
.news-release__lead {
  color: var(--dim);
  font-size: 0.92rem;
}
.news-section {
  display: grid;
  gap: 10px;
  padding-top: 18px;
  border-top: 2px solid var(--line);
}
.news-section p {
  color: var(--dim);
  font-size: 0.9rem;
}
.news-section p strong {
  color: var(--navy);
}
.news-section--neutral {
  background: var(--paper);
  border-radius: 14px;
  border-top: none;
  padding: 16px 18px;
}
.news-section__head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.news-section__num {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 8px;
  background: var(--sun);
  color: var(--navy);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.8rem;
  transform: rotate(-6deg);
}
.news-section__title {
  font-size: 1rem;
  flex: 1;
  min-width: 12em;
}
.news-section__title--muted {
  color: var(--dim);
}
.news-note {
  background: var(--sun-soft);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--dim);
}
.news-list,
.news-fix-list,
.news-keep-list {
  padding-left: 1.2em;
  display: grid;
  gap: 6px;
  color: var(--dim);
  font-size: 0.88rem;
}
.news-list li::marker,
.news-fix-list li::marker,
.news-keep-list li::marker {
  color: var(--cobalt);
}
.news-rename {
  display: grid;
  gap: 8px;
}
.news-rename__row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--paper);
  border-radius: 12px;
  padding: 10px 14px;
}
.news-rename__old {
  color: var(--faint);
  font-size: 0.85rem;
  text-decoration: line-through;
}
.news-rename__arrow {
  color: var(--cobalt);
  font-weight: 700;
}
.news-rename__new {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
  font-size: 0.9rem;
}
.news-footer-note {
  text-align: center;
  font-size: 0.85rem;
  color: var(--dim);
  margin-top: 8px;
}
.news-footer-note a {
  color: var(--cobalt);
  font-weight: 700;
}

/* ---------- 16. Admin ---------- */
.admin-shell {
  display: grid;
  gap: 20px;
}
.admin-auth-panel,
.admin-controls,
.admin-summary {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: grid;
  gap: 12px;
}
.admin-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.admin-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
.admin-table-wrap {
  overflow-x: auto;
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
}
.admin-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.admin-table th,
.admin-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1.5px solid var(--line);
}
.admin-table th {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
  background: var(--paper);
}
.admin-col-actions {
  white-space: nowrap;
}
.admin-user-id-box {
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  display: grid;
  gap: 8px;
}
.admin-user-id-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.82rem;
}

/* ---------- 17. Misc states ---------- */
.is-loading {
  opacity: 0.6;
  pointer-events: none;
}
.is-locked {
  opacity: 0.7;
}
.no-highlight {
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 18. Responsive ---------- */
@media (min-width: 901px) {
  .detail-content-v2 {
    grid-template-columns: 1.6fr 1fr;
    align-items: start;
  }
}

@media (max-width: 1100px) {
  .home-hero {
    grid-template-columns: 1fr;
    gap: 30px;
  }
}

@media (max-width: 900px) {
  main {
    padding: 16px 4vw 5rem;
  }
  .header-surface {
    padding: 0 4vw;
  }
  .axis-nav {
    position: absolute;
    top: calc(100% + 8px);
    right: 4vw;
    left: 4vw;
    flex-direction: column;
    gap: 4px;
    background: var(--card);
    border: 2px solid var(--line);
    border-radius: 16px;
    padding: 10px;
    box-shadow: var(--shadow);
    display: none;
  }
  .axis-nav.is-open {
    display: flex;
  }
  .axis-link {
    justify-content: flex-start;
  }
  .header-utility.is-news,
  .header-utility.is-help {
    display: none;
  }
  .header-toggle {
    display: flex;
  }
  .card-grid,
  .home-card-grid,
  .mypage-grid,
  .usage-step-grid,
  .form-step-grid {
    grid-template-columns: 1fr;
  }
  .search-controls {
    grid-template-columns: 1fr;
  }
  .search-close {
    display: inline-flex;
  }
  .footer-surface {
    flex-direction: column;
    gap: 24px;
  }
  .detail-actions .primary,
  .detail-actions .ghost {
    flex: 1;
    min-width: 8em;
  }
}

@media (max-width: 480px) {
  .home-entry {
    padding: 20px 20px 22px;
  }
  .home-entry__arrow {
    width: 30px;
    height: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 19. Mobile bottom navigation ---------- */
.bottom-nav {
  display: none;
}
@media (max-width: 900px) {
  .bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: var(--card);
    border-top: 2px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .bottom-nav__item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    min-height: 44px;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--dim);
  }
  .bottom-nav__item svg {
    width: 22px;
    height: 22px;
  }
  .bottom-nav__item.is-active {
    color: var(--cobalt);
  }
  .bottom-nav__badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 16px);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--err);
    box-shadow: 0 0 0 2px var(--card);
  }
  main {
    padding-bottom: 4.5rem;
  }
  .floating-search-btn {
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }
  .toast {
    bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  }
  .site-footer {
    padding-bottom: 3.5rem;
  }
}

/* ---------- 20. Search bottom sheet (mobile) ---------- */
.search-sheet-backdrop {
  display: none;
}
@media (max-width: 900px) {
  .search-panel.is-sheet-open {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 55;
    max-height: 82vh;
    overflow-y: auto;
    margin: 0;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    box-shadow: 0 -8px 30px rgba(35, 48, 84, 0.16);
  }
  body.is-search-sheet-open {
    overflow: hidden;
  }
  body.is-search-sheet-open .search-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 54;
    background: rgba(35, 48, 84, 0.45);
  }
}

/* ---------- 21. Role colors (lanes) ---------- */
/* Per-lane color as a CSS variable, consumed by role text + chips.
   Values are tuned for the light paper background. */
.role-text,
.role-chip {
  --role-color: var(--dim);
  --role-bg: var(--paper);
  /* !important beats the .card-compact-row strong navy color */
  color: var(--role-color) !important;
}
.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--role-bg);
  color: var(--role-color);
}
.role-text::before,
.role-chip::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 2px;
  background: var(--role-color);
  transform: rotate(45deg);
}
.role--roam {
  --role-color: var(--r-roam);
  --role-bg: var(--r-roam-bg);
}
.role--jungle {
  --role-color: var(--r-jg);
  --role-bg: var(--r-jg-bg);
}
.role--mid {
  --role-color: var(--r-mid);
  --role-bg: var(--r-mid-bg);
}
.role--gold {
  --role-color: var(--r-gold);
  --role-bg: var(--r-gold-bg);
}
.role--exp {
  --role-color: var(--r-exp);
  --role-bg: var(--r-exp-bg);
}
.role--all {
  --role-color: var(--dim);
  --role-bg: var(--paper);
}

/* Card tag chips that carry a role class get the role tint */
.card-tags span.roam,
.card-tags span.role--roam {
  background: var(--r-roam-bg);
  color: var(--r-roam);
  border-color: transparent;
}
.card-tags span.jg,
.card-tags span.jungle,
.card-tags span.role--jungle {
  background: var(--r-jg-bg);
  color: var(--r-jg);
  border-color: transparent;
}
.card-tags span.mid,
.card-tags span.role--mid {
  background: var(--r-mid-bg);
  color: var(--r-mid);
  border-color: transparent;
}
.card-tags span.gold,
.card-tags span.role--gold {
  background: var(--r-gold-bg);
  color: var(--r-gold);
  border-color: transparent;
}
.card-tags span.exp,
.card-tags span.role--exp {
  background: var(--r-exp-bg);
  color: var(--r-exp);
  border-color: transparent;
}

/* ---------- 22. Favorites ---------- */
.mypage-fav-list {
  display: grid;
  gap: 10px;
}
.fav-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  transition: border-color var(--transition);
}
.fav-row:hover {
  border-color: var(--line-strong);
}
.fav-row__type {
  flex: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--cobalt);
  background: var(--cobalt-soft);
  padding: 3px 10px;
  border-radius: 999px;
}
.fav-row strong {
  color: var(--navy);
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fav-row__arrow {
  margin-left: auto;
  color: var(--cobalt);
  font-weight: 700;
}

/* Favorite toggle button on detail pages */
[data-fav-button] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.84rem;
  border-radius: 999px;
  border: 2px solid var(--navy);
  background: var(--card);
  color: var(--navy);
  padding: 9px 18px;
  cursor: pointer;
}
[data-fav-button].is-fav {
  background: var(--err-soft);
  border-color: var(--err);
  color: var(--err);
}
