:root {
  --ink: #1a1f36;
  --ink-2: #425466;
  --muted: #687385;
  --line: #e3e8ee;
  --bg: #ffffff;
  --bg-2: #f6f8fa;
  --accent: #E04F16;
  --accent-ink: #b83e0f;
  --navy: #0b1222;
  --green: #15803d;
  --rose: #be123c;
  --sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; letter-spacing: -0.005em; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input { font-family: inherit; }
:focus { outline: none; }
html[data-input="keyboard"] :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.auth { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); min-height: 100vh; }
.auth-side { position: relative; background: var(--navy); color: #fff; padding: 36px 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; overflow: hidden; }
.auth-side::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 70% 60% at 80% 0%, rgba(42, 120, 214, 0.28), rgba(42, 120, 214, 0) 70%), radial-gradient(ellipse 60% 50% at 0% 100%, rgba(224, 79, 22, 0.2), rgba(224, 79, 22, 0) 70%); }
.auth-side > * { position: relative; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand img.mark { width: 30px; height: 30px; }
.brand img.word { height: 20px; width: auto; }
.side-copy h2 { font-size: clamp(28px, 3vw, 40px); line-height: 1.08; letter-spacing: -0.035em; font-weight: 800; max-width: 460px; }
.side-copy h2 em { font-style: normal; color: var(--accent); }
.side-points { list-style: none; display: grid; gap: 14px; margin-top: 28px; max-width: 440px; }
.side-points li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; font-size: 14.5px; line-height: 1.55; color: rgba(255, 255, 255, 0.75); }
.side-points svg { width: 18px; height: 18px; color: var(--accent); margin-top: 2px; }
.side-foot { font-size: 12.5px; color: rgba(255, 255, 255, 0.45); }

.auth-main { display: flex; flex-direction: column; padding: 28px 48px; }
.auth-top { display: flex; justify-content: flex-end; align-items: center; gap: 16px; font-size: 13.5px; color: var(--muted); min-height: 40px; }
.auth-top a { font-weight: 700; color: var(--ink); }
.auth-top a:hover { color: var(--accent-ink); }
.auth-card { width: 100%; max-width: 420px; margin: auto; padding: 32px 0 48px; }
.auth-card.wide { max-width: 560px; }
.auth-card h1 { font-size: 30px; line-height: 1.12; letter-spacing: -0.03em; font-weight: 800; }
.auth-card .lede { font-size: 15px; line-height: 1.55; color: var(--ink-2); margin-top: 8px; }

form { display: grid; gap: 16px; margin-top: 28px; }
.field { display: grid; gap: 6px; align-content: start; }
.field label { font-size: 13px; font-weight: 700; color: var(--ink); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.field label a { font-weight: 600; color: var(--accent-ink); font-size: 12.5px; }
.field label a:hover { color: var(--accent); }
.field .opt { font-weight: 500; color: var(--muted); font-size: 12px; }
.input-wrap { position: relative; }
.field input { width: 100%; height: 46px; padding: 0 14px; border: 1px solid #d5dbe5; border-radius: 10px; background: #fff; color: var(--ink); font-size: 15px; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.field input::placeholder { color: #a3acbb; }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(224, 79, 22, 0.12); }
.field.has-error input { border-color: var(--rose); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.field .err { font-size: 12.5px; font-weight: 600; color: var(--rose); }
.field .err:empty { display: none; }
.input-wrap input { padding-right: 70px; }
.reveal-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 32px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 700; cursor: pointer; }
.reveal-btn:hover { background: var(--bg-2); color: var(--ink); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 20px; border-radius: 10px; border: 1px solid transparent; font: 700 15px/1 var(--sans); letter-spacing: -0.01em; cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease; white-space: nowrap; }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 8px 24px -10px rgba(224, 79, 22, 0.7); }
.btn-accent:hover { background: #c8460f; }
.btn-line { background: #fff; color: var(--ink); border-color: #d5dbe5; }
.btn-line:hover { border-color: var(--ink-2); }
.btn-danger { background: #fff; color: var(--rose); border-color: #f3c3cf; }
.btn-danger:hover { background: var(--rose); color: #fff; border-color: var(--rose); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.btn .spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.45); border-top-color: #fff; animation: spin 0.7s linear infinite; display: none; }
.btn.is-busy .spin { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.notice { font-size: 13.5px; line-height: 1.5; padding: 12px 14px; border-radius: 10px; border: 1px solid; }
.notice:empty, .notice[hidden] { display: none; }
.notice.is-error { color: var(--rose); background: #fff1f3; border-color: #f7c6d0; }
.notice.is-ok { color: var(--green); background: #edf8f1; border-color: #c7e8d3; }
.alt { margin-top: 22px; font-size: 14px; color: var(--muted); text-align: center; }
.alt a { font-weight: 700; color: var(--accent-ink); }
.alt a:hover { color: var(--accent); }
.fine { font-size: 12px; line-height: 1.5; color: var(--muted); text-align: center; }

.panel { border: 1px solid var(--line); border-radius: 16px; padding: 24px; margin-top: 22px; }
.panel h2 { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.panel p.sub { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.panel form { margin-top: 18px; }
.panel.danger { border-color: #f7d4dc; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.who { display: flex; align-items: center; gap: 14px; margin-top: 22px; }
.who .avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 16px; flex-shrink: 0; }
.who strong { display: block; font-size: 16px; }
.who span { font-size: 13.5px; color: var(--muted); }
.state { text-align: center; padding: 20px 0; }
.state .icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 16px; background: #edf8f1; color: var(--green); }
.state .icon.warn { background: #fff4ed; color: var(--accent-ink); }
.state .icon svg { width: 24px; height: 24px; }
.state h1 { font-size: 24px; }
.state p { font-size: 14.5px; line-height: 1.55; color: var(--ink-2); margin-top: 8px; }
.state .btn { margin-top: 22px; }

.page-loading .auth-card { visibility: hidden; }

@media (max-width: 900px) {
  .auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .auth-side { padding: 22px 20px; gap: 0; }
  .side-copy, .side-foot { display: none; }
  .auth-main { padding: 16px 20px 32px; }
  .auth-top { justify-content: flex-start; }
  .auth-card { margin: 0 auto; padding-top: 12px; }
}
@media (max-width: 520px) {
  .two { grid-template-columns: minmax(0, 1fr); }
  .auth-card h1 { font-size: 26px; }
  .panel { padding: 18px; }
  .row-end .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .btn .spin { animation: none; } }
.field input[readonly] { background: var(--bg-2); color: var(--muted); cursor: default; }
.field input[readonly]:focus { border-color: #d5dbe5; box-shadow: none; }
.pref-tile { display: flex; align-items: center; gap: 16px; margin-top: 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); cursor: pointer; position: relative; transition: border-color 0.15s ease, background 0.15s ease; }
.pref-tile:hover { border-color: #d5dbe5; }
.pref-icon { flex: none; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); color: var(--accent); }
.pref-icon svg { width: 19px; height: 19px; }
.pref-text { flex: 1; display: grid; gap: 4px; min-width: 0; }
.pref-text strong { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.pref-text > span { font-size: 13px; line-height: 1.5; color: var(--muted); }
.pref-text .pref-state { font-size: 12px; font-weight: 600; color: var(--green); margin-top: 2px; }
.pref-tile.is-off .pref-state { color: var(--muted); }
.pref-tile input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch { flex: none; width: 44px; height: 26px; border-radius: 999px; background: #d5dbe5; position: relative; transition: background 0.18s ease; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(26, 31, 54, 0.25); transition: transform 0.18s ease; }
.pref-tile input:checked + .switch { background: var(--accent); }
.pref-tile input:checked + .switch::after { transform: translateX(18px); }
.pref-tile input:disabled + .switch { opacity: 0.6; }
html[data-input="keyboard"] .pref-tile input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 3px; }
#prefsBox .notice { margin-top: 14px; }
#linksBox .notice { margin-top: 14px; word-break: break-all; }
#exportBox .notice { margin-top: 14px; }
@media (max-width: 520px) { #exportBox .btn { width: 100%; white-space: normal; height: auto; min-height: 46px; padding: 10px 16px; line-height: 1.3; } }
.links-list { margin-top: 16px; display: grid; gap: 10px; }
.links-empty { font-size: 13.5px; line-height: 1.5; color: var(--muted); padding: 16px 18px; border: 1px dashed var(--line); border-radius: 14px; background: var(--bg-2); }
.link-row { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); }
.link-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.link-main strong { font-size: 14px; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.link-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); }
.link-btns { flex: none; display: flex; gap: 8px; }
.btn.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; }
.btn-line.is-done { color: var(--green); border-color: #c7e8d3; }
.btn-line.btn-danger-line { color: var(--rose); }
.btn-line.btn-danger-line.is-confirm { background: var(--rose); color: #fff; border-color: var(--rose); }
@media (max-width: 520px) { .link-row { flex-direction: column; align-items: stretch; gap: 12px; } .link-btns .btn { flex: 1; } }
@media (max-width: 520px) { .pref-tile { align-items: flex-start; padding: 14px; gap: 12px; } .pref-icon { width: 34px; height: 34px; } .switch { margin-top: 4px; } }
.auth-lang { display: inline-flex; }
#signOutBtn.is-confirm { background: var(--rose); border-color: var(--rose); color: #fff; }
html, body { overflow-x: clip; }
