:root {
  --ink: #0a0503;
  --panel: #130b07;
  --panel-2: #1b110b;
  --panel-3: #251610;
  --line: #2e1d13;
  --line-2: #4a2d1c;
  --text: #f6ece2;
  --muted: #b09a88;
  --ember: #ff5a00;
  --flame: #ff8a1f;
  --amber: #ffb347;
  --cream: #fff1d6;
  --danger: #ff6b6b;
  --ok: #5ee08a;
  --radius: 10px;
  --font: "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  --display: "Unbounded", "Zen Kaku Gothic New", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ink); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.7;
  min-height: 100vh; display: flex; flex-direction: column;
}
h1, h2, h3, h4 { line-height: 1.3; margin: 0; font-weight: 900; }
p { margin: 0 0 1em; }
a { color: var(--amber); text-underline-offset: 3px; }
a:hover { color: var(--cream); }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--cream); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--ember); color: #fff; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: #3a2417; border-radius: 8px; border: 3px solid var(--ink); }
::-webkit-scrollbar-thumb:hover { background: #55321e; }
::-webkit-scrollbar-corner { background: transparent; }

/* ---- ボタン ---- */
.btn {
  font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; border: 1px solid var(--line-2); background: transparent; color: var(--text);
  padding: 9px 16px; border-radius: 999px; line-height: 1.2; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; transition: background .15s, border-color .15s, transform .1s; white-space: nowrap;
}
.btn:hover { background: var(--panel-3); border-color: #6b4228; color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--ember), var(--flame)); border-color: transparent; color: #1c0b02; }
.btn.primary:hover { background: linear-gradient(135deg, #ff6a14, #ffa03d); color: #1c0b02; }
.btn.danger { border-color: #7a2e2e; color: var(--danger); }
.btn.danger:hover { background: #2a1010; border-color: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.lg { padding: 14px 28px; font-size: 16px; }
.btn.block { width: 100%; }
.btn.google { background: #fff; color: #2b2b2b; border-color: #fff; width: 100%; padding: 11px; }
.btn.google:hover { background: #f1f1f1; color: #2b2b2b; }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; padding: 6px 8px; border-radius: 8px; line-height: 1; font-family: inherit; }
.icon-btn:hover { color: var(--text); background: var(--panel-3); }
.link { background: none; border: 0; color: var(--amber); cursor: pointer; font: inherit; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; padding: 2px; }

/* ---- フォーム ---- */
label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 14px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], textarea, select {
  font: inherit; font-size: 14px; color: var(--text); background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 9px 11px; width: 100%; margin-top: 6px; font-weight: 500;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
input:focus, textarea:focus, select:focus { border-color: var(--flame); outline: none; box-shadow: 0 0 0 3px rgba(255, 138, 31, .22); }
input[type=checkbox] { accent-color: var(--flame); width: 16px; height: 16px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; color: var(--text); line-height: 1.6; cursor: pointer; }
.check input { margin-top: 4px; flex: none; }
.form-err { color: var(--danger); font-size: 13px; font-weight: 700; margin: 0 0 10px; }
.note { background: rgba(255, 138, 31, .09); border: 1px solid rgba(255, 138, 31, .3); border-radius: 8px; padding: 10px 12px; font-size: 13px; color: #ffd9a8; }
.fine { font-size: 12px; color: var(--muted); margin: 14px 0 0; line-height: 1.6; }

/* ---- ヘッダー ---- */
.demo-banner { background: #2a1405; color: #ffd9a8; font-size: 12px; text-align: center; padding: 6px 12px; border-bottom: 1px solid #5a2d0c; line-height: 1.5; }
.site-header {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 24px; padding: 10px clamp(16px, 4vw, 40px);
  background: rgba(10, 5, 3, .86); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand img, .foot-brand img { border-radius: 9px; display: block; }
.wordmark { font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: -.01em; color: var(--cream); }
.main-nav { display: flex; gap: 4px; margin-right: auto; }
.main-nav a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.main-nav a:hover { color: var(--text); background: var(--panel-2); }
.main-nav a[aria-current] { color: var(--cream); background: var(--panel-3); }
.hdr-user { position: relative; display: flex; align-items: center; }
.user-btn { display: flex; align-items: center; gap: 8px; background: none; border: 1px solid var(--line-2); color: var(--text); font: inherit; font-weight: 700; font-size: 13px; padding: 3px 12px 3px 3px; border-radius: 999px; cursor: pointer; }
.user-btn:hover { background: var(--panel-2); }
.uname { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 6px; box-shadow: 0 16px 40px rgba(0, 0, 0, .6); z-index: 60; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; font-size: 14px; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--panel-3); }
.menu-id { font-size: 12px; color: var(--muted); padding: 6px 12px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; }
.avatar { border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #140b07; font-weight: 900; flex: none; object-fit: cover; line-height: 1; }

/* ---- フッター ---- */
.site-footer { margin-top: auto; border-top: 1px solid var(--line); padding: 28px clamp(16px, 4vw, 40px); background: var(--panel); }
.foot-in { max-width: 1120px; margin: 0 auto; font-size: 13px; color: var(--muted); }
.foot-in p { margin: 4px 0; }
.foot-brand { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }

/* ---- モーダル・トースト ---- */
.modal-back { position: fixed; inset: 0; z-index: 200; background: rgba(5, 2, 1, .74); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: min(440px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .7); animation: pop .18s; }
.modal.wide { width: min(640px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 6px; }
.modal-head h2 { font-size: 19px; }
.modal-body { padding: 10px 20px 16px; overflow: auto; }
.modal-foot { padding: 12px 20px 18px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.login-reason { font-weight: 700; color: var(--cream); }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.login-links { display: flex; justify-content: space-between; margin-top: 12px; }
.login .note { margin-bottom: 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
#toasts { position: fixed; z-index: 300; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 460px); }
.toast { background: var(--panel-3); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 16px; font-size: 14px; font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: pop .2s; }
.toast.ok { border-color: #2f7a47; color: var(--ok); }
.toast.error { border-color: #8a3333; color: var(--danger); }
.toast.out { opacity: 0; transition: opacity .25s; }

/* ---- 共通パーツ ---- */
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); line-height: 1.6; }
.badge.ok { color: var(--ok); border-color: #2f7a47; }
.badge.warn { color: var(--amber); border-color: #7a5a1d; }
.badge.bad { color: var(--danger); border-color: #7a2e2e; }
.copyright { background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; padding: 18px 20px; }
.copyright h3 { font-size: 16px; margin-bottom: 10px; color: var(--cream); }
.copyright ol { margin: 0; padding-left: 1.4em; }
.copyright li { margin-bottom: 8px; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; border: 1px dashed var(--line-2); border-radius: 16px; }
.empty h3 { color: var(--text); margin-bottom: 6px; font-size: 17px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--flame); animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 720px) {
  .main-nav a { padding: 6px 8px; font-size: 13px; }
  .uname { display: none; }
  .user-btn { padding-right: 3px; }
  .site-header { gap: 8px; }
  .wordmark { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
