:root {
  --bg: #f2f5fa;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --ink: #16203a;
  --ink-2: #4a5878;
  --muted: #78849f;
  --line: #dfe6f1;
  --line-strong: #c6d1e4;
  --accent: #2f61d5;
  --accent-soft: #e4ecff;
  --accent-ink: #1c47a8;
  --star: #e0a416;
  --danger: #c23a4b;
  --shadow: 0 1px 2px rgba(22, 32, 58, .06), 0 8px 24px rgba(22, 32, 58, .06);
  --radius: 12px;
  --header-h: 116px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1220;
    --surface: #151c2e;
    --surface-2: #1b2439;
    --ink: #e8edf7;
    --ink-2: #b3bfd6;
    --muted: #8592ad;
    --line: #26304a;
    --line-strong: #36425f;
    --accent: #7ba4ff;
    --accent-soft: #1e2b4d;
    --accent-ink: #a8c4ff;
    --star: #f0c14b;
    --danger: #ff8095;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.65 "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
        -apple-system, BlinkMacSystemFont, "Segoe UI", Meiryo, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }

/* ------------------------------------------------------------------ header */

.site {
  background: linear-gradient(115deg, #10182c 0%, #1c2c56 55%, #24418c 100%);
  color: #fff;
}

.site-inner,
.tabs-inner,
.toolbar-inner,
.content,
.site-footer {
  max-width: 1680px;
  margin: 0 auto;
  padding-inline: clamp(14px, 3vw, 40px);
}

.site-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 20px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #9fb6ee;
}

.brand h1 {
  margin: 2px 0 0;
  font-size: clamp(19px, 2.6vw, 27px);
  line-height: 1.25;
}

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

.sync-state {
  font-size: 12px;
  color: #b9cbf3;
  background: rgba(255, 255, 255, .1);
  border-radius: 99px;
  padding: 4px 11px;
  white-space: nowrap;
}

.site .btn-ghost {
  border-color: rgba(255, 255, 255, .35);
  color: #fff;
  background: rgba(255, 255, 255, .08);
}

.site .btn-ghost:hover { background: rgba(255, 255, 255, .18); }

/* -------------------------------------------------------------------- tabs */

.tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.tabs-inner {
  display: flex;
  gap: 4px;
}

.tab {
  appearance: none;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  padding: 13px 4px;
  margin-inline-end: 18px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.pill {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  min-width: 22px;
  padding: 1px 8px;
  text-align: center;
}

/* ----------------------------------------------------------------- toolbar */

.toolbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.toolbar-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  padding-block: 12px;
}

.days {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.day-chip {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 99px;
  padding: 6px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.day-chip:hover { border-color: var(--accent); }

.day-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .day-chip.is-active { color: #0d1220; }
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-inline-start: auto;
}

.field {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 7px 11px;
  min-width: 0;
}

.field:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

#search { min-width: min(260px, 60vw); }

/* ----------------------------------------------------------------- buttons */

.btn {
  appearance: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 9px;
  padding: 7px 14px;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.07); }

.btn-ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink-2);
}

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

.btn-danger-ghost {
  background: none;
  border-color: transparent;
  color: var(--danger);
}

.btn-danger-ghost:hover { border-color: var(--danger); }

@media (prefers-color-scheme: dark) {
  .btn-primary { color: #0d1220; }
}

/* ----------------------------------------------------------------- content */

.content { padding-block: 20px 56px; }

.day-section { margin-bottom: 34px; }

.day-heading {
  margin: 0 0 4px;
  font-size: 20px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.day-heading .muted { font-size: 13px; font-weight: 400; }

.slot {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  margin-block: 14px;
}

.slot-time {
  text-align: right;
  padding-top: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  white-space: nowrap;
}

.slot-time small {
  display: block;
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
}

.slot-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 12px;
  align-items: stretch;
}

.list-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* -------------------------------------------------------------------- card */

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card.is-service { border-left-color: var(--line-strong); background: var(--surface-2); }
.card.is-keynote { border-left-color: #b8863b; }
.card.is-lightning { border-left-color: #d08b1f; }
.card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }

.card-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
  margin: 0;
}

.card-title button {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: start;
  cursor: pointer;
}

.card-title button:hover { color: var(--accent); }

.card-title-en {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin: 2px 0 0;
  font-weight: 400;
}

.star {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 9px;
  width: 38px;
  height: 34px;
  flex: 0 0 auto;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
}

.star:hover { border-color: var(--star); color: var(--star); }

.star[aria-pressed="true"] {
  background: var(--star);
  border-color: var(--star);
  color: #3b2a00;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 8px;
  font-size: 12px;
  color: var(--muted);
  align-items: center;
}

.badge {
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  padding: 1px 9px;
  font-weight: 600;
  color: var(--ink-2);
}

.badge.type { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.badge.conflict { background: rgba(194, 58, 75, .12); border-color: transparent; color: var(--danger); }
.badge.parallel { background: var(--surface-2); }

.speakers { font-size: 13px; color: var(--ink-2); }

.summary {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-foot {
  margin-top: auto;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  padding-top: 2px;
}

.card-foot a { text-decoration: none; font-weight: 600; }
.card-foot a:hover { text-decoration: underline; }

/* --------------------------------------------------------------- lt block */

.lt-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px dashed var(--line-strong);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lt-list li {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.lt-list time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  padding-top: 1px;
}

.lt-list .lt-speaker { color: var(--muted); font-size: 12px; display: block; }

details.lt > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  list-style: none;
}

details.lt > summary::-webkit-details-marker { display: none; }
details.lt > summary::before { content: "▸ "; }
details.lt[open] > summary::before { content: "▾ "; }
details.lt > summary:focus-visible { outline: 2px solid var(--accent); }
details.lt > .lt-list { margin-top: 8px; }

/* ------------------------------------------------------------------ states */

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.empty strong { display: block; color: var(--ink); margin-bottom: 6px; font-size: 16px; }

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

.conflict-note {
  background: rgba(194, 58, 75, .1);
  border: 1px solid rgba(194, 58, 75, .3);
  color: var(--danger);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ----------------------------------------------------------------- dialogs */

.dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  max-width: min(680px, calc(100vw - 24px));
  width: 100%;
  box-shadow: 0 24px 70px rgba(10, 16, 32, .35);
}

.dialog::backdrop { background: rgba(10, 16, 32, .55); }

.dialog-body { padding: 22px clamp(18px, 4vw, 28px) 26px; }
.dialog-body h2 { margin: 0 0 8px; font-size: 20px; line-height: 1.4; }
.dialog-body h3 { margin: 22px 0 6px; font-size: 15px; }
.dialog-body h3:first-of-type { margin-top: 8px; }

.dialog-close-form { position: sticky; top: 0; height: 0; text-align: end; z-index: 1; }

.dialog-close {
  appearance: none;
  border: 0;
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  margin: 12px 12px 0 0;
  cursor: pointer;
  font-size: 14px;
}

.dialog-close:hover { color: var(--ink); }

.detail-en {
  white-space: pre-wrap;
  font-size: 13.5px;
  color: var(--ink-2);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0;
  max-height: 320px;
  overflow: auto;
}

.detail-summary { white-space: pre-wrap; }

.detail-meta {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 14px;
  font-size: 13.5px;
  margin: 12px 0 16px;
}

.detail-meta dt { color: var(--muted); }
.detail-meta dd { margin: 0; }

.dialog-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* -------------------------------------------------------------------- sync */

.sync-section + .sync-section { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 6px; }

.code-display {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.code-display code {
  font-size: clamp(20px, 5vw, 27px);
  font-weight: 700;
  letter-spacing: .1em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.sync-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.code-input { display: flex; gap: 8px; flex-wrap: wrap; }

#sync-code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 18px;
  letter-spacing: .12em;
  text-transform: uppercase;
  width: 190px;
}

.sync-message { font-size: 13px; margin: 16px 0 0; min-height: 1.4em; }
.sync-message.is-error { color: var(--danger); }
.sync-message.is-ok { color: var(--accent); }

/* ------------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  background: #16203a;
  color: #fff;
  padding: 10px 18px;
  border-radius: 99px;
  font-size: 13.5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 60;
  max-width: calc(100vw - 32px);
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------------ footer */

.site-footer {
  color: var(--muted);
  font-size: 12.5px;
  padding-block: 22px 40px;
  border-top: 1px solid var(--line);
}

.site-footer p { margin: 2px 0; }

/* ----------------------------------------------------------------- narrow */

@media (max-width: 720px) {
  .slot { grid-template-columns: 1fr; gap: 6px; }
  .slot-time { text-align: start; padding-top: 0; }
  .slot-time small { display: inline; margin-inline-start: 8px; }
  .slot-cards { grid-template-columns: 1fr; }
  .filters { margin-inline-start: 0; width: 100%; }
  #search { flex: 1 1 100%; }
  .toolbar-inner { padding-block: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; }
}
