/* =====================================================================
 * MIR4 Boss Schedule — dark-fantasy theme
 * Palette: Poyang blue + gold (adapted from the shared house style):
 *   navy gradient ground · crimson + gold accents · cream parchment text
 *   Cinzel (display) · Oxanium (UI) · Share Tech Mono (timers/numbers)
 * ===================================================================== */

:root {
  /* Poyang palette: deep-navy ground · azure-blue primary · gold highlights.
     (The --gold* names are kept so the rest of the sheet needn't change; they
      now hold blue values. Real gold lives in --acc-gold for signature bits.) */
  --bg-0: #05080f;
  --bg-1: #070d1c;
  --bg-2: #0b1428;
  --panel: rgba(13, 24, 48, 0.72);
  --panel-solid: #0b1428;
  --ink: #dce9ff;          /* primary text */
  --ink-dim: #7f95bd;      /* muted text   */
  --ink-faint: #46587c;
  --gold: #2b7fff;         /* primary accent — Poyang blue */
  --gold-bright: #5aa9ff;  /* bright accent — blue-hi */
  --crimson: #f87171;      /* LIVE / alert */
  --crimson-deep: #2c0a13;
  --red-soft: #f87171;
  --violet: #38bdf8;       /* azure (divider gradient) */
  --cyan: #22d3ee;
  --green: #22d3a5;
  --gold-line: rgba(56, 140, 255, 0.30);
  --gold-line-soft: rgba(56, 140, 255, 0.18);
  --acc-gold: #e8c97a;     /* real gold — signature highlights */
  --acc-gold-deep: #c9a14b;
  --grad-title: linear-gradient(135deg, #60a5fa 0%, #38bdf8 35%, #7dd3fc 65%, #eaf6ff 100%);
  --radius: 14px;
  --shadow-card: 0 18px 44px -18px rgba(0,0,0,0.8);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: 'Oxanium', system-ui, sans-serif;
  background:
    radial-gradient(1200px 700px at 78% -8%, rgba(43,127,255,0.20), transparent 60%),
    radial-gradient(1000px 620px at 8% 0%, rgba(34,211,238,0.12), transparent 58%),
    linear-gradient(170deg, #0b1428 0%, #070d1c 45%, #05080f 100%);
  background-attachment: fixed;
}
/* faint scanline weave over everything */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.10) 0 1px, transparent 1px 3px);
  opacity: 0.5;
}
.wrap { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; padding: 0 18px 80px; }

a { color: var(--gold-bright); text-decoration: none; }
::selection { background: rgba(43,127,255,0.4); color: #fff; }

/* ---- header --------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(10,12,22,0.92), rgba(10,12,22,0.62));
  border-bottom: 1px solid var(--gold-line);
}
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 12px 18px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; color: inherit; }
.emblem {
  width: 46px; height: 46px; flex: 0 0 auto; border-radius: 12px;
  display: grid; place-items: center; font-size: 24px;
  box-shadow: 0 0 22px -6px rgba(56,189,248,0.8);
}
.emblem img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 0 6px rgba(56,189,248,0.5)); }
.brand h1 {
  font-family: 'Oxanium', sans-serif; font-weight: 800; font-size: 1.25rem; margin: 0;
  letter-spacing: 0.04em;
  background: var(--grad-title); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.brand:hover h1 { filter: brightness(1.12); }
.brand .sub { font-size: 0.72rem; color: var(--ink-dim); letter-spacing: 0.04em; }

.clocks { margin-left: auto; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.clock { text-align: right; line-height: 1.1; }
.clock .lbl { font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.clock .val { font-family: 'Share Tech Mono', monospace; font-size: 1.05rem; color: var(--gold-bright); }
.clock.you .val { color: var(--cyan); }

.langpick { position: relative; }
.langpick select, .iselect {
  appearance: none; background: rgba(12,14,26,0.85); color: var(--ink);
  border: 1px solid var(--gold-line); border-radius: 9px; padding: 7px 30px 7px 11px;
  font-family: 'Oxanium', sans-serif; font-size: 0.82rem; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.iselect:focus, input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201,161,75,0.18); }

/* ---- nav ------------------------------------------------------------ */
.nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin: 20px 0 8px; }
.nav-views { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-spacer { grid-column: 3; display: flex; justify-content: flex-end; align-items: center; gap: 6px; flex-wrap: wrap; }
.region-pick {
  grid-column: 2; justify-self: center; display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 10px 6px 14px; border-radius: 12px;
  background: linear-gradient(160deg, rgba(201,161,75,0.14), rgba(16,19,38,0.65));
  border: 1px solid var(--gold-line); box-shadow: 0 0 24px -8px rgba(232,201,122,0.55);
}
.region-pick .region-lbl { display: inline-flex; align-items: center; gap: 5px; font-family: 'Rajdhani', sans-serif; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.7rem; color: var(--gold-bright); }
.region-pick .region-ico { font-size: 0.92rem; }
.region-pick select { font-family: 'Oxanium', sans-serif; font-weight: 600; letter-spacing: 0.03em; padding: 5px 28px 5px 10px; background-color: rgba(10,12,22,0.7); }
.region-pick .region-time { font-family: 'Share Tech Mono', monospace; font-size: 0.92rem; color: var(--gold-bright); min-width: 70px; }
@media (max-width: 860px) {
  .nav { grid-template-columns: 1fr; }
  .nav-views { justify-content: center; grid-row: 2; }
  .region-pick { grid-column: 1; grid-row: 1; justify-self: stretch; justify-content: center; }
  .nav-spacer { grid-column: 1; grid-row: 3; justify-content: center; }
}
.nav button {
  font-family: 'Rajdhani', sans-serif; font-weight: 600; font-size: 0.95rem; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--ink-dim); cursor: pointer;
  background: rgba(16,19,38,0.5); border: 1px solid var(--gold-line-soft);
  padding: 9px 16px; border-radius: 10px; transition: all 0.18s;
}
.nav button:hover { color: var(--ink); border-color: var(--gold-line); }
.nav button.active {
  color: #ffffff; background: linear-gradient(160deg, var(--gold-bright), var(--gold));
  border-color: rgba(201,161,75,0.6); box-shadow: 0 0 20px -4px rgba(232,201,122,0.6);
}

/* gold divider rule used between sections */
.rule { height: 1px; margin: 14px 0 20px;
  background: linear-gradient(90deg, transparent, var(--violet) 18%, var(--gold-bright) 50%, var(--violet) 82%, transparent); opacity: 0.7; }

/* ---- view section --------------------------------------------------- */
.view { display: none; }
.view.active { display: block; animation: fade 0.3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-title { font-family: 'Oxanium', sans-serif; font-weight: 800; font-size: 1.4rem; letter-spacing: 0.03em; margin: 6px 0 2px; }
.section-sub { color: var(--ink-dim); font-size: 0.86rem; margin-bottom: 14px; }

/* ---- toolbar (board filters) --------------------------------------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.search { position: relative; flex: 1 1 260px; min-width: 200px; }
.search input {
  width: 100%; padding: 11px 14px 11px 38px; border-radius: 11px;
  background: rgba(10,12,22,0.85); border: 1px solid var(--gold-line);
  color: var(--ink); font-family: 'Oxanium', sans-serif; font-size: 0.92rem;
}
.search::before { content: "⚔"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gold); }
.toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
  padding: 9px 14px; border-radius: 11px; font-size: 0.85rem; color: var(--ink-dim);
  background: rgba(16,19,38,0.5); border: 1px solid var(--gold-line-soft);
}
.toggle input { accent-color: var(--crimson); width: 16px; height: 16px; }
.toggle.on { color: var(--ink); border-color: var(--crimson); box-shadow: 0 0 14px -4px rgba(248,113,113,0.5); }
.count-pill { margin-left: auto; font-family: 'Share Tech Mono', monospace; color: var(--ink-dim); font-size: 0.82rem; }

/* ---- boss grid ------------------------------------------------------ */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }

.boss {
  position: relative; border-radius: var(--radius); padding: 15px 16px 14px;
  background:
    linear-gradient(160deg, rgba(255,255,255,0.04), transparent 40%),
    var(--panel);
  border: 1px solid var(--gold-line-soft);
  box-shadow: var(--shadow-card);
  transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s;
  overflow: hidden;
}
.boss::before { /* top accent line, colored by state */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--accent, var(--gold-line)); opacity: 0.9;
}
.boss:hover { transform: translateY(-3px); border-color: var(--gold-line); }
.boss.live { --accent: var(--crimson);
  border-color: rgba(248,113,113,0.55);
  box-shadow: 0 0 0 1px rgba(248,113,113,0.25), 0 18px 44px -18px rgba(0,0,0,0.8), 0 0 38px -10px rgba(248,113,113,0.55); }
.boss.soon { --accent: var(--acc-gold); }
.boss.highlight { --accent: var(--acc-gold); border-color: rgba(232,201,122,0.4); }
.boss.linger { --accent: var(--crimson); border-color: rgba(248,113,113,0.55); }
.boss.linger .cd-time { color: var(--red-soft); text-shadow: 0 0 20px rgba(248,113,113,0.45); }
/* just-triggered spawns blink for the linger minute */
.boss.blink { animation: lingerblink 1s ease-in-out infinite; }
@keyframes lingerblink {
  0%, 100% { box-shadow: 0 0 0 1px rgba(248,113,113,0.35), 0 0 42px -8px rgba(248,113,113,0.75); border-color: rgba(248,113,113,0.7); opacity: 1; }
  50% { box-shadow: var(--shadow-card); border-color: var(--gold-line-soft); opacity: 0.55; }
}

.boss-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.boss-name { font-family: 'Oxanium', sans-serif; font-weight: 600; font-size: 1.04rem; line-height: 1.2; margin: 0; color: var(--ink); }
.head-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.bell {
  cursor: pointer; background: rgba(0,0,0,0.25); border: 1px solid var(--gold-line-soft);
  border-radius: 8px; width: 28px; height: 28px; font-size: 0.82rem; line-height: 1;
  filter: grayscale(1) opacity(0.5); transition: all 0.15s;
}
.bell:hover { filter: grayscale(0.3) opacity(0.9); border-color: var(--gold-line); }
.bell.on { filter: none; border-color: var(--gold); background: rgba(201,161,75,0.16); box-shadow: 0 0 12px -2px rgba(232,201,122,0.6); }
.fav {
  cursor: pointer; background: rgba(0,0,0,0.25); border: 1px solid var(--gold-line-soft);
  border-radius: 8px; width: 28px; height: 28px; font-size: 0.95rem; line-height: 1;
  padding: 0; color: var(--ink-faint); transition: all 0.15s;
}
.fav:hover { color: var(--gold-bright); border-color: var(--gold-line); }
.fav.on {
  color: var(--gold-bright); border-color: var(--gold); background: rgba(201,161,75,0.16);
  box-shadow: 0 0 12px -2px rgba(232,201,122,0.6); text-shadow: 0 0 8px rgba(232,201,122,0.8);
}
.lvl-badge {
  flex: 0 0 auto; font-family: 'Rajdhani', sans-serif; font-weight: 700;
  font-size: 0.78rem; letter-spacing: 0.03em; padding: 3px 9px; border-radius: 20px;
  color: var(--gold-bright); background: rgba(201,161,75,0.12); border: 1px solid rgba(201,161,75,0.3);
  white-space: nowrap;
}
.boss-loc { display: flex; gap: 6px; align-items: baseline; font-size: 0.8rem; color: var(--ink-dim); margin-bottom: 12px; }
.boss-loc .pin { color: var(--crimson); }

.countdown-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.cd-label { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-faint); }
.cd-time { font-family: 'Share Tech Mono', monospace; font-size: 1.7rem; line-height: 1; color: var(--acc-gold); text-shadow: 0 0 18px rgba(232,201,122,0.35); }
.boss.live .cd-time { color: var(--red-soft); text-shadow: 0 0 20px rgba(248,113,113,0.45); }
.cd-at { text-align: right; font-size: 0.74rem; color: var(--ink-dim); }
.cd-at b { color: var(--ink); font-family: 'Share Tech Mono', monospace; font-weight: 400; }

.live-tag {
  display: inline-flex; align-items: center; gap: 6px; font-family: 'Rajdhani', sans-serif;
  font-weight: 700; letter-spacing: 0.14em; font-size: 0.72rem; color: #fff;
  padding: 3px 9px; border-radius: 6px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--crimson) 60%, var(--crimson-deep)), var(--crimson-deep));
  border: 1px solid rgba(248,113,113,0.5);
}
.live-tag .dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; box-shadow: 0 0 8px #fff; animation: pulse 1.1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.chip {
  font-family: 'Share Tech Mono', monospace; font-size: 0.7rem; padding: 2px 7px; border-radius: 6px;
  color: var(--ink-dim); background: rgba(0,0,0,0.28); border: 1px solid var(--gold-line-soft);
}
.chip.tag { font-family: 'Rajdhani', sans-serif; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; font-size: 0.66rem; color: var(--gold-bright); border-color: rgba(201,161,75,0.3); }
.chip.violet { color: var(--acc-gold); border-color: rgba(232,201,122,0.35); background: rgba(232,201,122,0.1); }

/* ---- generic panel / forms ----------------------------------------- */
.panel {
  background: var(--panel); border: 1px solid var(--gold-line-soft); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-card);
}
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; color: var(--ink);
  background: rgba(10,12,22,0.85); border: 1px solid var(--gold-line); font-family: 'Oxanium', sans-serif; font-size: 0.9rem;
}
.field .hint { font-size: 0.72rem; color: var(--ink-faint); margin-top: 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

.btn {
  font-family: 'Rajdhani', sans-serif; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  font-size: 0.86rem; cursor: pointer; padding: 10px 18px; border-radius: 10px;
  border: 1px solid var(--gold-line); background: rgba(16,19,38,0.6); color: var(--ink); transition: all 0.16s;
}
.btn:hover { border-color: var(--gold); color: var(--gold-bright); }
.btn.primary { color: #ffffff; background: linear-gradient(160deg, var(--gold-bright), var(--gold)); border-color: rgba(201,161,75,0.6); }
.btn.primary:hover { box-shadow: 0 0 22px -6px rgba(232,201,122,0.7); color: #ffffff; }
.btn.danger { color: #fff; background: linear-gradient(160deg, color-mix(in srgb, var(--crimson) 55%, var(--crimson-deep)), var(--crimson-deep)); border-color: rgba(248,113,113,0.45); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 0.74rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.bignum { font-family: 'Share Tech Mono', monospace; font-size: 2.1rem; color: var(--gold-bright); }
.statline { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--gold-line-soft); }
.statline:last-child { border-bottom: 0; }
.statline .k { color: var(--ink-dim); font-size: 0.86rem; }
.statline .v { font-family: 'Share Tech Mono', monospace; color: var(--ink); }

/* ---- manager table -------------------------------------------------- */
.mgr-row {
  display: grid; grid-template-columns: 34px 1fr 80px 1.4fr auto; gap: 10px; align-items: center;
  padding: 9px 12px; border: 1px solid var(--gold-line-soft); border-radius: 10px;
  background: rgba(10,12,22,0.5); margin-bottom: 7px;
}
.mgr-row .mid { font-family: 'Share Tech Mono', monospace; color: var(--ink-faint); font-size: 0.78rem; }
.mgr-row .mname { font-family: 'Oxanium', sans-serif; font-size: 0.92rem; }
.mgr-row .mtimes { font-family: 'Share Tech Mono', monospace; font-size: 0.72rem; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mgr-actions { display: flex; gap: 5px; }
@media (max-width: 720px) { .mgr-row { grid-template-columns: 1fr auto; } .mgr-row .mid, .mgr-row .mlvl, .mgr-row .mtimes { display: none; } }

/* ---- modal ---------------------------------------------------------- */
.modal-back { position: fixed; inset: 0; z-index: 60; display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; background: rgba(4,5,10,0.72); backdrop-filter: blur(4px); overflow: auto; }
.modal-back.open { display: flex; }
.modal { width: 100%; max-width: 720px; background: linear-gradient(170deg, #141831, #0c0e1a); border: 1px solid var(--gold-line); border-radius: 16px;
  box-shadow: 0 30px 70px -12px rgba(0,0,0,0.9), 0 0 60px -6px rgba(201,161,75,0.18); padding: 22px; }
.modal h3 { font-family: 'Oxanium', sans-serif; margin: 0 0 16px; letter-spacing: 0.04em; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* ---- toast ---------------------------------------------------------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); z-index: 80;
  background: linear-gradient(160deg, #1a1f3a, #0c0e1a); border: 1px solid var(--gold-line);
  color: var(--ink); padding: 12px 20px; border-radius: 12px; font-size: 0.9rem; opacity: 0; pointer-events: none;
  transition: all 0.3s; box-shadow: 0 18px 40px -12px rgba(0,0,0,0.8); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: rgba(248,113,113,0.5); }

/* alarm card flash */
.boss.alarm-flash { animation: alarmflash 1.1s ease 3; }
@keyframes alarmflash {
  0%, 100% { box-shadow: var(--shadow-card); border-color: var(--gold-line-soft); }
  50% { box-shadow: 0 0 0 1px var(--crimson), 0 0 40px -4px var(--crimson); border-color: var(--crimson); }
}

/* floating stop-sound button */
.stop-sound {
  position: fixed; bottom: 24px; right: 24px; z-index: 80; display: none; align-items: center; gap: 8px;
  font-family: 'Rajdhani', sans-serif; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  cursor: pointer; padding: 11px 18px; border-radius: 12px; color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--crimson) 55%, var(--crimson-deep)), var(--crimson-deep));
  border: 1px solid rgba(248,113,113,0.5); box-shadow: 0 0 24px -4px rgba(248,113,113,0.6);
}
.stop-sound.show { display: inline-flex; }
.stop-sound .dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 0.9s infinite; }

/* alarm settings rows */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--gold-line-soft); }
.row-between:last-child { border-bottom: 0; }
.row-between label { margin: 0; text-transform: none; letter-spacing: 0; font-size: 0.88rem; color: var(--ink); }
.switch { position: relative; width: 44px; height: 24px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 20px; cursor: pointer; background: rgba(0,0,0,0.4); border: 1px solid var(--gold-line-soft); transition: 0.2s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: var(--ink-dim); transition: 0.2s; }
.switch input:checked + span { background: rgba(248,113,113,0.35); border-color: var(--crimson); }
.switch input:checked + span::before { transform: translateX(20px); background: var(--red-soft); }

.loading { text-align: center; padding: 60px 0; color: var(--ink-dim); font-family: 'Oxanium', sans-serif; letter-spacing: 0.08em; }
.empty { text-align: center; padding: 50px 0; color: var(--ink-faint); }

footer.foot { text-align: center; color: var(--ink-faint); font-size: 0.76rem; margin-top: 40px; line-height: 1.7; }
footer.foot a { color: var(--gold); }
