:root {
  --bg: #0a0a0b;
  --panel: #121316;
  --card: #1a1b1f;
  --card-hover: #212228;
  --line: #2b2d33;
  --line-strong: #3a3d45;
  --text: #d9dfde;
  --muted: #919896;
  --gold: #f7c880;
  --gold-bright: #ffdca6;
  --gold-dim: #8a6f45;
  --clash: #e0574a;
  --clip-clash: #ffb3aa;
  --font-body: "Sofia Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Cinzel", "Sofia Sans", serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 15% -10%, rgba(247, 200, 128, 0.12), transparent 45%),
    radial-gradient(circle at 90% 110%, rgba(127, 209, 196, 0.08), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

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

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* game icons */
.game-icon {
  display: inline-block;
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  color: #d8dfdd;
  background-color: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

/* top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 10, 11, 0.86);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--gold-dim);
  border-radius: 10px;
  background: linear-gradient(160deg, #241d10, #12100b);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.08em;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  color: var(--gold);
}

.brand-flag {
  padding: 2px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-sub {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--gold-bright);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: none;
  white-space: nowrap;
}

.site-link::after {
  content: "\2197";
  font-size: 0.9em;
  line-height: 1;
}

.site-link:hover {
  border-color: var(--gold-dim);
  color: var(--gold);
}

.back-link {
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.back-link:hover {
  color: var(--gold-bright);
}

/* layout */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
  max-width: 1500px;
  margin: 0 auto;
  padding: 28px 24px 40px;
}

.layout-full {
  grid-template-columns: minmax(0, 1fr);
}

.schedule-head h1 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.5vw, 2.5rem);
  letter-spacing: 0.04em;
  color: var(--gold);
}

.lede {
  margin: 0 0 14px;
  color: var(--muted);
  max-width: 68ch;
}

.lede strong {
  color: var(--text);
}

/* legend */
.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
  color: var(--muted);
}

.legend-title {
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

.legend-item {
  display: inline-flex;
  align-items: center;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.legend-chip:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.legend-chip[aria-pressed="true"] {
  border-color: var(--gold-dim);
  background: linear-gradient(160deg, rgba(247, 200, 128, 0.16), rgba(247, 200, 128, 0.04));
  color: var(--gold-bright);
}

.legend-item .game-icon {
  color: var(--gold-bright);
}

.legend-chip[aria-pressed="true"] .game-icon {
  color: var(--gold);
}

/* day tabs */
.day-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.day-tab {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 150px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--muted);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.day-tab:hover {
  border-color: var(--line-strong);
  background: var(--card);
}

.day-tab-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
}

.day-tab-date {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.day-tab[aria-selected="true"] {
  border-color: var(--gold-dim);
  background: linear-gradient(160deg, rgba(247, 200, 128, 0.14), rgba(247, 200, 128, 0.02));
  color: var(--gold-bright);
}

/* timeline */
.timeline-scroll {
  overflow-x: auto;
}

.timeline {
  --axis-w: 56px;
  --lane-gap: 12px;
  --track-height: 2400px;
  position: relative;
}

.timeline-heads {
  display: grid;
  grid-template-columns: var(--axis-w) minmax(0, 1fr) minmax(0, 1fr);
  column-gap: var(--lane-gap);
  padding-bottom: 10px;
}

.lane-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0e0f11;
}

.lane-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.08em;
  color: var(--text);
}

.stage-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--stage-accent, var(--gold));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--stage-accent, var(--gold)) 20%, transparent);
}

.timeline-body {
  position: relative;
  display: grid;
  grid-template-columns: var(--axis-w) minmax(0, 1fr) minmax(0, 1fr);
  column-gap: var(--lane-gap);
}

.timeline-axis {
  position: relative;
}

.axis-hour {
  position: absolute;
  right: 8px;
  transform: translateY(-50%);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted);
  white-space: nowrap;
}

.lane-track {
  position: relative;
  height: var(--track-height);
  border: 1px solid var(--line);
  border-radius: 12px;
  background-color: rgba(18, 19, 22, 0.55);
}

.hour-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(43, 45, 51, 0.85);
  pointer-events: none;
}

/* event blocks */
.event-block {
  position: absolute;
  left: 4px;
  right: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--stage-accent, var(--gold));
  border-radius: 9px;
  background: linear-gradient(180deg, #1b1c20, #16171b);
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease,
    opacity 0.18s ease;
}

.event-block.is-match {
  box-shadow: inset 0 0 0 1px rgba(247, 200, 128, 0.3);
}

.event-block:hover {
  border-color: var(--line-strong);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}

.event-block.is-dim,
.plan-item.is-dim {
  opacity: 0.3;
}

.event-block.is-selected {
  border-color: var(--gold-dim);
  border-left-color: var(--gold);
  background: linear-gradient(160deg, rgba(247, 200, 128, 0.16), rgba(247, 200, 128, 0.04));
}

.event-block.is-selected .game-icon {
  color: var(--gold-bright);
}

.event-block.has-conflict {
  outline: 1px solid rgba(224, 87, 74, 0.6);
  outline-offset: -1px;
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.event-block > * {
  flex: 0 0 auto;
}

.block-time {
  font-size: 0.94rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.3;
  color: var(--stage-accent, var(--gold));
  white-space: nowrap;
}

.block-games {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.block-title {
  display: block;
  margin: 0;
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.18;
  color: var(--text);
}

.block-desc {
  display: block;
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.32;
  color: var(--muted);
}

.event-block.is-tiny {
  padding: 6px 9px;
  gap: 2px;
}

.event-block.is-micro {
  padding: 3px 7px;
  gap: 1px;
}

/* overlap bands */
.overlap-band {
  position: absolute;
  left: calc(var(--axis-w) + var(--lane-gap));
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  border-top: 1px dashed rgba(224, 87, 74, 0.38);
  border-bottom: 1px dashed rgba(224, 87, 74, 0.38);
  background: repeating-linear-gradient(
    45deg,
    rgba(224, 87, 74, 0.07) 0 9px,
    rgba(224, 87, 74, 0.02) 9px 18px
  );
}

.overlap-label {
  padding: 1px 7px;
  border: 1px solid rgba(224, 87, 74, 0.38);
  border-radius: 999px;
  background: rgba(22, 10, 10, 0.72);
  color: rgba(255, 179, 170, 0.92);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* plan panel */
.plan-col {
  position: sticky;
  top: 84px;
  align-self: start;
  min-width: 0;
}

.plan-card {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 148px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 16px;
}

.plan-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.plan-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.05em;
  color: var(--gold);
}

.plan-count {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.plan-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 2px 4px;
}

.plan-empty {
  margin: 8px 0;
  color: var(--muted);
  font-size: 0.93rem;
}

/* two-column day overview */
.plan-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.day-column {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 16px;
}

.day-column-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.day-column-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.05em;
  color: var(--gold);
}

.day-count {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.day-column .plan-list {
  margin: 12px 0 0;
}

.day-column .plan-item {
  padding-right: 11px;
}

.plan-empty-day {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.93rem;
}

/* controls relocated above the overview on the My schedule tab */
.plan-overview-actions {
  margin-bottom: 18px;
}

.plan-overview-actions > .plan-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.plan-overview-actions .plan-calendar,
.plan-overview-actions .plan-actions,
.plan-overview-actions .plan-confirm {
  margin-top: 0;
}

.plan-overview-actions .plan-calendar {
  width: auto;
}

.plan-overview-actions .plan-share {
  flex: 0 0 auto;
}

.plan-overview-actions .plan-confirm {
  flex: 1 0 100%;
}

.plan-overview-actions .plan-share-box {
  flex: 1 0 100%;
  margin-top: 0;
}

.plan-day {
  margin: 0 0 10px;
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-size: 0.96rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.plan-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plan-item {
  position: relative;
  padding: 9px 34px 9px 11px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--stage-accent, var(--gold));
  border-radius: 8px;
  background: var(--card);
  transition: opacity 0.18s ease;
}

.plan-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.plan-time {
  color: var(--stage-accent, var(--gold));
}

.plan-stage {
  margin-left: auto;
  color: var(--muted);
  font-weight: 600;
  text-align: right;
}

.plan-title {
  margin: 3px 0 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.plan-free {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: repeating-linear-gradient(
    45deg,
    rgba(145, 152, 150, 0.11) 0 8px,
    rgba(145, 152, 150, 0.035) 8px 16px
  );
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.plan-free-time {
  color: var(--text);
}

.plan-free-dur {
  margin-left: auto;
  color: var(--muted);
  text-transform: none;
}

.plan-conflict {
  margin: 6px 0 0;
  padding-left: 9px;
  border-left: 2px solid rgba(224, 87, 74, 0.6);
  font-size: 0.79rem;
  line-height: 1.35;
  color: var(--clip-clash);
}

.plan-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.plan-remove:hover {
  border-color: #8a4a44;
  background: rgba(224, 87, 74, 0.12);
  color: #ff9c92;
}

.plan-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.plan-actions .plan-clear {
  width: auto;
  margin: 0;
}

.plan-share-box {
  margin-top: 10px;
}

.plan-share-link {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #0e0f11;
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
}

.plan-share-box-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.plan-share-copy {
  padding: 8px 12px;
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  background: linear-gradient(160deg, rgba(247, 200, 128, 0.2), rgba(247, 200, 128, 0.05));
  color: var(--gold-bright);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.plan-share-copy:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.plan-share-status {
  color: var(--gold-bright);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.plan-share-status:empty {
  display: none;
}

.plan-calendar {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 9px 12px;
  border: 1px solid var(--gold-dim);
  border-radius: 9px;
  background: linear-gradient(160deg, rgba(247, 200, 128, 0.22), rgba(247, 200, 128, 0.06));
  color: var(--gold-bright);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.plan-calendar:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold);
}

.plan-calendar:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.plan-share {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--gold-dim);
  border-radius: 9px;
  background: linear-gradient(160deg, rgba(247, 200, 128, 0.16), rgba(247, 200, 128, 0.03));
  color: var(--gold-bright);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.plan-share:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold);
}

.plan-share:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.plan-clear {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.plan-clear:hover:not(:disabled) {
  border-color: #8a4a44;
  color: #ff9c92;
}

.plan-clear:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.plan-confirm {
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid #8a4a44;
  border-radius: 9px;
  background: rgba(224, 87, 74, 0.1);
}

.plan-confirm-text {
  display: block;
  margin-bottom: 9px;
  font-size: 0.9rem;
  color: var(--text);
}

.plan-confirm-actions {
  display: flex;
  gap: 8px;
}

.plan-confirm-actions button {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.plan-confirm-yes {
  border: 1px solid #8a4a44;
  background: #3a1b18;
  color: #ffb3aa;
}

.plan-confirm-yes:hover {
  background: #4a221e;
  color: #ffd0cb;
}

.plan-confirm-cancel {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
}

.plan-confirm-cancel:hover {
  color: var(--text);
}

.footer {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 24px 40px;
  color: var(--muted);
  font-size: 0.78rem;
}

.footer a {
  color: var(--muted);
  text-decoration: underline;
}

/* responsive */
@media (max-width: 860px) {
  .plan-columns {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1040px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .plan-col {
    position: static;
  }

  .plan-card {
    height: auto;
  }

  .plan-body {
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 10px 16px;
  }

  .site-link {
    display: none;
  }

  .layout {
    padding: 20px 16px 32px;
  }

  .timeline {
    min-width: 600px;
  }
}
