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

:root {
  --bg: #070b16;
  --panel: rgba(15, 22, 43, .82);
  --panel-2: rgba(21, 30, 56, .9);
  --line: #1f2b4d;
  --line-soft: rgba(120, 150, 210, .14);
  --text: #e9eefb;
  --muted: #8ea3c9;
  --accent: #ffcb05;
  /* ゲームごとの色は app.js の GAME を唯一の定義元にする */
  --radius: 16px;
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", "Meiryo", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  background:
    radial-gradient(1100px 560px at 10% -10%, rgba(59, 108, 240, .30), transparent 62%),
    radial-gradient(900px 520px at 92% 2%, rgba(255, 203, 5, .13), transparent 58%),
    radial-gradient(700px 700px at 50% 120%, rgba(255, 123, 169, .12), transparent 65%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.app {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 26px 20px 56px;
}

/* ── Hero ─────────────────────────────── */
.hero { margin-bottom: 20px; }

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 14px; }

.ball {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(#ee3b4b 0 48%, #0b1020 48% 52%, #f4f7ff 52% 100%);
  border: 2px solid #0b1020;
  box-shadow: 0 0 0 2px rgba(255, 203, 5, .9), 0 8px 24px rgba(238, 59, 75, .35);
  position: relative;
}
.ball::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #f4f7ff;
  border: 3px solid #0b1020;
}

.brand-text h1 {
  margin: 0;
  font-size: 25px;
  letter-spacing: .02em;
  font-weight: 800;
  background: linear-gradient(92deg, #ffffff 10%, #ffd86b 55%, #7fb4ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-text p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.today-badge {
  font-size: 12.5px;
  color: #cddcf6;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 15px;
  white-space: nowrap;
}
.today-badge strong { color: var(--accent); font-weight: 700; }

/* ── データ鮮度の警告 ─────────────────── */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 13px;
  font-size: 12px;
  line-height: 1.7;
  color: #ffe0a3;
  background: rgba(255, 176, 32, .12);
  border: 1px solid rgba(255, 176, 32, .35);
  border-radius: 12px;
}
.notice::before { content: "⚠"; flex: none; line-height: 1.6; }
.notice[hidden] { display: none; }

/* ── Stats ────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 12px 14px;
  backdrop-filter: blur(10px);
}
.stat-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .04em;
}
.stat-value {
  display: block;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.stat-value small { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.stat.live .stat-value,
.stat.goods .stat-value { color: var(--c, var(--muted)); }

/* ── Toolbar ──────────────────────────── */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin: 18px 0 20px;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(9, 14, 28, .92);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 30px rgba(3, 6, 16, .55);
}

.search-wrap { position: relative; }
.search-wrap input {
  width: 100%;
  padding: 11px 40px 11px 40px;
  color: var(--text);
  font: inherit;
  background: #0b1226;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-wrap input::placeholder { color: #61789f; }
.search-wrap input:focus {
  border-color: rgba(76, 194, 255, .6);
  box-shadow: 0 0 0 3px rgba(76, 194, 255, .15);
}
.search-wrap input::-webkit-search-cancel-button { display: none; }

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  fill: none;
  stroke: #61789f;
  stroke-width: 2;
  stroke-linecap: round;
}

.clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  width: 24px;
  height: 24px;
  padding: 0;
  color: #9db2d6;
  font-size: 16px;
  line-height: 1;
  background: rgba(255, 255, 255, .07);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.clear-btn.show { display: block; }

.filter-groups { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }

.filter-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  min-width: 0;
}

/* スマホ幅ではこの中だけ横スクロールにして、ツールバーの高さを一定に保つ */
.filter-scroll {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.filter-label {
  flex: none;
  width: 82px;
  font-size: 11px;
  color: #6f86ab;
  letter-spacing: .05em;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12.5px;
  color: #b9cbe8;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .1s;
}
.pill:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.pill:active { transform: scale(.97); }

.pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c, #8ea3c9);
}

.pill.is-active {
  color: #08101f;
  font-weight: 700;
  background: linear-gradient(180deg, #f5f9ff, #cfdcf5);
  border-color: #dbe6fb;
}
.pill.is-active .dot { background: var(--c, #08101f); }
.pill.reset {
  color: #ffb3c8;
  border-color: #6a2b4a;
  background: rgba(106, 43, 74, .25);
}
.pill[hidden] { display: none; }

.pill.cat.is-active {
  background: linear-gradient(180deg, #ffe9a6, #ffcb05);
  border-color: #ffdf6a;
  color: #1c1400;
}

/* ── Layout ───────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 316px;
  gap: 16px;
  align-items: start;
}

.panel,
.calendar-card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
}

.calendar-card { padding: 16px; }

.cal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.cal-head h2 {
  flex: 1;
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .02em;
}
.cal-nav { display: flex; gap: 6px; }

.nav-btn,
.ghost-btn {
  font: inherit;
  color: #c3d5f2;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-btn {
  width: 32px;
  height: 32px;
  font-size: 17px;
  line-height: 1;
  padding: 0;
}
.ghost-btn { padding: 7px 14px; font-size: 12.5px; }
.nav-btn:hover, .ghost-btn:hover { background: rgba(255, 255, 255, .13); color: #fff; }

.cal-weekdays,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.cal-weekdays { margin-bottom: 6px; }
.cal-weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #7d92b7;
  padding-bottom: 2px;
}
.cal-weekdays span:first-child { color: #ff8b9c; }
.cal-weekdays span:last-child { color: #7fb4ff; }

.day {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 104px;
  padding: 6px;
  overflow: hidden;
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.day:hover { background: rgba(35, 49, 88, .95); border-color: rgba(120, 160, 230, .4); }

.day.is-out { opacity: .38; }
.day.is-today {
  border-color: rgba(255, 203, 5, .75);
  box-shadow: 0 0 0 1px rgba(255, 203, 5, .35), 0 0 24px rgba(255, 203, 5, .12);
}
.day.is-today .day-num { color: var(--accent); font-weight: 800; }

.day-num {
  font-size: 12px;
  font-weight: 600;
  color: #a9bcdc;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.day.is-sun .day-num { color: #ff9bb0; }
.day.is-sat .day-num { color: #8fc0ff; }
.day.is-today.is-sun .day-num,
.day.is-today.is-sat .day-num { color: var(--accent); }

.day-month { font-size: 9.5px; color: #6f86ab; font-weight: 600; white-space: nowrap; }

.chips { display: flex; flex-direction: column; gap: 3px; }

.chip {
  --c: #8ea3c9;
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 2px 4px;
  font: inherit;
  font-size: 10px;
  line-height: 1.35;
  text-align: left;
  color: #dae6fb;
  background: color-mix(in srgb, var(--c) 20%, transparent);
  border: 0;
  border-left: 3px solid var(--c);
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  transition: background .12s;
}
.chip:hover { background: color-mix(in srgb, var(--c) 38%, transparent); }
.chip.is-span { background: color-mix(in srgb, var(--c) 12%, transparent); }
.chip.is-span .chip-dot { opacity: 1; }

.chip-dot {
  flex: none;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--c);
  opacity: .75;
}

.chip-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chip-more {
  width: 100%;
  padding: 1px 5px;
  font: inherit;
  font-size: 9.5px;
  font-weight: 700;
  text-align: left;
  color: #9db2d6;
  background: rgba(255, 255, 255, .05);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
.chip-more:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.cal-hint {
  margin: 12px 2px 0;
  font-size: 11px;
  color: #63799e;
}

.cal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.cal-actions .cal-hint { margin: 0; }
.cal-actions .export-btn { margin-left: auto; white-space: nowrap; }
.export-btn:disabled { opacity: .5; cursor: default; }

/* ── Sidebar ──────────────────────────── */
.sidebar { display: grid; gap: 16px; position: sticky; top: 148px; }

.panel { padding: 15px; }

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: #d8e5fa;
  letter-spacing: .02em;
}
.count {
  font-size: 11px;
  font-weight: 700;
  color: #08101f;
  background: var(--accent);
  border-radius: 999px;
  padding: 1px 7px;
}
.count:empty { display: none; }

.list { display: grid; gap: 7px; }

.empty {
  padding: 14px 12px;
  font-size: 12px;
  color: #63799e;
  text-align: center;
  background: rgba(255, 255, 255, .02);
  border: 1px dashed var(--line);
  border-radius: 10px;
}

/* ── Event rows ───────────────────────── */
.row {
  --c: #8ea3c9;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
  width: 100%;
  padding: 9px 10px;
  font: inherit;
  text-align: left;
  color: inherit;
  background: rgba(255, 255, 255, .03);
  border: 1px solid transparent;
  border-left: 3px solid var(--c);
  border-radius: 9px;
  cursor: pointer;
  transition: background .13s, border-color .13s, transform .1s;
}
.row:hover { background: rgba(255, 255, 255, .08); border-color: var(--line); border-left-color: var(--c); }
.row:active { transform: scale(.995); }

.row-time {
  font-size: 11px;
  font-weight: 700;
  color: #a9bcdc;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-top: 1px;
  min-width: 38px;
}

.row-main { display: block; min-width: 0; }

.row-title {
  display: -webkit-box;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
  color: #eef4ff;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 10.5px;
  color: #7f95ba;
}

.tag {
  --c: #8ea3c9;
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 16%, transparent);
  border-radius: 999px;
}

.row-place { color: #6f86ab; }
.row-place::before { content: "· "; }

.badge-live {
  align-self: center;
  padding: 2px 7px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #041018;
  background: linear-gradient(180deg, #8ef0c4, #35d39a);
  border-radius: 999px;
  white-space: nowrap;
}

/* ── Agenda ───────────────────────────── */
.agenda { margin-top: 16px; }

.agenda-list { display: grid; gap: 12px; max-height: 620px; overflow-y: auto; padding-right: 4px; }

.agenda-day { display: grid; gap: 6px; }

.agenda-date {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: #9db2d6;
  letter-spacing: .03em;
  position: sticky;
  top: 0;
  padding: 3px 0;
  background: linear-gradient(180deg, rgba(15, 22, 43, .98), rgba(15, 22, 43, .82));
  backdrop-filter: blur(4px);
}
.agenda-date .wd { color: #6f86ab; font-weight: 600; }
.agenda-date .wd.sun { color: #ff9bb0; }
.agenda-date .wd.sat { color: #8fc0ff; }
.agenda-date .line { flex: 1; height: 1px; background: var(--line-soft); }
.agenda-date .n { font-size: 10px; font-weight: 700; color: #63799e; }

.agenda-day .row { background: rgba(255, 255, 255, .025); }

/* ── Modal ────────────────────────────── */
.modal {
  width: min(520px, calc(100vw - 32px));
  max-height: min(82vh, 720px);
  padding: 0;
  color: var(--text);
  background: linear-gradient(180deg, #121a33, #0b1120);
  border: 1px solid rgba(120, 160, 230, .3);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .65);
  overflow: hidden;
}
.modal::backdrop { background: rgba(3, 6, 14, .72); backdrop-filter: blur(4px); }

.modal-inner { position: relative; padding: 22px; overflow-y: auto; max-height: inherit; }

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 30px;
  height: 30px;
  font-size: 17px;
  line-height: 1;
  color: #b9cbe8;
  background: rgba(255, 255, 255, .08);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.modal-close:hover { background: rgba(255, 255, 255, .18); color: #fff; }

.modal-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  padding-right: 30px;
}

.modal h3 {
  margin: 0 0 14px;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: .01em;
}

.meta-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  padding: 13px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line-soft);
  border-radius: 11px;
}
.meta-row { display: flex; gap: 10px; font-size: 12.5px; }
.meta-row dt {
  flex: none;
  width: 42px;
  color: #6f86ab;
  font-size: 11.5px;
}
.meta-row dd { margin: 0; color: #dbe7fa; }

.modal-desc {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.85;
  color: #c3d5f2;
}

.modal-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.modal-tags span {
  padding: 3px 9px;
  font-size: 10.5px;
  color: #9db2d6;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.btn-link {
  display: inline-block;
  padding: 10px 18px;
  font-size: 12.5px;
  font-weight: 700;
  color: #08101f;
  text-decoration: none;
  background: linear-gradient(180deg, #ffe08a, #ffcb05);
  border-radius: 10px;
}
.btn-link:hover { filter: brightness(1.06); }

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.btn-ics {
  padding: 10px 16px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: #dbe7fa;
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-ics:hover { background: rgba(255, 255, 255, .16); color: #fff; }

/* 書き出す日付の選択（複数日イベントのみ） */
.ics-date-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.ics-date-row label {
  font-size: 11.5px;
  color: #8ea3c9;
}
.ics-date-row select {
  flex: 1 1 220px;
  min-width: 0;
  max-width: 100%;
  padding: 8px 10px;
  font: inherit;
  font-size: 12.5px;
  color: #dbe7fa;
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.ics-date-row select:focus-visible { outline: 2px solid #4cc2ff; outline-offset: 2px; }
.ics-date-row option { color: #0b1526; background: #fff; }

.day-modal-list { display: grid; gap: 7px; margin-top: 4px; }

.modal-sub {
  margin: 0 0 12px;
  font-size: 12px;
  color: #8ea3c9;
}

/* ── Rating ───────────────────────────── */
.rating { margin-top: 22px; }
.rating .panel-title { margin-bottom: 8px; }
.rating-stars { display: flex; gap: 6px; }

.rating-star {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .03);
  color: #42557a;
  font-size: 22px;
  line-height: 1;
  padding: 7px 11px 9px;
  cursor: pointer;
  transition: color .12s, border-color .12s, background .12s, transform .12s;
}
.rating-star:hover,
.rating-star:focus-visible {
  color: var(--accent);
  border-color: rgba(255, 203, 5, .5);
  background: rgba(255, 203, 5, .1);
  outline: none;
  transform: translateY(-1px);
}
.rating-star.is-on { color: var(--accent); }
.rating-star:disabled { cursor: default; transform: none; }

.rating-summary { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.rating-note { margin: 6px 0 0; font-size: 12px; color: var(--accent); }
.rating-note[hidden] { display: none; }

/* ── Footer ───────────────────────────── */
.foot {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 11px;
  color: #5d7398;
  text-align: center;
}
.foot p { margin: 3px 0; }

/* ── Responsive ───────────────────────── */
@media (max-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

  /* タブレット幅でも絞り込みが縦に伸びないよう、1行の横スクロールにする */
  .filter-scroll {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 1px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .filter-scroll::-webkit-scrollbar { display: none; }
  .filter-scroll .pill { flex: none; }
  .filter-scroll .pill.reset { order: -1; }
}

@media (max-width: 720px) {
  .app { padding: 18px 12px 44px; }
  .brand-text h1 { font-size: 21px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-value { font-size: 19px; }
  .toolbar { padding: 11px; }
  .filter-label { width: 100%; margin-bottom: 1px; }
  .filter-groups { gap: 6px; }
  .pill { padding: 5px 10px; font-size: 11.5px; }
  .calendar-card { padding: 11px; }
  .cal-weekdays, .cal-grid { gap: 4px; }
  .day { min-height: 66px; padding: 4px; border-radius: 8px; }
  .day-num { font-size: 10.5px; }
  .chip { padding: 0; height: 6px; border-radius: 3px; border-left-width: 0; background: var(--c); }
  .chip.is-span { background: color-mix(in srgb, var(--c) 55%, transparent); }
  .chip-dot, .chip-text { display: none; }
  .chips { gap: 2px; }
  .chip-more { font-size: 8.5px; padding: 0 3px; white-space: nowrap; }
  .cal-hint { display: none; }
  .agenda-list { max-height: none; }
  .modal-inner { padding: 18px; }
  .modal h3 { font-size: 17px; }
}

/* 361px以上は月初ラベルも件数バッジ（8.5px）もセルに収まる。
   360px以下ではラベルを月見出しに任せ、バッジを一段小さくする。 */
@media (max-width: 360px) {
  .day-month { display: none; }
  .chip-more { font-size: 7.5px; padding: 0 1px; }
}
