:root {
  color-scheme: dark;
  --page-bg: #0e1117;
  --panel-bg: #121821;
  --text: #f5f7fb;
  --muted: #aab4c2;
  --border: rgba(255, 255, 255, 0.15);
  --footer-text: #a0a9b6;
  --link: #9cde5a;
  --accent: #9cde5a;
  --accent-text: #14210c;
  --control-bg: #1a222d;
  --error: #ff9b91;
  --focus: #f5e66a;
}

body.light-theme {
  color-scheme: light;
  --page-bg: #f2f5ef;
  --panel-bg: #ffffff;
  --text: #172015;
  --muted: #596554;
  --border: rgba(23, 32, 21, 0.18);
  --footer-text: #596554;
  --link: #397d16;
  --accent: #8dcc4c;
  --accent-text: #14210c;
  --control-bg: #f4f7f1;
  --error: #a22b20;
  --focus: #175dab;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  min-width: 320px;
  overflow-x: hidden;
  background: var(--page-bg);
  color: var(--text);
  font-family: "Yu Gothic UI", "Meiryo", sans-serif;
}
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; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }

.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, 0.68); }
.theme-toggle {
  position: fixed;
  z-index: 5;
  top: 18px;
  right: 22px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-symbol { color: var(--link); font-size: 18px; line-height: 1; }
.page-layout { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: 1.05fr 0.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, 0.48), rgba(7, 11, 9, 0.84)), repeating-linear-gradient(135deg, transparent 0 42px, rgba(191, 227, 156, 0.035) 43px 44px);
}
.brand { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: 10px; font-weight: 800; }
.pc-brand { position: absolute; top: 30px; left: 34px; color: #fff; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--accent); color: var(--accent-text); font-size: 23px; font-weight: 900; }
.brand-name { font-size: 15px; }
.visual-copy { position: absolute; top: 43%; left: max(8%, 48px); z-index: 1; color: #fff; }
.visual-kicker, .eyebrow { margin: 0 0 13px; color: var(--link); font-size: 11px; font-weight: 800; letter-spacing: 0.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(--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%, 430px); animation: fade-up 420ms 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; overflow-wrap: anywhere; }
.social-button { width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 12px; border: 0; border-radius: 999px; background: #5865f2; color: #fff; font-size: 14px; font-weight: 800; cursor: pointer; }
.social-button:hover { filter: brightness(1.08); text-decoration: none; }
.discord-mark { width: 25px; height: 25px; display: grid; place-items: center; border: 2px solid currentColor; border-radius: 9px; font-size: 13px; font-weight: 900; }
.account-actions { display: grid; gap: 12px; }
.secondary-link { min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; border: 1px solid var(--border); border-radius: 12px; font-weight: 700; }
.secondary-link:hover { border-color: var(--accent); text-decoration: none; }
.text-button { justify-self: start; padding: 8px 0; border: 0; background: transparent; color: var(--link); cursor: pointer; font-weight: 700; }
.agreement-check { display: flex; align-items: flex-start; gap: 11px; margin: 20px 0; color: var(--text); font-size: 14px; line-height: 1.7; cursor: pointer; }
.agreement-check input { width: 19px; height: 19px; flex: 0 0 auto; margin: 2px 0 0; accent-color: #65a92e; }
.primary-button { width: 100%; min-height: 50px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-weight: 800; cursor: pointer; }
.primary-button:disabled { cursor: not-allowed; opacity: 0.48; }
.primary-button:not(:disabled):hover { filter: brightness(1.06); }
.agreement-links { margin: 17px 0 0; color: var(--muted); font-size: 13px; }
.agreement-links a { color: var(--link); font-weight: 700; }
.agreement-links span { padding: 0 5px; }
.status-message { margin: 0 0 20px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.status-message:empty { display: none; }
.inline-error { margin: 14px 0 0; color: var(--error); font-size: 13px; line-height: 1.7; }
.footer { margin-top: 30px; color: var(--footer-text); text-align: center; font-size: 12px; line-height: 1.8; }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; }
.footer-nav a { overflow-wrap: anywhere; }
.copyright { margin: 8px 0 0; font-size: 11px; }

.content-page { min-height: 100vh; padding: 38px max(22px, calc((100vw - 840px) / 2)); background: var(--panel-bg); }
.content-page .brand { margin-bottom: 56px; }
.content-page h1 { margin: 0 0 12px; font-size: 36px; line-height: 1.25; }
.content-page h2 { margin: 34px 0 10px; font-size: 19px; }
.content-page p { max-width: 68ch; color: var(--muted); line-height: 1.9; }
.content-page .footer { margin-top: 54px; }
.document-version { color: var(--text) !important; font-weight: 700; }
.device-form { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 28px; }
.device-form input { min-height: 46px; flex: 1 1 220px; min-width: 0; padding: 0 13px; border: 1px solid var(--border); border-radius: 8px; background: var(--control-bg); color: var(--text); }
.device-form button, .device-row button { min-height: 44px; padding: 0 15px; border: 1px solid var(--border); border-radius: 8px; background: var(--control-bg); color: var(--text); cursor: pointer; font-weight: 700; }
.device-form button:hover, .device-row button:hover { border-color: var(--accent); }
.device-list { padding: 0; margin: 0; list-style: none; border-top: 1px solid var(--border); }
.device-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 0; border-bottom: 1px solid var(--border); }
.device-meta { min-width: 0; }
.device-name { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.device-detail { margin: 5px 0 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.device-token { display: block; max-width: 100%; margin-top: 16px; padding: 15px; border: 1px solid var(--border); border-radius: 8px; background: var(--control-bg); color: var(--text); overflow-wrap: anywhere; white-space: pre-wrap; user-select: text; }
.device-help { color: var(--muted); font-size: 13px; line-height: 1.7; }
.page-topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.page-topline .brand { margin-bottom: 0; }
.page-topline .theme-toggle { position: static; box-shadow: none; }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 900px) {
  .background-video, .background-dim, .visual-side { display: none; }
  .page-layout { display: block; min-height: 100vh; }
  .login-side { min-height: 100vh; align-items: flex-start; padding: 106px 22px 32px; }
  .mobile-brand { position: absolute; top: 20px; left: 20px; display: inline-flex; color: var(--text); }
  .mobile-brand .brand-mark { width: 32px; height: 32px; border-radius: 10px; font-size: 20px; }
  .mobile-brand .brand-name { font-size: 13px; }
  .theme-toggle { top: 15px; right: 14px; min-height: 40px; gap: 6px; padding-inline: 11px; font-size: 12px; }
  .login-box { width: min(100%, 430px); margin: auto; }
  .login-title { font-size: 34px; }
  .content-page { padding: 24px 22px 36px; }
  .content-page .brand { margin-bottom: 46px; }
  .page-topline { align-items: flex-start; }
  .page-topline .theme-toggle { position: static; }
}
@media (max-width: 440px) {
  .login-side { padding-inline: 18px; }
  .login-title { font-size: 32px; }
  .footer-nav { gap: 6px 12px; }
  .content-page { padding-inline: 18px; }
  .content-page h1 { font-size: 31px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}