:root {
  color-scheme: light;
  --ink: #333333;
  --muted: #666666;
  --brand: #0073aa;
  --brand-dark: #005a8c;
  --accent: #00a98f;
  --surface: #ffffff;
  --background: #ffffff;
  --line: #e5e5e5;
  --danger: #a43131;
  font-family: "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--background); line-height: 1.65; }
a { color: var(--brand); }
a:hover { text-decoration-thickness: 2px; }
.container { width: min(1000px, calc(100% - 32px)); margin: 0 auto; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner, .site-header nav, .section-heading, .actions, .pagination, .admin-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.header-inner { min-height: 76px; }
.brand {
  display: inline-block;
  padding: 5px 16px;
  border-radius: 6px;
  background: linear-gradient(45deg, var(--brand), var(--accent));
  color: #fff;
  font-size: 1.45rem;
  font-weight: 900;
  text-decoration: none;
}
.site-header nav a { text-decoration: none; font-weight: 700; }
.site-header nav { gap: 22px; }
main.container { min-height: calc(100vh - 150px); padding-top: 28px; padding-bottom: 64px; }
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(30px, 5vw, 52px) 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f9fa;
  text-align: center;
}
.hero::before { position: absolute; top: 0; right: 0; left: 0; height: 4px; background: linear-gradient(90deg, var(--brand), var(--accent)); content: ""; }
.hero h1 { margin: 4px 0 12px; font-size: clamp(1.55rem, 4vw, 2.4rem); line-height: 1.4; }
.hero p { color: #555; }
.eyebrow { color: var(--brand); font-size: .75rem; font-weight: 800; letter-spacing: .12em; }
.actions { justify-content: flex-start; flex-wrap: wrap; margin-top: 22px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 18px; border: 1px solid var(--brand); border-radius: 8px; background: var(--brand); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.button:hover { background: var(--brand-dark); color: #fff; }
.button-outline { color: var(--brand-dark); background: transparent; }
.button-outline:hover { color: #fff; }
.button-small { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.button-danger { border-color: var(--danger); background: var(--danger); }
.hero .actions { justify-content: center; }
.section-heading { margin: 38px 0 18px; }
.section-heading h1, .section-heading h2, .page-heading h1 { margin: 0; }
.section-heading h2 { padding-left: 12px; border-left: 4px solid var(--brand); }
.page-heading { margin: 4px 0 24px; }
.page-heading p:last-child { color: var(--muted); }
.event-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.event-card, .event-row, .filter-panel, .form-panel, .detail, .admin-row {
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.event-card {
  overflow: hidden;
  box-shadow: 0 2px 8px rgb(0 0 0 / 5%);
  transition: transform .2s ease, box-shadow .2s ease;
}
.event-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgb(0 0 0 / 10%); }
.event-card-body { padding: 16px; }
.event-card h3 { margin: 8px 0; }
.event-card h3 a, .event-row h2 a, .admin-row h2 a { color: var(--ink); text-decoration: none; }
.event-date { color: var(--brand-dark); font-weight: 700; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 4px; background: var(--brand); color: #fff; font-size: .78rem; font-weight: 700; }
.tag-practice { background: #28a745; }
.event-image {
  display: block;
  width: 100%;
  height: 220px;
  padding: 8px;
  background: #f8f9fa;
  object-fit: contain;
}
.filter-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); align-items: end; gap: 14px; padding: 18px; background: #f8f9fa; }
label { display: grid; gap: 6px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #cccccc; border-radius: 6px; background: #fff; color: var(--ink); font: inherit; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgb(0 115 170 / 18%); border-color: var(--brand); }
.result-count { color: var(--muted); }
.event-list, .admin-list { display: grid; gap: 12px; }
.event-row { display: flex; align-items: center; gap: 18px; padding: 16px; box-shadow: 0 2px 8px rgb(0 0 0 / 4%); }
.event-row h2, .admin-row h2 { margin: 6px 0; font-size: 1.15rem; }
.event-row p, .admin-row p { margin: 3px 0; color: var(--muted); }
.event-thumb {
  flex: 0 0 160px;
  width: 160px;
  height: 120px;
  border-radius: 8px;
  background: #f8f9fa;
  object-fit: contain;
}
.pagination { justify-content: center; margin-top: 28px; }
.empty-state { padding: 36px 20px; border: 1px solid var(--line); border-radius: 8px; background: #f8f9fa; color: var(--muted); text-align: center; }
.detail { padding: clamp(18px, 4vw, 36px); }
.back-link { display: inline-block; margin-bottom: 20px; }
.detail-heading { margin-bottom: 22px; }
.detail-heading h1 { margin: 8px 0; font-size: clamp(1.8rem, 4vw, 2.5rem); }
.detail-heading p { color: var(--muted); }
.detail-image { display: block; max-width: 100%; max-height: 520px; margin: 18px auto; border-radius: 10px; object-fit: contain; }
.detail-list { display: grid; grid-template-columns: minmax(140px, 1fr) 3fr; margin: 24px 0; }
.detail-list { padding: 12px 16px; border: 1px solid #dddddd; border-radius: 8px; background: #f9f9f9; }
.detail-list dt, .detail-list dd { margin: 0; padding: 12px 8px; border-bottom: 1px dashed #cccccc; }
.detail-list dt { color: var(--brand); font-weight: 700; }
.detail-list dt:last-of-type, .detail-list dd:last-of-type { border-bottom: 0; }
.pre-line { white-space: pre-line; overflow-wrap: anywhere; }
.form-panel { display: grid; gap: 16px; padding: clamp(18px, 4vw, 30px); }
.form-panel fieldset { display: grid; gap: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fcfcfc; }
.form-panel fieldset[hidden] { display: none; }
.form-panel legend { padding: 0 8px; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-panel.narrow { max-width: 520px; }
.delete-form { margin-top: 18px; }
.current-image { color: var(--muted); }
.flash-list { display: grid; gap: 8px; margin-bottom: 16px; }
.flash { margin: 0; padding: 12px 14px; border-radius: 8px; background: #e8f5ef; }
.flash-error { color: #7b2222; background: #fbe8e8; }
.flash-warning { color: #705317; background: #fff4d6; }
.flash-success { color: #145a40; }
.admin-row { padding: 16px; }
.admin-section { margin: 30px 0; }
.admin-section-summary { display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
.admin-section-summary::-webkit-details-marker { display: none; }
.admin-section-summary::after { margin-left: auto; color: var(--brand-dark); font-size: 1.2rem; font-weight: 700; content: "+"; }
.admin-collapsible[open] > .admin-section-summary::after { content: "-"; }
.admin-section-summary h2 { margin: 0; font-size: 1.25rem; }
.admin-section-summary .result-count { margin-left: auto; }
.admin-summary { display: flex; align-items: baseline; gap: 8px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.admin-summary p { margin: 0; font-weight: 700; }
.admin-summary strong { color: var(--brand-dark); font-size: 1.8rem; }
.admin-history-row { align-items: flex-start; }
.admin-history-row h3, .admin-row h3 { margin: 8px 0 4px; }
.admin-import-error { overflow-wrap: anywhere; color: var(--danger) !important; }
.tag-warning { background: #9a6b00; }
.site-footer { padding: 24px 0; border-top: 1px solid var(--line); color: var(--muted); }

@media (max-width: 620px) {
  .header-inner { align-items: flex-start; flex-direction: column; padding: 12px 0; }
  .site-header nav { width: 100%; justify-content: space-between; }
  .event-row, .admin-row { align-items: flex-start; flex-direction: column; }
  .event-thumb { flex-basis: auto; width: 100%; height: 200px; }
  .detail-list { grid-template-columns: 1fr; }
  .detail-list dt { padding-bottom: 2px; border-bottom: 0; }
  .detail-list dd { padding-top: 2px; }
  .form-grid { grid-template-columns: 1fr; }
}
