:root {
  --bg: #fff8f1;
  --surface: #fffdf9;
  --card: #ffffff;
  --text: #171717;
  --muted: #6e655d;
  --orange: #ffc38f;
  --orange-strong: #f59a4c;
  --orange-soft: #fff0df;
  --line: #1d1d1d;
  --line-soft: #f0b477;
  --danger: #9d251d;
  --shadow: 0 8px 20px rgba(77, 42, 16, .08);
  --radius: 20px;
  --radius-small: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color: var(--text);
  background: #f2eee9;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }

.app-shell {
  width: min(100%, 540px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 34px rgba(0,0,0,.06);
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 10px 16px;
  background: rgba(255, 248, 241, .95);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--orange);
}
.brand { font-weight: 900; letter-spacing: .07em; font-size: 18px; }
.area-switch {
  display: block;
  margin-top: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}
.icon-button {
  border: 1.5px solid var(--line);
  background: var(--surface);
  padding: 7px 10px;
  font-size: 21px;
  border-radius: 14px;
}
.icon-button:active { transform: scale(.97); }

main { padding: 18px 14px 30px; }
.hero { padding: 12px 4px 8px; }
.hero h1 { margin: 0; font-size: clamp(28px, 8vw, 40px); line-height: 1.12; letter-spacing: -.02em; }
.hero p { color: var(--muted); margin: 9px 0 0; line-height: 1.75; }
.kicker { color: #8d4d18; font-weight: 900; font-size: 12px; letter-spacing: .06em; margin-bottom: 7px; }

.quick-filter {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0 6px;
  scrollbar-width: none;
}
.quick-filter::-webkit-scrollbar { display: none; }
.filter-chip {
  white-space: nowrap;
  border: 1.5px solid var(--line);
  background: var(--card);
  padding: 9px 13px;
  border-radius: 999px;
  color: var(--text);
  font-weight: 700;
}
.filter-chip.active { background: var(--orange); }

.section { margin-top: 24px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section h2 { font-size: 20px; margin: 0; }
.section-head button, .text-link { border: 0; background: transparent; color: #8c4b14; padding: 0; font-weight: 800; }

.view-toolbar { display: flex; gap: 7px; align-items: center; }
.view-toggle {
  min-width: 38px;
  height: 34px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  font-weight: 900;
}
.view-toggle.active { background: var(--orange); }

.event-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.event-grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.event-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: var(--radius);
  padding: 13px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  box-shadow: var(--shadow);
  transition: transform .14s ease, box-shadow .14s ease;
  overflow: hidden;
}
.event-card:active { transform: scale(.98); }
.event-card.official { border-color: var(--line-soft); }
.event-card.ended { opacity: .68; box-shadow: none; }
.event-card .icons { font-size: 32px; letter-spacing: 1px; line-height: 1; }
.event-card .place { font-size: 16px; font-weight: 900; line-height: 1.2; }
.event-card .date { margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.25; }
.event-card .badge {
  position: absolute;
  top: 9px;
  right: 9px;
  font-size: 10px;
  font-weight: 900;
  padding: 5px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--orange-soft);
}
.event-card .badge.dark { border-color: var(--line); background: #fff; }
.event-card.template { border-style: dashed; background: #fffaf5; box-shadow: none; }

.event-grid.cols-3 .event-card { border-radius: 16px; padding: 9px; }
.event-grid.cols-3 .event-card .icons { font-size: 23px; }
.event-grid.cols-3 .event-card .place { font-size: 13px; }
.event-grid.cols-3 .event-card .date { font-size: 10px; }
.event-grid.cols-3 .event-card .badge { top: 6px; right: 6px; padding: 3px 5px; font-size: 8px; }

.empty {
  grid-column: 1 / -1;
  background: var(--card);
  border: 1.5px dashed var(--line-soft);
  border-radius: var(--radius);
  padding: 26px 18px;
  text-align: center;
  color: var(--muted);
}

.link-card, .bbs-card, .source-card {
  display: block;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
  box-shadow: var(--shadow);
}
.link-card + .link-card, .bbs-card + .bbs-card { margin-top: 9px; }
.link-card strong, .bbs-card strong { display: block; }
.link-card small, .bbs-card small { display: block; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.bbs-category-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.bbs-category { border: 1.5px solid var(--line); background: var(--card); border-radius: 18px; padding: 16px 12px; text-align: center; font-weight: 900; }

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  z-index: 30;
  width: min(100%, 540px);
  height: calc(69px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 248, 241, .97);
  backdrop-filter: blur(12px);
  border-top: 2px solid var(--orange);
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); }
.bottom-nav a.active { color: var(--text); font-weight: 900; }
.bottom-nav span { font-size: 22px; line-height: 1; }
.bottom-nav small { font-size: 11px; }
.create-nav span {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  margin-top: -18px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  background: var(--orange);
  box-shadow: var(--shadow);
  font-size: 27px;
}

.detail-top { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.back-button { border: 1.5px solid var(--line); background: var(--card); border-radius: 13px; padding: 9px 12px; font-weight: 800; }
.detail-card, .panel {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.detail-card h1 { font-size: 25px; margin: 9px 0 10px; }
.detail-card p, .panel p { line-height: 1.75; }
.detail-icon { font-size: 42px; }
.official-strip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-soft);
  background: var(--orange-soft);
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  margin: 7px 0;
}
.meta-list { display: grid; gap: 10px; margin: 18px 0; }
.meta-row { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--orange); }
.meta-row span:first-child { color: var(--muted); }
.meta-row strong { text-align: right; }

.primary-button, .secondary-button {
  width: 100%;
  border-radius: 15px;
  padding: 13px 16px;
  font-weight: 900;
}
.primary-button { border: 1.5px solid var(--line); background: var(--orange); color: var(--text); }
.secondary-button { border: 1.5px solid var(--line); background: white; color: var(--text); }
.primary-button:disabled { opacity: .45; cursor: not-allowed; }
.button-row { display: grid; gap: 9px; }

.source-link { display: block; margin-top: 12px; border: 1.5px solid var(--line-soft); background: var(--orange-soft); border-radius: 15px; padding: 12px; font-weight: 900; }
.source-link small { display: block; margin-top: 3px; color: var(--muted); font-weight: 500; }

.comments { margin-top: 18px; }
.comment { padding: 13px 0; border-bottom: 1px solid var(--orange); }
.comment:last-child { border-bottom: 0; }
.comment strong { display: block; margin-bottom: 4px; font-size: 14px; }
.comment p { margin: 0; line-height: 1.65; }
.comment-form { display: grid; gap: 8px; margin-top: 12px; }
.comment-form textarea { width: 100%; min-height: 92px; border: 1.5px solid var(--line); border-radius: 14px; padding: 11px; resize: vertical; background: #fff; }

.form-grid { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; }
.field label { font-weight: 900; font-size: 14px; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 12px;
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--orange-strong); box-shadow: 0 0 0 3px var(--orange-soft); }
.field textarea { min-height: 120px; resize: vertical; }
.helper { color: var(--muted); font-size: 12px; line-height: 1.6; }
.warning { color: var(--danger); font-size: 12px; }
.notice {
  background: var(--orange-soft);
  border: 1.5px solid var(--line-soft);
  border-radius: 15px;
  padding: 13px;
  line-height: 1.65;
  font-size: 13px;
}
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; border: 1px solid var(--line-soft); border-radius: 999px; background: var(--orange-soft); font-size: 12px; font-weight: 900; }
.status-pill.ended { background: #efefef; border-color: #bdbdbd; }
.login-box { text-align: center; padding: 34px 18px; }
.login-box h2 { margin-top: 0; }
.login-box p { color: var(--muted); line-height: 1.7; }

.drawer, .modal { position: fixed; inset: 0; z-index: 60; pointer-events: none; opacity: 0; transition: opacity .18s ease; }
.drawer.open, .modal.open { opacity: 1; pointer-events: auto; }
.drawer-backdrop, .modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.34); }
.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(84%, 360px);
  background: var(--bg);
  padding: 16px;
  transform: translateX(100%);
  transition: transform .2s ease;
  display: grid;
  align-content: start;
  gap: 4px;
  border-left: 2px solid var(--orange);
}
.drawer.open .drawer-panel { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid var(--orange); padding-bottom: 8px; margin-bottom: 8px; }
.drawer-panel > a { padding: 14px 8px; border-bottom: 1px solid var(--orange); font-weight: 800; }
.modal-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%) scale(.96);
  width: min(calc(100% - 28px), 420px);
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
  transition: transform .18s ease;
}
.modal.open .modal-card { transform: translate(-50%,-50%) scale(1); }
.modal-card h2 { margin: 0 0 8px; }
.modal-card p { color: var(--muted); line-height: 1.7; }
.modal-close { position: absolute; right: 12px; top: 10px; border: 0; background: transparent; font-size: 24px; }
.auth-button { width: 100%; margin-top: 9px; padding: 12px; border-radius: 15px; border: 1.5px solid var(--line); font-weight: 900; background: #fff; }
.auth-button.line { background: #eaffea; }
.auth-button.google { background: #fff; }
.note { font-size: 11px; }

.footer-note { color: var(--muted); font-size: 12px; line-height: 1.7; text-align: center; margin: 28px 8px 4px; }

@media (min-width: 700px) {
  body { padding: 18px 0; }
  .app-shell { border-radius: 28px; overflow: hidden; min-height: calc(100vh - 36px); }
  .bottom-nav { bottom: 18px; border-radius: 0 0 28px 28px; }
}
