:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --ink: #231f1b;
  --muted: #70695f;
  --line: #d8d0c3;
  --paper: #fffdf8;
  --accent: #9d2f2f;
  --accent-2: #2f6f67;
  --gold: #b98428;
  --shadow: 0 14px 36px rgba(45, 32, 20, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(157, 47, 47, 0.08), transparent 260px),
    var(--bg);
  color: var(--ink);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Hiragino Sans",
    "Yu Gothic",
    Meiryo,
    sans-serif;
  line-height: 1.6;
}

.site-header,
main,
footer {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 28px 0 18px;
}

.site-header-main {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  width: 100%;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid rgba(157, 47, 47, 0.35);
  background: var(--paper);
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.kicker {
  margin: 0 0 2px;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 700;
}

.header-account {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.account-link,
.account-button {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.9);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.mini-button {
  margin-top: 6px;
  min-height: 30px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.9);
  color: var(--accent-2);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.command-preview {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.84);
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.command-copy-button {
  margin-top: 12px;
}

.account-button {
  cursor: pointer;
}

.account-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-2);
}

h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 38px);
  letter-spacing: 0;
  line-height: 1.2;
}

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 16px;
}

.subnav a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.82);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.subnav a:hover {
  border-color: rgba(47, 111, 103, 0.45);
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--line);
  box-shadow: var(--shadow);
}

.summary-band > div {
  min-width: 0;
  padding: 18px 20px;
  background: var(--paper);
}

.metric-value {
  display: block;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
}

.metric-label {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px 140px 170px 180px 170px 140px auto;
  gap: 12px;
  align-items: end;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.82);
}

.toolbar-actions {
  display: flex;
  align-items: end;
}

.secondary-button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.96);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin-top: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.72);
  color: var(--muted);
  font-size: 13px;
}

.active-filters strong {
  color: var(--ink);
  font-size: 13px;
}

.policy-note {
  margin-top: 14px;
  padding: 14px 16px;
  border-left: 4px solid var(--accent-2);
  background: rgba(255, 253, 248, 0.82);
  color: var(--ink);
}

.policy-note strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.policy-note p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.detail-policy-note {
  margin-top: 18px;
}

.source-note {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.72);
}

.source-note strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.source-note p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.excluded-guidance {
  margin-top: 18px;
}

.excluded-guidance-links {
  margin: 10px 0 0;
  padding-left: 18px;
}

.excluded-guidance-links li + li {
  margin-top: 6px;
}

.excluded-guidance-links li::marker {
  color: var(--accent-2);
}

.detail-source-note {
  margin-top: 12px;
}

.inline-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.inline-link:hover {
  text-decoration: underline;
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  letter-spacing: 0;
}

input {
  padding: 0 12px;
}

select {
  padding: 0 36px 0 10px;
}

input:focus,
select:focus {
  outline: 2px solid rgba(47, 111, 103, 0.35);
  outline-offset: 1px;
}

.table-wrap {
  margin-top: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #efe7d8;
  color: #4a3e31;
  font-size: 12px;
  letter-spacing: 0;
}

tbody tr:hover {
  background: #fbf4e8;
}

.date-cell,
.period-cell {
  white-space: nowrap;
  color: #3d372f;
}

.related-period-cell {
  display: grid;
  gap: 6px;
  min-width: 220px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  white-space: normal;
}

.period-status-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(47, 111, 103, 0.22);
  background: rgba(47, 111, 103, 0.08);
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.period-status-badge-muted {
  border-color: rgba(112, 105, 95, 0.22);
  background: rgba(112, 105, 95, 0.1);
  color: #5b5348;
}

.kind-pill {
  display: inline-block;
  min-width: 116px;
  padding: 3px 8px;
  border-left: 3px solid var(--gold);
  background: #f6efe1;
  color: #514535;
  font-size: 12px;
  font-weight: 700;
}

.event-title {
  display: block;
  max-width: 520px;
  font-weight: 700;
  line-height: 1.5;
}

.event-title-link {
  color: var(--ink);
  text-decoration: none;
}

.event-title-link:hover .event-title {
  color: var(--accent);
  text-decoration: underline;
}

.event-summary {
  display: block;
  max-width: 620px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.excluded-helper-text {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

a.official-link {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

a.official-link:hover {
  text-decoration: underline;
}

.empty-row td {
  padding: 28px 14px;
  color: var(--muted);
  text-align: center;
}

.detail-card,
.search-results {
  margin-top: 18px;
}

.detail-card {
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.detail-meta-grid > div,
.search-card,
.search-hero {
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.84);
}

.detail-meta-grid > div {
  padding: 14px 16px;
}

.detail-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-section {
  margin-top: 18px;
}

.detail-callouts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.detail-focus-card {
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(47, 111, 103, 0.24);
  background: linear-gradient(135deg, rgba(47, 111, 103, 0.08), rgba(255, 253, 248, 0.96));
}

.detail-focus-card strong {
  display: block;
  margin-top: 8px;
  font-size: 16px;
}

.detail-focus-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.detail-focus-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid rgba(47, 111, 103, 0.24);
  background: rgba(47, 111, 103, 0.12);
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.detail-focus-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.detail-callout {
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.84);
}

.detail-callout p {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}

.detail-key-points {
  margin-top: 16px;
  padding: 14px 16px;
  border-left: 4px solid var(--gold);
  background: rgba(255, 253, 248, 0.84);
}

.detail-key-points strong {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}

.detail-key-points ul {
  margin: 0;
  padding-left: 18px;
}

.detail-key-points li + li {
  margin-top: 6px;
}

.detail-jump-links,
.detail-related-actions {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.78);
}

.detail-jump-links strong,
.detail-related-actions strong {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}

.detail-jump-link-row,
.detail-related-action-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-jump-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(47, 111, 103, 0.2);
  background: rgba(47, 111, 103, 0.08);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.detail-jump-link:hover {
  border-color: rgba(47, 111, 103, 0.45);
  color: var(--accent);
}

.detail-body-blocks {
  display: grid;
  gap: 10px;
}

.detail-body-blocks p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.8;
}

.detail-more-block {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed rgba(112, 105, 95, 0.35);
}

.detail-more-block summary {
  cursor: pointer;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 700;
  list-style: none;
}

.detail-more-block summary::-webkit-details-marker {
  display: none;
}

.detail-more-block[open] summary {
  margin-bottom: 10px;
}

.detail-subsection {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-left: 3px solid rgba(47, 111, 103, 0.35);
  background: rgba(255, 253, 248, 0.68);
}

.detail-subsection h3 {
  margin: 0;
  color: #4a3e31;
  font-size: 14px;
}

.detail-schedule-list {
  display: grid;
  grid-template-columns: minmax(120px, 210px) minmax(0, 1fr);
  gap: 8px 14px;
  margin: 0;
}

.detail-schedule-list dt,
.detail-schedule-list dd {
  margin: 0;
  line-height: 1.8;
}

.detail-schedule-list dt {
  color: #4a3e31;
  font-size: 13px;
  font-weight: 700;
}

.detail-schedule-list dd {
  color: var(--ink);
  font-size: 13px;
  word-break: break-word;
}

.detail-neighbors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.detail-neighbor {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.84);
  color: var(--ink);
  text-decoration: none;
}

.detail-neighbor:hover,
.detail-related-list a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.detail-neighbor strong {
  font-size: 14px;
  line-height: 1.5;
}

.detail-neighbor small {
  color: var(--muted);
  font-size: 12px;
}

.detail-neighbor-empty {
  color: var(--muted);
}

.detail-related-list {
  margin: 0;
  padding-left: 18px;
}

.detail-related-list li + li {
  margin-top: 10px;
}

.detail-related-list a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.detail-related-list span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.detail-section h2,
.search-hero h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.detail-section p,
.search-card-summary,
.search-hero p {
  margin: 0;
}

.search-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  padding: 18px 20px;
}

.search-results {
  display: grid;
  gap: 12px;
}

.mobile-results {
  display: none;
  margin-top: 18px;
  gap: 12px;
}

.mobile-event-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.84);
}

.mobile-event-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mobile-event-title {
  display: inline-block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.5;
  text-decoration: none;
}

.mobile-event-title:hover,
.mobile-event-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.mobile-event-period {
  margin: 8px 0 0;
  color: #4a3e31;
  font-size: 12px;
  font-weight: 700;
}

.mobile-event-summary {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.mobile-event-reward {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.mobile-event-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
}

.mobile-event-links a {
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.search-card {
  padding: 16px 18px;
}

.search-card-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search-card-title {
  display: inline-block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
}

.search-card-title:hover,
.search-card-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.search-card-summary {
  margin-top: 6px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

.search-card-period {
  margin: 8px 0 0;
  color: #4a3e31;
  font-size: 12px;
  font-weight: 700;
}

.search-card-reward {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.mobile-event-reward .period-status-badge,
.search-card-reward .period-status-badge {
  margin-left: 6px;
  vertical-align: middle;
}

.search-card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
}

.search-card-links a {
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.search-empty {
  padding: 28px 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  text-align: center;
}

.empty-guidance strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
}

.empty-guidance p {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.7;
}

.empty-guidance-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 14px;
  margin-top: 12px;
}

.empty-guidance-links a {
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.empty-guidance-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.shortcut-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.shortcut-panel > div {
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.82);
}

.shortcut-panel strong {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}

.shortcut-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.96);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.chip-button:hover {
  border-color: rgba(47, 111, 103, 0.45);
  color: var(--accent);
}

.chip-button-muted {
  color: var(--muted);
}

body[data-density="compact"] .summary-band > div {
  padding: 14px 16px;
}

body[data-density="compact"] .metric-value {
  font-size: 24px;
}

body[data-density="compact"] .toolbar {
  gap: 10px;
  padding: 14px;
}

body[data-density="compact"] th,
body[data-density="compact"] td {
  padding: 9px 12px;
}

body[data-density="compact"] table {
  font-size: 13px;
}

body[data-density="compact"] .related-period-cell,
body[data-density="compact"] .event-summary,
body[data-density="compact"] .excluded-helper-text {
  font-size: 11px;
  line-height: 1.45;
}

body[data-density="compact"] .kind-pill {
  min-width: 104px;
  padding: 2px 7px;
}

body[data-density="compact"] .mobile-event-card {
  gap: 8px;
  padding: 13px 14px;
}

body[data-density="compact"] .search-card {
  padding: 14px 14px 15px;
}

body[data-density="compact"] .search-card-meta {
  font-size: 11px;
  line-height: 1.55;
}

body[data-density="compact"] .search-card-title {
  margin-top: 3px;
  font-size: 16px;
  line-height: 1.45;
}

body[data-density="compact"] .search-card-summary {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.6;
}

body[data-density="compact"] .search-card-period,
body[data-density="compact"] .search-card-reward,
body[data-density="compact"] .search-card-links a {
  font-size: 12px;
  line-height: 1.55;
}

.auth-form {
  display: grid;
  gap: 12px;
  max-width: 420px;
}

.primary-button {
  min-height: 42px;
  border: 1px solid rgba(47, 111, 103, 0.45);
  background: var(--accent-2);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.auth-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0 34px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 980px) {
  .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shortcut-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .toolbar {
    grid-template-columns: 1fr;
  }

  .toolbar-actions {
    align-items: stretch;
  }

  .secondary-button {
    width: 100%;
  }

  .summary-band {
    grid-template-columns: 1fr;
  }

  .search-hero {
    padding: 16px;
  }

  .search-results {
    gap: 10px;
  }

  .search-card {
    padding: 14px 14px 15px;
  }

  .search-card-meta {
    font-size: 11px;
    line-height: 1.6;
  }

  .search-card-title {
    margin-top: 2px;
    font-size: 16px;
    line-height: 1.55;
  }

  .search-card-summary {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    margin-top: 7px;
    font-size: 13px;
    line-height: 1.7;
  }

  .search-card-period {
    margin-top: 7px;
    font-size: 11px;
    line-height: 1.6;
  }

  .search-card-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-top: 12px;
  }

  .search-card-links a {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
  }

  .empty-guidance-links {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  .detail-meta-grid,
  .detail-focus-links,
  .detail-callouts,
  .detail-neighbors {
    grid-template-columns: 1fr;
  }

  footer {
    flex-direction: column;
  }

  .table-wrap {
    display: none;
  }

  .mobile-results {
    display: grid;
  }
}

code {
  font-family: "SFMono-Regular", Consolas, monospace;
}

@media (max-width: 840px) {
  .site-header {
    align-items: flex-start;
  }

  .site-header-main {
    display: grid;
  }

  .summary-band,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .detail-meta-grid {
    grid-template-columns: 1fr;
  }

  .detail-callouts {
    grid-template-columns: 1fr;
  }

  .search-hero {
    display: grid;
  }

  footer {
    display: grid;
  }
}
