:root {
  --bg: #1a1612;
  --bg-card: #231e18;
  --bg-input: #2c261e;
  --border: #3d3529;
  --text: #ede4d6;
  --text-muted: #a89b88;
  --accent: #d97706;
  --accent-light: #fbbf24;
  --accent-bg: rgba(217, 119, 6, 0.1);
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, 0.12);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, 0.12);
  --yellow: #fbbf24;
  --yellow-bg: rgba(251, 191, 36, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --max-width: 1120px;
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent-light); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 1.1rem;
}
.logo:hover, .logo:focus-visible { text-decoration: none; }
.logo-text strong { color: var(--accent-light); }

.nav-menu {
  display: flex;
  list-style: none;
  gap: 24px;
}

.nav-menu a {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

.nav-menu a:hover,
.nav-menu a:focus-visible,
.nav-menu a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle-bar {
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

/* Sections */
section { padding: 60px 0; }

.checker-section { padding-top: 40px; }

h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 8px;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 16px;
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.lede {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 32px;
  max-width: 600px;
}

.section-note {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

/* Checker Layout */
.checker-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  align-items: start;
}

/* Form */
.checker-form {
  display: grid;
  gap: 20px;
  margin-bottom: 24px;
}

.form-group {
  border: none;
  padding: 0;
}

.form-group label,
.form-legend {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group small {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

input[type="number"],
select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  transition: border-color var(--transition);
}

input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--transition);
  font-size: 0.9rem;
}

.radio-label:hover { border-color: var(--accent); }
.radio-label input[type="radio"] {
  accent-color: var(--accent);
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.btn-primary:hover { background: #b45309; transform: translateY(-1px); }
.btn-primary:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }

.btn-outline {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.btn-outline:hover { border-color: var(--accent); color: var(--text); }

.btn-text {
  background: none;
  border: none;
  color: var(--accent-light);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
}

.btn-text:hover { color: var(--accent); }

.btn-preset {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  margin-bottom: 8px;
  transition: border-color var(--transition);
}

.btn-preset:hover { border-color: var(--accent); }

/* Result Panel */
.result-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-top: 24px;
  animation: fadeSlideIn 0.3s ease;
}

.result-panel.is-hidden { display: none; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.result-badge.public { background: var(--green-bg); color: var(--green); }
.result-badge.protected { background: var(--red-bg); color: var(--red); }
.result-badge.uncertain { background: var(--yellow-bg); color: var(--yellow); }

.result-header h2 { font-size: 1.25rem; margin-bottom: 0; }

.result-detail { margin-bottom: 16px; color: var(--text-muted); }

.result-rule {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}

.result-rule h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.result-caveats {
  margin-bottom: 16px;
}

.result-caveats p {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.result-caveats p:last-child { border-bottom: none; }

.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Side Panel */
.checker-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 80px;
}

.side-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.side-card h2 { font-size: 1rem; margin-bottom: 8px; }
.side-note { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 12px; }

.saved-list {
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
}

.saved-list li {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.saved-list li:last-child { border-bottom: none; }

.saved-list .saved-status {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
}

.saved-status.public { background: var(--green-bg); color: var(--green); }
.saved-status.protected { background: var(--red-bg); color: var(--red); }
.saved-status.uncertain { background: var(--yellow-bg); color: var(--yellow); }

/* Guide Section */
.guide-section { background: var(--bg-card); }

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.guide-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.guide-card p, .guide-card li {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.guide-card ul {
  padding-left: 18px;
}

.guide-card li { margin-bottom: 8px; }

/* Country Section */
.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.country-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.country-card h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.country-card .country-rule {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.country-card .country-note {
  font-size: 0.8rem;
  color: var(--accent-light);
  font-style: italic;
}

/* Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding-left: 32px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding: 16px 0;
  padding-left: 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -26px;
  top: 22px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}

.timeline-year {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-light);
  margin-bottom: 4px;
}

.timeline-works {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Footer */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 40px 0 24px;
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-brand {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 4px;
}

.footer-note { font-size: 0.85rem; color: var(--text-muted); }

.footer-nav { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-nav a { font-size: 0.85rem; }

.footer-small {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 860px) {
  .checker-layout {
    grid-template-columns: 1fr;
  }
  .checker-side {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .side-card { flex: 1; min-width: 220px; }
}

@media (max-width: 600px) {
  .nav-toggle { display: flex; }
  .nav-menu {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px 20px;
    gap: 12px;
  }
  .nav-menu.is-open { display: flex; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  section { padding: 40px 0; }
  .radio-group { flex-direction: column; }
  .result-actions { flex-direction: column; }
  .result-actions button { width: 100%; }
}

@media print {
  .site-header, .site-footer, .checker-side, .result-actions, .btn-preset, .btn-text { display: none; }
  body { background: #fff; color: #000; }
  .result-panel { border: 2px solid #000; padding: 20px; }
  .result-badge { border: 1px solid #000; }
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 2px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }


/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
