:root {
  --bg: #0f172a;
  --panel: rgba(15, 23, 42, .82);
  --line: rgba(255, 255, 255, .16);
  --text: #f8fafc;
  --muted: #94a3b8;
  --orange: #f97316;
  --green: #22c55e;
  --yellow: #f59e0b;
  --pink: #ec4899;
  --blue: #60a5fa;
  --red: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 20%, rgba(56, 189, 248, .18), transparent 30%),
    radial-gradient(circle at 90% 0, rgba(236, 72, 153, .18), transparent 30%),
    var(--bg);
}

body.modal-open {
  overflow: hidden;
}

.app {
  width: min(1180px, calc(100% - 28px));
  margin: auto;
  padding: 26px 0 36px;
}

.header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.title h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 56px);
  letter-spacing: .04em;
}

.version {
  font-size: clamp(14px, 1.6vw, 22px);
  padding: 4px 10px;
  border-radius: 999px;
  color: #93c5fd;
  background: rgba(96, 165, 250, .13);
  border: 1px solid rgba(96, 165, 250, .28);
  vertical-align: middle;
}

.title p {
  margin: 8px 0 0;
  color: var(--muted);
}

.clock {
  min-width: 260px;
  text-align: right;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 18px 45px rgba(0, 0, 0, .28);
}

.date,
.tz {
  color: var(--muted);
  font-size: 13px;
}

.sound-toggle {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
}

.next-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  margin-left: auto;
  gap: 4px;
  padding: 3px 4px 3px 10px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  color: var(--muted);
  white-space: nowrap;
}

.next-tools span {
  font-size: 13px;
  font-weight: 800;
}

.sound-toggle .icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound-toggle .sound-on {
  display: none;
}

.sound-toggle.enabled {
  color: #111827;
  border-color: rgba(34, 197, 94, .78);
  background: #22c55e;
}

.sound-toggle.enabled .sound-off {
  display: none;
}

.sound-toggle.enabled .sound-on {
  display: block;
}

.time {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: .04em;
}

.hero,
.grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 14px;
}

.grid {
  grid-template-columns: 1fr 1fr;
  margin-top: 14px;
}

.card,
.panel {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--panel);
  overflow: hidden;
  box-shadow: 0 18px 45px rgba(0, 0, 0, .25);
}

.card.now {
  border-color: rgba(249, 115, 22, .42);
}

.card.next {
  border-color: rgba(34, 197, 94, .42);
}

.card.next.shake {
  border-color: rgba(239, 68, 68, .8);
  animation: shake .55s ease-in-out infinite;
}

.card.next.shake .head {
  background: rgba(239, 68, 68, .18);
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  15% {
    transform: translateX(-5px);
  }

  30% {
    transform: translateX(5px);
  }

  45% {
    transform: translateX(-4px);
  }

  60% {
    transform: translateX(4px);
  }

  75% {
    transform: translateX(-2px);
  }
}

.head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .06);
}

.label {
  font-weight: 900;
  letter-spacing: .08em;
}

.now .label {
  color: var(--orange);
}

.next .label {
  color: var(--green);
}

.body {
  padding: 22px;
}

.boss {
  font-size: clamp(34px, 5vw, 60px);
  font-weight: 950;
  margin: 0 0 12px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.pill {
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .13);
  font-weight: 800;
}

.pill.local {
  color: #fbbf24;
}

.pill.world {
  color: #f472b6;
}

.pill.arena {
  color: #93c5fd;
}

.pill.alert {
  color: #fca5a5;
}

.countdown-block {
  display: inline-grid;
  gap: 4px;
  margin-top: 4px;
}

.count {
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 950;
  letter-spacing: .05em;
  line-height: 1;
}

.hint {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.next-group {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
}

.next-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
  background: rgba(255, 255, 255, .06);
}

.next-item strong {
  min-width: min(180px, 100%);
  font-size: 18px;
  font-weight: 950;
}

.next-item span {
  font-size: 13px;
  font-weight: 900;
}

.week-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 16px 0;
  padding: 16px 18px;
  border: 1px solid rgba(245, 158, 11, .36);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(245, 158, 11, .18), rgba(34, 197, 94, .12));
  box-shadow: 0 18px 45px rgba(0, 0, 0, .2);
}

.week-action strong,
.week-action span {
  display: block;
}

.week-action strong {
  font-size: 22px;
  font-weight: 950;
}

.week-action span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.week-button {
  flex: 0 0 auto;
  padding: 13px 18px;
  border-color: rgba(245, 158, 11, .62);
  background: #f59e0b;
  color: #111827;
  box-shadow: 0 12px 28px rgba(245, 158, 11, .25);
}

.week-button:hover {
  border-color: rgba(251, 191, 36, .9);
  background: #fbbf24;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(15, 23, 42, .58);
}

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

button,
select,
input {
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  border-radius: 13px;
  padding: 9px 11px;
  font: inherit;
}

select option {
  color: #0f172a;
}

button {
  cursor: pointer;
  font-weight: 900;
}

button.active,
button:hover {
  border-color: rgba(56, 189, 248, .65);
  background: rgba(56, 189, 248, .18);
}

.panel h2 {
  margin: 0;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 20px;
}

.list {
  padding: 10px;
}

.event {
  display: grid;
  grid-template-columns: 86px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 15px;
}

.event + .event {
  margin-top: 5px;
}

.event:hover {
  background: rgba(255, 255, 255, .06);
}

.event.now {
  border: 1px solid rgba(249, 115, 22, .55);
  background: rgba(249, 115, 22, .14);
}

.event.next {
  border: 1px solid rgba(34, 197, 94, .5);
  background: rgba(34, 197, 94, .12);
}

.etime {
  font-size: 21px;
  font-weight: 950;
}

.ename {
  font-size: 17px;
  font-weight: 900;
}

.esub,
.ebadge,
.empty {
  color: var(--muted);
  font-size: 13px;
}

.empty {
  padding: 24px;
  text-align: center;
}

.weekly {
  overflow-x: auto;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  padding: 22px;
}

.modal.open {
  display: grid;
  place-items: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, .72);
  backdrop-filter: blur(8px);
}

.modal-panel {
  position: relative;
  width: min(1180px, 100%);
  max-height: min(820px, calc(100vh - 44px));
  display: flex;
  flex-direction: column;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .06);
}

.modal-head h2 {
  border-bottom: 0;
}

.modal-close {
  width: 42px;
  height: 42px;
  margin-right: 12px;
  padding: 0;
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
}

.modal-body {
  overflow: auto;
}

.wrap {
  min-width: 1050px;
}

.weekly table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.weekly th,
.weekly td {
  border: 1px solid var(--line);
  vertical-align: top;
  padding: 10px;
}

.weekly th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(255, 255, 255, .09);
  font-size: 16px;
}

.weekly thead th:first-child {
  left: 0;
  z-index: 4;
}

.time-cell {
  position: sticky;
  left: 0;
  z-index: 3;
  background: rgba(255, 255, 255, .05);
  color: #fbbf24;
  text-align: center;
  vertical-align: middle !important;
  font-size: 18px;
  font-weight: 950;
}

.slot {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  min-height: 0;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .045);
}

.slot + .slot {
  margin-top: 7px;
}

.slot b {
  display: inline-flex;
  justify-content: center;
  padding: 4px 6px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 9px;
  background: rgba(15, 23, 42, .72);
  color: #f8fafc;
  font-size: 13px;
  line-height: 1;
}

.slot-main {
  min-width: 0;
}

.slot-main strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 900;
}

.slot-main span {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.slot-main em {
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.local {
  color: #fbbf24;
}

.world {
  color: #f472b6;
}

.arena {
  color: #93c5fd;
}

.blank {
  color: var(--muted);
  text-align: center;
}

.mini {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, .13);
  font-size: 14px;
  line-height: 1.35;
}

.mini:last-child {
  border-bottom: 0;
}

.mini span {
  overflow-wrap: anywhere;
}

.mini strong {
  text-align: right;
  white-space: nowrap;
}

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  color: #fbbf24;
  background: rgba(245, 158, 11, .13);
  border: 1px solid rgba(245, 158, 11, .24);
  font-style: normal;
  font-size: 11px;
  font-weight: 900;
}

.footer {
  text-align: center;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 900px) {
  .header,
  .hero,
  .grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .clock {
    text-align: left;
    min-width: 0;
  }

  .event {
    grid-template-columns: 76px 1fr;
  }

  .next-tools {
    width: auto;
  }

  .week-action {
    align-items: stretch;
    flex-direction: column;
  }

  .week-button {
    width: 100%;
  }

  .ebadge {
    grid-column: 1 / -1;
  }

  .wrap {
    min-width: 980px;
  }

  .modal {
    padding: 12px;
  }

  .modal-panel {
    max-height: calc(100vh - 24px);
  }
}
