/* 閲覧サイトと管理画面で共通の見た目（デザイン案A「創造と破壊」）。
   書き出しのときに、各サイトの dist/base.css として写す（web-ui/scripts/shared-files.mjs）。
   ページは /fonts/fonts.css・/base.css のあとに、サイトごとの /styles.css を読む。
   CSP の style-src 'self' のため、見た目はすべて CSS のファイルに書く（HTML に style 属性を書かない）。
   文字と地の色の差は、WCAG の 4.5:1 以上にする（web-ui/test/contrast.test.ts で確かめている）。 */

:root {
  color-scheme: dark;
  /* 地 */
  --bg: #0d0f1a;
  --surface: #151a2b;
  --surface-2: #1c2238;
  --line: #2a3150;
  --line-2: #3a4370;
  /* 文字 */
  --text: #e8eaf4;
  --muted: #a2a9c8;
  /* 案Aの --dim（#7d84a6）は、パネルの上で 4.5:1 に届かないので明るくした */
  --dim: #8a91b3;
  /* 強調：創造の青・つなぎの紫・破壊の赤 */
  --primary: #4a5bff;
  --primary-hi: #6372ff;
  --creation: #8c9bff;
  --bridge: #8b5cf6;
  --destruction: #e5485f;
  /* 破壊の赤は、文字には暗すぎる（4.5:1 に届かない）ので、赤い文字にはこの色を使う */
  --destruction-text: #ff9aab;
  --gold: #e0c36a;
  --ring: linear-gradient(90deg, #4a5bff 0%, #8b5cf6 50%, #e5485f 100%);
  /* 文字の形：本文は M PLUS 1p。見出しは --display の1か所で決める（ラノベPOP v2 → 入っていない字は M PLUS 1p） */
  --font: "M PLUS 1p", system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
  --display: "LightNovelPOPv2", "M PLUS 1p", system-ui, sans-serif;
  /* 並び：帯の左右の余白と、帯の列の間は同じにする（上の帯のタイトルの位置のため） */
  --gutter: 16px;
  --radius: 9px;
  --radius-lg: 14px;
  /* キーボードでの操作の印 */
  --focus: #8c9bff;
}

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

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

a {
  color: var(--creation);
  text-decoration: none;
}

a:hover {
  color: #ffffff;
  text-decoration: underline;
}

/* ---- キーボードでの操作の印（どの部品でも、はっきり見えるように） ---- */

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgb(140 155 255 / 0.25);
}

/* ---- 見出し ---- */

/* h1：両端がとがった帯の形に、うすい青→紫→赤のグラデーション。どの画面でも、左右の真ん中に置く */
h1 {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 24px;
  text-align: center;
  padding: 8px 40px;
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.4;
  clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 18px 100%, 0 50%);
  background: linear-gradient(90deg, rgb(74 91 255 / 0.35), rgb(139 92 246 / 0.3), rgb(229 72 95 / 0.3));
}

/* h2：各節の見出し。先頭にひし形 */
h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 28px 0 12px;
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.5;
}

h2::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
  background: var(--ring);
}

/* 大きな見出しのすぐ下の説明文（見出しに合わせて真ん中） */
.page-lead {
  margin: -8px 0 24px;
  text-align: center;
}

/* 利用者が入れた文字（テンプレの名前など）は、見出しの中でも M PLUS 1p で出す */
.user-text {
  font-family: var(--font);
}

/* サイトが決めた文字を、見出しのフォントで出す（web-ui/scripts/display-font.mjs が文字を集める目印にもなる） */
.display-text {
  font-family: var(--display);
  font-weight: 800;
}

.boot {
  color: var(--muted);
  padding: 24px var(--gutter);
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.8125rem;
}

.error {
  color: var(--destruction-text);
  background: rgb(229 72 95 / 0.08);
  border: 1px solid #6d2a3a;
  border-radius: var(--radius);
  padding: 10px 14px;
}

.notice,
.callout {
  color: var(--text);
  background: linear-gradient(90deg, rgb(74 91 255 / 0.1), rgb(139 92 246 / 0.08));
  border: 1px solid #3d3a6d;
  border-radius: 12px;
  padding: 12px 16px;
}

/* ---- ページの右上の魔法陣（うっすら。狭い幅とログインのページでは出さない） ---- */

/* 魔法陣（620px）の右の 200px は画面の外に出る置き方（見本どおり）。箱ははみ出させず、画面の中の 420px だけにして、
   絵の右側を箱の外で切る（ページの横幅を広げないため） */
body::before {
  content: "";
  position: absolute;
  top: 140px;
  right: 0;
  width: 420px;
  height: 620px;
  background: url(/images/ornament-circle.webp) left top / 620px 620px no-repeat;
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
}

body.page--login::before {
  display: none;
}

/* ---- 上の帯 ---- */

/* 広い幅：左・真ん中・右の3列。左右の列を同じ幅（1fr）にするので、メニューは帯の真ん中に来る。
   狭い幅に切り替えるかは、画面のスクリプトが実際の幅を測って決める（web-ui/src/SiteHeader.tsx）。 */
.site-header {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  /* 列の間は、帯の左右の余白（--gutter）と同じにする（タイトルを、画面の左端とメニューの間の真ん中に置くため） */
  column-gap: var(--gutter);
  min-height: 72px;
  padding: 0 var(--gutter);
  background: var(--surface);
}

/* 帯の下の、青→紫→赤の線 */
.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--ring);
  pointer-events: none;
}

/* 広い幅：タイトルは、左の列の中で左右の真ん中に置く。
   帯の左右の余白（--gutter）と列の間（column-gap）を同じにしているので、左の列の真ん中は、
   画面の左端とメニューのかたまりの左端の、ちょうど真ん中になる（どちらかを変えるときは、両方をそろえる） */
.site-header--wide .site-header__brand {
  justify-self: center;
}

/* 狭い幅：1段に、左にタイトル、右にアカウント。足りないときは、タイトルではなく表示名のほうを「…」で省略する */
.site-header--narrow {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.site-header--narrow .site-header__spacer {
  display: none;
}

.site-header--narrow .site-header__brand {
  flex: 0 0 auto;
  max-width: 75%;
}

.site-header--narrow .site-header__account {
  flex: 0 1 auto;
}

/* タイトル：ロゴ（白い縁と青い光）、縦線、添え字 */
.site-header__brand {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.site-header__brand:hover {
  text-decoration: none;
}

.site-header__logo {
  display: block;
  height: 44px;
  width: auto;
  flex: none;
  filter: drop-shadow(0 0 2px rgb(255 255 255 / 0.9)) drop-shadow(0 0 6px rgb(140 155 255 / 0.55));
}

.site-header__tag {
  padding: 2px 0 2px 12px;
  border-left: 1px solid var(--line-2);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  line-height: 1.4;
}

/* 管理画面の添え字：「LIBRARY」（灰色）＋「管理画面」（赤） */
.site-header__tag--admin {
  color: #ff8fa1;
  letter-spacing: 0.14em;
}

.site-header__tag-sub {
  color: var(--muted);
  letter-spacing: 0.22em;
}

.site-header__nav {
  display: flex;
  align-items: center;
  gap: 4px 6px;
  white-space: nowrap;
}

/* メニューの項目は、帯の高さ（72px）ちょうどにする */
.site-header__link {
  position: relative;
  display: block;
  padding: 0 12px;
  line-height: 72px;
  color: var(--muted);
  text-decoration: none;
}

.site-header__link:hover {
  color: var(--text);
  text-decoration: none;
}

.site-header__link[aria-current="page"] {
  color: var(--text);
}

.site-header__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--creation);
}

.site-header__account {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 0.875rem;
}

.site-header__who {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* 表示名が長いときは「…」で省略する */
.site-header__name {
  min-width: 0;
  max-width: 14em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ≡ のボタン（開くと × になる）と、アカウントのボタン */
.site-header__menu-button,
.site-header__account-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 42px;
  min-height: 42px;
  padding: 4px 9px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.site-header__menu-button:hover,
.site-header__account-button:hover,
.site-header__menu-button[aria-expanded="true"],
.site-header__account-button[aria-expanded="true"] {
  border-color: var(--creation);
}

.site-header__account-button {
  min-width: 0;
  max-width: 100%;
  border-color: transparent;
}

.site-header__caret {
  color: var(--muted);
  font-size: 0.75rem;
}

.menu-icon {
  position: relative;
  display: block;
  width: 18px;
  height: 14px;
}

.menu-icon span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.15s ease, opacity 0.15s ease, top 0.15s ease;
}

.menu-icon span:nth-child(1) {
  top: 0;
}

.menu-icon span:nth-child(2) {
  top: 6px;
}

.menu-icon span:nth-child(3) {
  top: 12px;
}

.menu-icon--open span:nth-child(1) {
  top: 6px;
  transform: rotate(45deg);
}

.menu-icon--open span:nth-child(2) {
  opacity: 0;
}

.menu-icon--open span:nth-child(3) {
  top: 6px;
  transform: rotate(-45deg);
}

/* ≡ で開くメニュー（帯の下に、縦に開く） */
.site-header__panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 8px var(--gutter) 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 12px 24px rgb(0 0 0 / 0.45);
}

.site-header__panel-nav {
  display: flex;
  flex-direction: column;
}

.site-header__panel-link {
  display: block;
  padding: 10px 10px;
  border-left: 3px solid transparent;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
}

.site-header__panel-link:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.site-header__panel-link[aria-current="page"] {
  border-left-color: var(--creation);
  background: var(--surface-2);
  font-weight: 700;
}

.site-header__panel-account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  min-width: 0;
}

/* アカウントを押したら出る小さなメニュー（閲覧サイトの狭い幅） */
.site-header__popover {
  position: absolute;
  top: calc(100% - 4px);
  right: var(--gutter);
  z-index: 20;
  min-width: 190px;
  max-width: calc(100% - 2 * var(--gutter));
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: 0 12px 24px rgb(0 0 0 / 0.45);
}

.site-header__popover .site-header__panel-nav {
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.site-header__popover-actions {
  display: flex;
  justify-content: flex-end;
}

/* 1段に収まるかを測るための写し。見えないところに置き、ほかの並びに響かせない */
.site-header__measure {
  position: absolute;
  top: 0;
  left: 0;
  /* 入れ物は幅0で中身を切り取る（中の写しは本来の幅のまま測れる。ページの横幅は広げない） */
  width: 0;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
  white-space: nowrap;
  display: flex;
  /* 帯の列の間（column-gap）と同じにする。幅を測るときに、この値を列の間として使う */
  gap: var(--gutter);
}

/* 写しの中は、帯の今の並び（広い幅・狭い幅）の決まりに左右されず、いつも本来の幅で測る
   （狭い幅の決まりが写しにも効くと、測った幅が並びによって変わり、広い幅と狭い幅を行ったり来たりする） */
.site-header .site-header__measure > * {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: none;
  flex: none;
}

/* ---- ページの入れ物 ---- */

.page {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 40px 56px;
}

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

.narrow {
  max-width: 560px;
  margin: 0 auto;
}

/* ---- ボタン・入力 ---- */

/* ボタン：ふつうは二番手（枠だけ）。主のボタンは創造の青 */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  /* ボタンの文字は折り返さない。横に並んだ入力などに押されて、狭くならないようにする */
  white-space: nowrap;
  flex-shrink: 0;
}

.button:hover {
  border-color: var(--creation);
  color: var(--text);
  text-decoration: none;
}

.button:disabled {
  opacity: 0.55;
  cursor: default;
}

.button--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* 重ねたときは少し暗くする（明るい青 --primary-hi では、白い文字との差が 4.5:1 に届かない） */
.button--primary:hover {
  background: #3b4be0;
  border-color: #3b4be0;
  color: #ffffff;
}

/* 小さなボタン */
.button--quiet {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.8125rem;
}

/* 取り返しのつきにくい操作（破壊の赤） */
.button--danger {
  border-color: #6d2a3a;
  color: var(--destruction-text);
}

.button--danger:hover {
  border-color: var(--destruction);
  color: #ffc2cc;
}

.button--danger-strong {
  background: #b3263f;
  border-color: #b3263f;
  color: #ffffff;
}

.button--danger-strong:hover {
  background: #c62f49;
  border-color: #c62f49;
  color: #ffffff;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--creation);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.link-button:hover {
  color: #ffffff;
  text-decoration: underline;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.field__label {
  font-size: 0.8125rem;
  color: var(--muted);
}

.field__note {
  font-size: 0.8125rem;
  color: var(--muted);
}

.field__note strong {
  color: var(--text);
}

.field__error {
  font-size: 0.8125rem;
  color: var(--destruction-text);
}

input[type="text"],
input[type="search"],
select {
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
}

input[type="text"]:focus,
input[type="search"]:focus,
select:focus {
  border-color: var(--primary-hi);
}

input::placeholder {
  color: var(--dim);
  opacity: 1;
}

input[aria-invalid="true"] {
  border-color: var(--destruction);
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--primary);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 12px 0 4px;
  color: var(--text);
  font-size: 0.9375rem;
  cursor: pointer;
}

.check input {
  width: 20px;
  height: 20px;
  margin-top: 3px;
  flex-shrink: 0;
}

/* ---- ログインのボタン ---- */

.login-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 18px 0;
}

.login-buttons .button {
  width: 100%;
  min-height: 48px;
  font-size: 0.9375rem;
}

/* ---- タグ・状態の印 ---- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 0;
  border-radius: 999px;
  background: #202850;
  color: #c3cbff;
  font: inherit;
  font-size: 0.75rem;
  line-height: 1.5;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.tag:hover {
  background: #2a3468;
  color: #ffffff;
  text-decoration: none;
}

/* 状態の印：利用中・未使用は青、承認待ち・申請ありは金、停止・却下・削除は赤、期限切れ・取り消しは灰 */
.status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
  background: #232842;
  color: var(--dim);
}

.status--unused,
.status--active {
  background: rgb(74 91 255 / 0.18);
  color: #b9c3ff;
}

.status--applied,
.status--pending {
  background: rgb(224 195 106 / 0.15);
  color: var(--gold);
}

.status--suspended,
.status--rejected,
.status--deleted {
  background: rgb(229 72 95 / 0.15);
  color: var(--destruction-text);
}

.status--expired,
.status--revoked {
  background: #232842;
  color: var(--dim);
}

/* ---- 画面の中の確認（取り返しのつきにくい操作の前） ---- */

.confirm {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 520px;
  padding: 12px;
  background: rgb(229 72 95 / 0.08);
  border: 1px solid #6d2a3a;
  border-radius: 12px;
}

.confirm__message p {
  margin: 0 0 6px;
}

.confirm__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---- 続きを読む ---- */

.load-more {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

/* ---- アイコン ---- */

.avatar {
  display: block;
  flex-shrink: 0;
  border-radius: 999px;
  object-fit: cover;
  background: var(--surface-2);
}

/* ---- 断面の絵 ---- */

.section-shape {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
}

.section-shape__frame {
  fill: none;
  stroke: var(--line-2);
  stroke-width: 0.8;
}

.section-shape__axis {
  stroke: var(--line-2);
  stroke-width: 0.4;
  stroke-dasharray: 1.5 1.5;
}

.section-shape__shape {
  fill: rgb(74 91 255 / 0.2);
  stroke: var(--creation);
  stroke-width: 1.2;
  stroke-linejoin: round;
}

.section-shape__start {
  fill: var(--gold);
}

/* ---- ログインのページ（web-ui/src/LoginStage.tsx） ---- */

/* ログインのページは、スクロールせずに1画面に収める。画面の高さ（100dvh：スマホのアドレスバーで高さが変わっても合う）に
   合わせて、ロゴ・立ち絵・上下の余白を縮める（ログインの枠とボタンは、押しやすい大きさのまま） */
.login-stage {
  /* 立ち絵の高さ（画面の高さに合わせて縮める）。立ち絵の位置の計算にも使うので、縮めても体の軸の決まりは変わらない */
  --chara-h: min(640px, 76vh);
  --chara-h: min(640px, 76dvh);
  /* ログインの枠の幅の半分 */
  --panel-half: 230px;
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* 背景：上から暗い色を重ねる */
.login-stage__bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(180deg, rgb(13 15 26 / 0.55) 0%, rgb(13 15 26 / 0.8) 60%, #0d0f1a 100%),
    url(/images/login-bg.webp);
  background-size: cover;
  background-position: center 30%;
}

/* 床の光（紫） */
.login-stage__floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 220px;
  background: radial-gradient(ellipse 60% 100% at 50% 100%, rgb(139 92 246 / 0.22), transparent 70%);
}

/* 立ち絵：下端をそろえ、足元をふわっと消す */
.login-stage__chara {
  position: absolute;
  bottom: 0;
  height: var(--chara-h);
  width: auto;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 82%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 82%, transparent 100%);
}

/* 位置は体の軸で決める（web-ui/images/README.md）。
   破壊：軸（画像の幅の 0.625）を、画面の左端と枠の左端の真ん中（25% - 枠の幅の半分の半分）に置く。画像は 361×760
   創造：軸（画像の幅の 0.41）を、枠の右端と画面の右端の真ん中（75% + 枠の幅の半分の半分）に置く。画像は 664×760 */
.login-stage__chara--hakai {
  left: calc(25% - var(--panel-half) / 2 - var(--chara-h) * 361 / 760 * 0.625);
  filter: drop-shadow(0 0 24px rgb(229 72 95 / 0.35));
}

.login-stage__chara--sozo {
  left: calc(75% + var(--panel-half) / 2 - var(--chara-h) * 664 / 760 * 0.41);
  filter: drop-shadow(0 0 24px rgb(74 91 255 / 0.35));
}

/* 画面が狭く、立ち絵がログインの枠と大きく重なる幅（体の軸と枠の端の間が、体の幅の半分ほどより狭い）では出さない */
@media (max-width: 939.98px) {
  .login-stage__chara {
    display: none;
  }
}

.login-stage__main {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: calc(var(--panel-half) * 2);
  margin: clamp(8px, 3vh, 40px) 16px;
  margin: clamp(8px, 3dvh, 40px) 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 2vh, 18px);
  gap: clamp(8px, 2dvh, 18px);
  text-align: center;
}

/* ロゴ：画面の高さに合わせて縮める（横は 420px まで） */
.login-stage__logo {
  display: block;
  width: auto;
  max-width: 100%;
  height: clamp(64px, 20vh, 196px);
  height: clamp(64px, 20dvh, 196px);
  object-fit: contain;
}

.login-stage__tagline {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
  letter-spacing: 0.3em;
}

.login-stage__panel {
  width: 100%;
  background: rgb(21 26 43 / 0.88);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.login-stage__panel h1 {
  margin: 0 auto 12px;
  font-size: 1.25rem;
}

.login-stage__panel p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.875rem;
}

.login-stage__panel .login-buttons {
  margin: 14px 0;
}

/* 背の低い画面では、ログインの枠の中の余白を詰める（ボタンの高さは 46px のまま） */
@media (max-height: 760px) {
  .login-stage__panel {
    padding: 16px 18px;
  }

  .login-stage__panel h1 {
    margin-bottom: 8px;
    padding-top: 6px;
    padding-bottom: 6px;
    font-size: 1.125rem;
  }

  .login-stage__panel .login-buttons {
    gap: 10px;
    margin: 10px 0;
  }

  .login-stage__panel .login-buttons .button {
    min-height: 46px;
  }

  .login-stage__panel p {
    margin-bottom: 6px;
    font-size: 0.8125rem;
    line-height: 1.55;
  }
}

/* 管理画面のログイン：背景を少し暗く、床の光と枠の縁を赤みのある色に */
.login-stage--admin .login-stage__bg {
  background-image:
    linear-gradient(180deg, rgb(13 15 26 / 0.62) 0%, rgb(13 15 26 / 0.84) 60%, #0d0f1a 100%),
    url(/images/login-bg.webp);
}

.login-stage--admin .login-stage__floor {
  background: radial-gradient(ellipse 60% 100% at 50% 100%, rgb(229 72 95 / 0.2), transparent 70%);
}

.login-stage--admin .login-stage__panel {
  border-color: #4a2a3d;
}

.login-stage--admin .login-stage__tagline {
  color: #ff8fa1;
  font-size: 0.9375rem;
}

/* ---- スマホの幅 ---- */

@media (max-width: 720px) {
  body::before {
    display: none;
  }

  .page {
    padding: 24px var(--gutter) 48px;
  }

  .panel {
    padding: 16px;
  }

  h1 {
    padding: 8px 30px;
    font-size: 1.3rem;
  }

  .site-header__name {
    max-width: 10em;
  }
}

@media (max-width: 440px) {
  /* 狭い幅の帯：ロゴを小さくし、添え字を詰める（管理画面は「管理画面」だけを出す） */
  .site-header--narrow .site-header__logo {
    height: 32px;
  }

  .site-header--narrow .site-header__brand {
    gap: 8px;
  }

  .site-header--narrow .site-header__tag {
    padding-left: 8px;
    font-size: 0.6875rem;
    letter-spacing: 0.1em;
  }

  .site-header--narrow .site-header__tag-sub {
    display: none;
  }
}

/* 画面には出さず、読み上げにだけ使う文字 */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 文が2つ以上続く文章は、1文ごとに行を分ける（web-ui/src/messages.tsx の Sentences） */
.sentence {
  display: block;
}

/* 各画面の一番下の「TOPへ」のボタン（真ん中） */
.back-to-top {
  display: flex;
  justify-content: center;
  margin-top: 48px;
}

.back-to-top .button {
  min-width: 160px;
}
