/* rurimaru account 共通スタイル
   サブページ (マイページ / デバイス管理 / 文書) はデジタル庁デザインシステム (DADS) の
   トークンと作法に沿う: キーカラー Blue-900 #0017C1、塗り/アウトライン/テキストの
   3種のボタン、角丸8px、フォーカスは Yellow-300 + Black の二重インジケーター、
   本文16px以上、Noto Sans JP。
   トップページは PC では従来デザインを .home-page スコープで維持し
   (右側のログイン面だけ白テーマ)、スマホではサブページと同じデザインにする。 */

:root {
  color-scheme: light;
  --ink: #1a1a1a;
  --body-text: #1a1a1a;
  --muted: #626264;
  --border: #d9d9d9;
  --border-strong: #767676;
  --key: #0017c1;
  --key-hover: #00118f;
  --key-active: #000071;
  --key-soft: #e8f1fe;
  --outline-hover: #c5d7fb;
  --control-bg: #f1f1f4;
  --error: #ec0000;
  --focus-yellow: #ffd43d;
  /* トップページ (.home-page) がスコープ内で差し替える従来変数 */
  --key-text: #0017c1;
  --page-bg: #ffffff;
  --field-bg: #ffffff;
  --soft-bg: #f8f8fb;
  --accent: #0017c1;
  --accent-dark: #00118f;
  --link: #0017c1;
  --paper-deep: #e8f1fe;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; margin: 0; }

body {
  min-width: 320px;
  overflow-x: hidden;
  background: var(--page-bg);
  color: var(--ink);
  font-family: "Noto Sans JP", "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }

button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }

/* DADS のフォーカスインジケーター (トップページ以外) */
:focus-visible { outline: 3px solid var(--key); outline-offset: 3px; }
body:not(.home-page) :focus-visible {
  outline: 2px solid #000;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--focus-yellow);
}

[hidden] { display: none !important; }

.material-symbols-rounded { font-size: 1.25em; vertical-align: middle; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
}
.home-page .eyebrow { color: var(--link); }

/* ---------- ブランド ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}
.brand-mark {
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; }
.brand-name { font-size: 16px; white-space: nowrap; }

/* ---------- フッター ---------- */

.footer { color: var(--muted); font-size: 13px; line-height: 1.8; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-nav a { color: var(--key-text); text-decoration: underline; text-underline-offset: 3px; }
.footer-nav a:hover { color: var(--key-hover); }
.copyright { margin: 0; font-size: 12px; }

.content-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 24px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

/* ---------- アバター ---------- */

.avatar-shell {
  width: 72px; height: 72px;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--key-soft);
  border: 1px solid var(--border);
}
.avatar-shell.large { width: 88px; height: 88px; }
.avatar-shell.small { width: 44px; height: 44px; }
.discord-avatar { width: 100%; height: 100%; object-fit: cover; }
.avatar-fallback { font-size: 30px; font-weight: 700; color: var(--key-text); }
.avatar-shell.small .avatar-fallback { font-size: 20px; }

/* ---------- ボタン (DADS: 塗り / アウトライン / テキスト) ---------- */

.social-button {
  width: 100%;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  border-radius: 8px;
  background: #5865f2;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.social-button .fa-discord { font-size: 24px; }
.social-button:hover { filter: brightness(1.07); text-decoration: none; }
.narrow-button { max-width: 360px; }

.primary-button {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 8px;
  background: var(--key);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.primary-button:hover:not(:disabled) { background: var(--key-hover); }
.primary-button:active:not(:disabled) { background: var(--key-active); }
.primary-button:disabled { cursor: not-allowed; opacity: .45; }

.primary-link, .secondary-link {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 700;
}
.primary-link { background: var(--key); color: #fff; }
.primary-link:hover { background: var(--key-hover); text-decoration: none; }
.secondary-link { border: 1px solid var(--key-text); background: var(--field-bg); color: var(--key-text); }
.secondary-link:hover { background: var(--outline-hover); color: var(--key-hover); border-color: var(--key-hover); text-decoration: none; }

.text-button {
  justify-self: start;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--key-text);
  cursor: pointer;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.text-button:hover { color: var(--key-hover); }
.danger-text { color: var(--error); margin-top: 30px; }

.status-message { margin: 0 0 20px; color: var(--muted); font-size: 15px; line-height: 1.8; }

.loading-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  margin-right: 10px;
  vertical-align: -3px;
  border-radius: 50%;
  border: 2px solid var(--control-bg);
  border-top-color: var(--key-text);
  animation: loading-spin .8s linear infinite;
}
@keyframes loading-spin { to { transform: rotate(360deg); } }
.home-page .loading-spinner { border-color: rgba(255, 255, 255, .25); border-top-color: var(--link); }
.status-message:empty { display: none; }
.inline-error { color: var(--error); }

/* ---------- 同意チェック (トップページでも使用) ---------- */

.agreement-check {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 4px 0 20px;
  font-size: 15px;
  line-height: 1.7;
  cursor: pointer;
}
.agreement-check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--key); }
.agreement-check a { color: var(--key-text); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

.welcome-card { display: flex; align-items: center; gap: 20px; }
.welcome-title { margin: 0; font-size: 28px; line-height: 1.4; font-weight: 700; }
.account-actions { display: grid; gap: 12px; margin-top: 24px; }

/* =========================================================
   トップページ (従来デザイン: 動画背景 + 2カラム)
   ダーク基調の変数をこのページのスコープ内だけで差し替える
   ========================================================= */

.home-page {
  --page-bg: #0e1117;
  --panel-bg: #121821;
  --text: #f5f7fb;
  --muted: #aab4c2;
  --border: rgba(255, 255, 255, .15);
  --border-strong: rgba(255, 255, 255, .15);
  --link: #9cde5a;
  --accent: #9cde5a;
  --accent-dark: #9cde5a;
  --accent-text: #14210c;
  --paper-deep: #1a222d;
  --error: #ff9b91;
  --focus: #f5e66a;
  --login-panel-bg: #ffffff;
  background: var(--page-bg);
  color: var(--text);
}

.background-video, .background-dim {
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.background-video { z-index: -2; object-fit: cover; }
.background-dim { z-index: -1; background: rgba(0, 0, 0, .68); }

.page-layout {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
}
.visual-side {
  position: relative;
  min-width: 0;
  min-height: 100vh;
  overflow: hidden;
  background: #19231b;
}
.visual-side:before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(120deg, rgba(12, 20, 16, .48), rgba(7, 11, 9, .84)),
    repeating-linear-gradient(135deg, transparent 0 42px, rgba(191, 227, 156, .035) 43px 44px);
}
.home-page .brand { position: relative; z-index: 2; }
.pc-brand { position: absolute; top: 30px; left: 34px; color: #fff; }
.home-page .brand-mark {
  width: 38px; height: 38px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 23px;
}
.home-page .brand-name { font-size: 15px; }
.visual-copy { position: absolute; top: 43%; left: max(8%, 48px); z-index: 1; color: #fff; }
.visual-kicker {
  margin: 0 0 13px;
  color: var(--link);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
}
.visual-title { margin: 0; font-size: clamp(34px, 4vw, 54px); line-height: 1.45; font-weight: 800; }
.zigzag-border {
  position: absolute;
  top: 0; right: -1px; bottom: 0;
  z-index: 2;
  width: 42px;
  background: var(--login-panel-bg);
  clip-path: polygon(100% 0, 100% 100%, 0 100%, 58% 96%, 12% 92%, 58% 88%, 12% 84%, 58% 80%, 12% 76%, 58% 72%, 12% 68%, 58% 64%, 12% 60%, 58% 56%, 12% 52%, 58% 48%, 12% 44%, 58% 40%, 12% 36%, 58% 32%, 12% 28%, 58% 24%, 12% 20%, 58% 16%, 12% 12%, 58% 8%, 0 4%, 0 0);
}

.login-side {
  position: relative;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 82px 40px 42px;
  background: var(--panel-bg);
}
.mobile-brand { display: none; }
.login-box { width: min(100%, 460px); animation: fade-up .42s ease both; }
.login-header { margin-bottom: 28px; }
.login-title { margin: 0; font-size: 38px; line-height: 1.2; font-weight: 800; }
.login-description { margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.login-box .footer { margin-top: 30px; text-align: center; }
.login-box .footer-nav { justify-content: center; }
.login-box .copyright { margin-top: 8px; }

/* ログイン面は白テーマ。変数をこの面のスコープだけ差し替える
   (左のビジュアル面とジグザグ境界は従来のダーク基調のまま)。 */
.home-page .login-side {
  --panel-bg: var(--login-panel-bg);
  --text: #1a1a1a;
  --muted: #626264;
  --border: #d9d9d9;
  --border-strong: #767676;
  --error: #ec0000;
  --key-text: #0017c1;
  --key-soft: #e8f1fe;
  --control-bg: #f1f1f4;
  color: var(--text);
}
.home-page .login-side .eyebrow { color: #65a92e; }
.home-page .login-side .loading-spinner { border-color: var(--control-bg); border-top-color: #65a92e; }
.home-page .login-side .agreement-check a { color: var(--key-text); }
.home-page .login-side .text-button { color: var(--key-text); }
.mobile-topline { display: none; }

.home-page .social-button { border-radius: 999px; min-height: 52px; font-size: 14px; }
.home-page .primary-button { border-radius: 999px; color: var(--accent-text); }
.home-page .primary-link { background: var(--accent); color: var(--accent-text); border-radius: 12px; }
.home-page .secondary-link {
  border: 1px solid var(--border);
  background: transparent;
  color: inherit;
  border-radius: 12px;
}
.home-page .secondary-link:hover {
  border-color: var(--accent);
  background: transparent;
  color: inherit;
  text-decoration: none;
}
.home-page .text-button { text-decoration: none; color: var(--link); }
.home-page .welcome-title { font-family: inherit; font-size: 30px; line-height: 1.35; }
.home-page .avatar-fallback { font-family: inherit; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.home-page .agreement-check a { color: var(--link); }
.home-page .agreement-check input { accent-color: #65a92e; }
.home-page .footer-nav a { color: inherit; text-decoration: none; }

/* ---------- アカウントメニュー (アバターから開く) ---------- */

.header-menu-wrap { position: relative; }
.header-user {
  display: inline-flex;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.header-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 60;
  width: min(300px, calc(100vw - 24px));
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--soft-bg);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .16);
}
.header-menu-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: var(--field-bg);
}
.avatar-shell.header-menu-avatar { width: 48px; height: 48px; }
.header-menu-avatar .avatar-fallback { font-size: 22px; }
.header-menu-name { margin: 0; font-size: 15px; font-weight: 700; }
.header-menu-group {
  background: var(--field-bg);
  border-radius: 12px;
  padding: 6px;
  margin-bottom: 10px;
}
.header-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 500;
}
.header-menu-item:hover { background: var(--soft-bg); text-decoration: none; }
.header-menu-item .material-symbols-rounded { font-size: 22px; color: var(--key-text); }
.header-menu-links {
  margin: 0 0 10px;
  padding: 12px;
  border-radius: 12px;
  background: var(--field-bg);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.header-menu-links a { color: var(--key-text); text-decoration: underline; text-underline-offset: 3px; }
.header-menu-logout {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--field-bg);
  color: var(--error);
  font-weight: 700;
  cursor: pointer;
}
.header-menu-logout:hover:not(:disabled) { background: var(--error); color: #fff; }
.header-menu-logout:disabled { opacity: .5; cursor: not-allowed; }

.token-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
}
#token-expires { color: var(--muted); font-size: 13px; }

/* =========================================================
   アカウントページ共通 (DADS)
   ========================================================= */

.content-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 24px 32px;
  background: var(--page-bg);
}
.content-page > * { width: 100%; max-width: 1024px; margin-inline: auto; }

.page-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.topline-actions { display: flex; align-items: center; gap: 16px; }

/* パンくずリスト */
.breadcrumb { margin-bottom: 36px; }
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}
.breadcrumb li { display: inline-flex; align-items: center; gap: 8px; }
.breadcrumb li + li::before { content: "›"; color: var(--muted); }
.breadcrumb a { color: var(--key-text); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb a:hover { color: var(--key-hover); }
.breadcrumb [aria-current] { color: var(--ink); }

.page-body { width: 100%; }

.content-page h1 { margin: 0 0 12px; font-size: 32px; line-height: 1.4; font-weight: 700; }
.content-page h2 { margin: 0; font-size: 20px; line-height: 1.5; font-weight: 700; }
.content-page p { color: var(--body-text); line-height: 1.8; }

.content-page > .content-footer { margin-top: auto; }
.content-page > article + .content-footer,
.content-page > section + .content-footer,
.content-page > nav + .content-footer { margin-top: 72px; }

/* ---------- マイページ ---------- */

.mypage-greeting { padding: 20px 0 4px; text-align: center; }
.mypage-greeting h1 { margin: 0; font-size: clamp(29px, 4.5vw, 36px); }

.menu-section { margin-top: 44px; }
.menu-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 17px;
}
.content-page h2.menu-section-title { font-size: 17px; }
.menu-section-mark {
  width: 11px; height: 11px;
  flex: 0 0 auto;
  border: 2px solid var(--key-text);
  border-radius: 50%;
}

.wide-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 22px;
  border-radius: 12px;
  background: var(--soft-bg);
}
a.wide-card:hover { background: var(--key-soft); text-decoration: none; }
.wide-card h3 { margin: 0; font-size: 17px; font-weight: 700; }
.wide-card p { margin: 4px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.card-icon {
  width: 56px; height: 56px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--key-soft);
  font-size: 28px;
  color: var(--key-text);
}
.card-arrow { color: var(--muted); font-size: 22px; }
.disabled-card { opacity: .55; }
.disabled-card .card-icon { background: var(--control-bg); color: var(--muted); }

/* ---------- ヘッダーのテーマ切り替えとユーザーアイコン ---------- */

.theme-toggle {
  width: 40px; height: 40px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  color: var(--muted);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); }
.theme-toggle .material-symbols-rounded { font-size: 24px; }
.avatar-shell.header-avatar { width: 40px; height: 40px; border: 0; }
.header-avatar .avatar-fallback { font-size: 18px; }

/* ---------- ダークテーマ (DADS ダークのトークン) ---------- */

html.dark-theme {
  --ink: #f5f5f5;
  --body-text: #f5f5f5;
  --muted: #a8a8a8;
  --border: #2e2e2e;
  --border-strong: #6e6e6e;
  --key-text: #7096f8;
  --key-soft: rgba(112, 150, 248, .16);
  --control-bg: #1a1a1a;
  --page-bg: #000000;
  --field-bg: #111111;
  --soft-bg: #050505;
}

/* ---------- デバイス管理 ---------- */


.section-block { margin-top: 48px; }
.section-block > h2 { margin-bottom: 16px; }
.device-help { margin: 0; color: var(--muted); font-size: 15px; }

.device-form { margin: 20px 0 6px; }
.device-form label { display: block; margin-bottom: 8px; font-size: 16px; font-weight: 700; }
.device-form-row { display: flex; flex-wrap: wrap; gap: 12px; }
.device-form input {
  min-height: 52px;
  flex: 1 1 240px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--field-bg);
  color: var(--ink);
  font-size: 16px;
}
.device-form button {
  min-height: 52px;
  padding: 0 24px;
  border: 0;
  border-radius: 8px;
  background: var(--key);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}
.device-form button:hover { background: var(--key-hover); }

.device-list { padding: 0; margin: 0; list-style: none; }
.device-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.device-row:last-child { border-bottom: 0; }
.device-name { margin: 0 !important; color: var(--ink) !important; font-size: 16px; font-weight: 700; }
.device-detail { margin: 4px 0 0 !important; color: var(--muted); font-size: 13px; }
.device-row button, .token-actions button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--key-text);
  border-radius: 8px;
  background: var(--field-bg);
  color: var(--key-text);
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
}
.device-row button { border: 0; background: transparent; color: var(--error); }
.device-row button:hover { background: var(--error); color: #fff; }
.token-actions button:hover { background: var(--outline-hover); color: var(--key-hover); border-color: var(--key-hover); }

.token-panel {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--key-text);
  border-radius: 8px;
  background: var(--field-bg);
}
.token-label { margin: 0 !important; color: var(--ink) !important; font-weight: 700; }
.device-token {
  display: block;
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--soft-bg);
  overflow-wrap: anywhere;
  user-select: text;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 14px;
}
.token-actions { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; }
.token-actions button { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- 文書ページ (利用規約 / プライバシーポリシー) ---------- */

.document { max-width: 44em; }
.document h1 { margin-bottom: 8px; }
.document-version { margin: 0 0 40px; color: var(--muted); font-size: 14px; }
.document h2 { margin: 40px 0 12px; font-size: 20px; }
.document p { margin: 0 0 16px; font-size: 16px; line-height: 1.9; }
.document a { color: var(--key-text); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- その他 ---------- */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 大きな画面 (PC) ---------- */
@media (min-width: 1600px) {
  .content-page { padding: 32px 24px 40px; }
  .content-page > * { max-width: 1200px; }
  .mypage-greeting h1 { font-size: 40px; }
}

/* ---------- 中間の画面幅 (小さめの PC ウィンドウなど) ---------- */
@media (max-width: 1200px) and (min-width: 901px) {
  .content-page { padding: 24px 32px 32px; }
  .menu-section { margin-top: 36px; }
}

@media (max-width: 900px) {
  .background-video, .background-dim, .visual-side { display: none; }
  .page-layout { display: block; }
  .content-page { padding: 20px 20px 28px; }
  .breadcrumb { margin-bottom: 28px; }

  /* トップページ: スマホではサブページ (DADS) と同じデザインにする。
     変数をサブページのトークンに戻し、.home-page 用の部品上書きも標準へ戻す。 */
  .home-page {
    --page-bg: #ffffff;
    --field-bg: #ffffff;
    --soft-bg: #f8f8fb;
    --text: #1a1a1a;
    --muted: #626264;
    --border: #d9d9d9;
    --border-strong: #767676;
    --link: #0017c1;
    --accent: #0017c1;
    --accent-dark: #00118f;
    --accent-text: #ffffff;
    --paper-deep: #e8f1fe;
    --error: #ec0000;
  }
  .home-page .login-side {
    --panel-bg: var(--page-bg);
    --text: #1a1a1a;
    --muted: #626264;
    --border: #d9d9d9;
    --border-strong: #767676;
    min-height: 100vh;
    min-height: 100dvh;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 20px 20px 28px;
  }
  html.dark-theme .home-page .login-side {
    --text: #f5f5f5;
    --muted: #a8a8a8;
    --border: #2e2e2e;
    --border-strong: #6e6e6e;
    --key-text: #7096f8;
    --key-soft: rgba(112, 150, 248, .16);
    --control-bg: #1a1a1a;
  }
  .mobile-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    margin-bottom: 36px;
    border-bottom: 1px solid var(--border);
  }
  .mobile-brand { position: static; display: inline-flex; }
  .home-page .brand-mark { width: 34px; height: 34px; border-radius: 0; background: transparent; }
  .login-box { width: 100%; max-width: 560px; margin: 0 auto; flex: 1; display: flex; flex-direction: column; }
  .login-title { font-size: 32px; }
  .login-description { font-size: 16px; }
  .home-page .eyebrow { color: var(--muted); }
  .home-page .login-side .eyebrow { color: var(--muted); }
  .home-page .social-button { border-radius: 8px; min-height: 56px; font-size: 16px; }
  .home-page .primary-button { border-radius: 8px; color: #fff; }
  .home-page .primary-link { background: var(--key); color: #fff; border-radius: 8px; }
  .home-page .secondary-link { border: 1px solid var(--key-text); background: var(--field-bg); color: var(--key-text); border-radius: 8px; }
  .home-page .secondary-link:hover { background: var(--outline-hover); color: var(--key-hover); border-color: var(--key-hover); }
  .home-page .text-button { color: var(--key-text); text-decoration: underline; text-underline-offset: 4px; }
  .home-page .loading-spinner { border-color: var(--control-bg); border-top-color: var(--key-text); }
  .home-page .login-side .loading-spinner { border-color: var(--control-bg); border-top-color: var(--key-text); }
  .home-page .agreement-check input { accent-color: var(--key); }
  .home-page .welcome-title { font-size: 28px; }
  .login-box .footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: left;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px 24px;
  }
  .login-box .footer-nav { justify-content: flex-start; }
  .login-box .copyright { margin-top: 0; }
}

@media (max-width: 640px) {
  .compact-welcome { flex-direction: column; align-items: flex-start; }
  .home-page .welcome-title { font-size: 26px; }
  .welcome-card > div { min-width: 0; }
}

@media (max-width: 540px) {
  .page-topline { gap: 10px; }
  .topline-actions { gap: 6px; }
  .brand { gap: 8px; }
  .brand-mark { width: 30px; height: 30px; }
  .brand-name { font-size: 15px; }
  .theme-toggle { width: 36px; height: 36px; }
  .theme-toggle .material-symbols-rounded { font-size: 22px; }
  .avatar-shell.header-avatar { width: 36px; height: 36px; }
  .avatar-shell.header-menu-avatar { width: 44px; height: 44px; }
  .mypage-greeting h1 { font-size: 29px; }
  .content-page h1 { font-size: 28px; }
  .wide-card { grid-template-columns: auto 1fr; padding: 18px; }
  .card-arrow { display: none; }
  .device-form-row { display: grid; }
  .device-form button { width: 100%; }
  .content-footer { flex-direction: column; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* =========================================================
   課題ダッシュボード (dash.uni.rurimaru.net) 固有
   ========================================================= */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.stat-card {
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--soft-bg);
}
.stat-card .stat-label { margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.stat-card .stat-value { margin: 4px 0 0; font-size: 30px; font-weight: 700; line-height: 1.2; }
.stat-card .stat-value.alert { color: var(--error); }
.sync-note { margin: 12px 0 0; color: var(--muted); font-size: 13px; }

.assignment-list { list-style: none; margin: 0; padding: 0; }
.assignment-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.assignment-row:last-child { border-bottom: 0; }
.assignment-main { flex: 1 1 260px; min-width: 0; }
.assignment-title { margin: 0; font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.assignment-title a { color: var(--key-text); text-decoration: underline; text-underline-offset: 3px; }
.assignment-course { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.assignment-due { text-align: right; }
.assignment-due .due-date { margin: 0; font-size: 15px; font-weight: 700; }
.assignment-due .due-relative { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.assignment-due.overdue .due-date, .assignment-due.overdue .due-relative { color: var(--error); }

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--key-soft);
  color: var(--key-text);
  white-space: nowrap;
}
.status-badge.submitted { background: var(--control-bg); color: var(--muted); }
.status-badge.not-submitted { background: #fdecec; color: var(--error); }
html.dark-theme .status-badge.not-submitted { background: rgba(236, 0, 0, .18); }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 8px;
}
.filter-bar label { display: grid; gap: 6px; font-size: 14px; font-weight: 700; }
.filter-bar select {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--field-bg);
  color: var(--ink);
  font-size: 15px;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.course-card {
  display: block;
  padding: 18px;
  border-radius: 12px;
  background: var(--soft-bg);
}
a.course-card:hover { background: var(--key-soft); text-decoration: none; }
.course-card h3 { margin: 0; font-size: 16px; }
.course-card p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }

.empty-note { color: var(--muted); margin: 8px 0 0; }
