/* Base Reset & Theme Tokens */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Noto Sans JP, Hiragino Kaku Gothic ProN, Meiryo, sans-serif; line-height: 1.6; background: var(--bg); color: var(--fg); -webkit-font-smoothing: antialiased; }
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

:root {
  --bg: #0b0c10;
  --panel: #101218;
  --fg: #e7eaf0;
  --fg-muted: #b9c0ce;
  --border: #222632;
  --brand: #8b5cf6; /* violet-500 */
  --brand-strong: #7c3aed; /* violet-600 */
  --accent: #22d3ee; /* cyan-400 */
  --success: #22c55e;
  --danger: #ef4444;
  --shadow: 0 6px 24px rgba(0,0,0,.26), 0 2px 8px rgba(0,0,0,.18);
  --radius: 12px;
  --radius-sm: 8px;
  --gap: 16px;
}

/* Light theme when .theme-dark is NOT present */
/* Default above is dark-first; override for light */
html:not(.theme-dark) {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --fg: #0e1321;
  --fg-muted: #5b657a;
  --border: #e7eaf0;
  --brand: #7c3aed;
  --brand-strong: #6d28d9;
  --accent: #0891b2;
  --shadow: 0 6px 24px rgba(10, 22, 50, .08), 0 2px 8px rgba(10, 22, 50, .06);
}

.container { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.section { padding: 56px 0; }
.section.alt { background: linear-gradient(180deg, transparent, rgba(127, 127, 127, .05)); }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px;
  padding: 12px 20px; box-shadow: var(--shadow);
}
.brand { font-weight: 800; letter-spacing: .2px; color: var(--brand); }
.nav { display: flex; gap: 14px; flex-wrap: wrap; }
.nav a { padding: 8px 10px; border-radius: 8px; color: var(--fg-muted); }
.nav a:hover { background: rgba(127,127,127,.08); color: var(--fg); }
.theme-toggle { appearance: none; border: 1px solid var(--border); background: var(--panel); color: var(--fg); border-radius: 999px; padding: 8px 12px; cursor: pointer; box-shadow: var(--shadow); }
.theme-toggle:hover { transform: translateY(-1px); }

/* Hero */
.hero { background: radial-gradient(1200px 480px at 20% -20%, rgba(124,58,237,.25), transparent), radial-gradient(900px 420px at 80% -20%, rgba(34,211,238,.18), transparent); padding: 72px 0 56px; }
.hero-inner { display: grid; gap: 16px; justify-items: start; text-align: left; }
.avatar { font-size: 56px; filter: drop-shadow(0 6px 16px rgba(0,0,0,.25)); }
.title { font-size: clamp(28px, 4.5vw, 40px); margin: 0; line-height: 1.2; letter-spacing: .2px; }
.subtitle { margin: 6px 0 2px; color: var(--fg-muted); font-size: clamp(14px, 2.2vw, 16px); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); color: var(--fg); box-shadow: var(--shadow); cursor: pointer; transition: transform .1s ease, background .2s ease; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: linear-gradient(180deg, var(--brand), var(--brand-strong)); border-color: transparent; color: #fff; }

/* Features */
.facts { margin: 12px 0 0; padding-left: 18px; color: var(--fg); }
.facts li { margin: 6px 0; }

.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.badge { padding: 6px 10px; border-radius: 999px; border: 1px dashed var(--border); background: rgba(124,58,237,.08); color: var(--fg); }

/* Cards */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 16px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); display: grid; gap: 8px; }
.card .thumb { height: 120px; border-radius: var(--radius-sm); background: linear-gradient(135deg, rgba(124,58,237,.25), rgba(34,211,238,.18)); border: 1px solid var(--border); }
.card h3 { margin: 2px 0 0; font-size: 18px; }
.card p { margin: 0; color: var(--fg); }
.card .help { margin-top: -4px; }
.card-link { color: var(--brand); font-weight: 600; }
.card-link:hover { text-decoration: underline; }

/* Links, help text */
.links { margin: 10px 0 0; padding: 0; list-style: none; }
.links li { margin: 6px 0; }
.help { color: var(--fg-muted); font-size: 14px; }

/* Forms */
.form { display: grid; gap: 14px; margin-top: 8px; }
.field { display: grid; gap: 6px; }
.field.inline { grid-template-columns: 160px 1fr; align-items: center; gap: 10px; }
.field label { color: var(--fg); font-weight: 600; }
.field.required > label::after { content: ' *必須'; color: var(--danger); margin-left: 6px; font-weight: 700; }
.checkboxes { display: flex; flex-wrap: wrap; gap: 10px 16px; }

/* Compact time range inputs */
.time-range { display: inline-flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.time-range input[type="time"] { width: 9.5ch; min-width: 90px; max-width: 120px; }
.time-range .help { margin: 0; }

input, select, textarea {
  appearance: none; width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--panel); color: var(--fg);
  outline: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.02);
}
/* Make checkbox inputs small squares */
input[type="checkbox"] {
  appearance: auto; /* restore native */
  width: auto; height: auto; padding: 0; margin: 0 6px 0 0;
  accent-color: var(--brand);
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(124,58,237,.22); }
input[required], textarea[required] { border-color: rgba(239,68,68,.6); }
input[required]:focus, textarea[required]:focus { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239,68,68,.22); }

/* Tables */
.table { width: 100%; border-collapse: collapse; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--panel); box-shadow: var(--shadow); }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.table thead th { background: rgba(124,58,237,.08); color: var(--fg); position: sticky; top: 0; }
.table tbody tr:hover { background: rgba(127,127,127,.06); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--panel); padding: 18px 0; color: var(--fg-muted); }

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

/* Typography tweaks inside sections */
h1, h2, h3 { color: var(--fg); line-height: 1.25; }
h1 { font-size: clamp(22px, 4.2vw, 28px); margin: 0 0 6px; }
h2 { font-size: 20px; margin: 0 0 8px; }
h3 { font-size: 18px; margin: 0; }
p { margin: 0; }

/* Responsive */
@media (max-width: 720px) {
  .site-header { grid-template-columns: 1fr auto; grid-auto-rows: auto; }
  .nav { grid-column: 1 / -1; order: 3; overflow-x: auto; padding-bottom: 4px; }
  .field.inline { grid-template-columns: 1fr; }
}

/* Print (CSV exports readability) */
@media print {
  .site-header, .theme-toggle, .actions, .hero, .site-footer { display: none !important; }
  body { background: #fff; color: #000; }
  .table thead th { background: #f0f0f0; color: #000; }
}
