html:has(.updates-page),
body.updates-page {
  height: 100%;
  overflow: hidden;
}

.updates-page {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 4%, color-mix(in srgb, var(--cyan) 12%, transparent), transparent 28rem),
    radial-gradient(circle at 85% 65%, color-mix(in srgb, #7c5cff 9%, transparent), transparent 35rem),
    var(--bg);
}

.updates-page .gate-nav {
  position: relative;
  z-index: 20;
}

.updates-home-link {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
  text-decoration: none;
}

.updates-home-link:hover { color: var(--cyan); }

.updates-main {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: min(1500px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(0.8rem, 1.7vh, 1.4rem) 0 clamp(0.8rem, 1.7vh, 1.4rem);
  box-sizing: border-box;
}

.updates-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex: 0 0 auto;
  gap: 2rem;
  margin-bottom: clamp(0.7rem, 1.4vh, 1.1rem);
  padding: 0 0.2rem;
}

.updates-hero-title { min-width: 0; }

.updates-kicker {
  margin: 0 0 0.42rem;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.updates-title-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.updates-title-row .updates-subscribe {
  margin-left: 0.35rem;
}

.updates-title-row img {
  width: clamp(2.8rem, 4vw, 3.5rem);
  height: clamp(2.8rem, 4vw, 3.5rem);
  border: 1px solid color-mix(in srgb, var(--cyan) 24%, var(--border));
  border-radius: 1rem;
  object-fit: cover;
  box-shadow: 0 12px 30px color-mix(in srgb, #075dc2 28%, transparent);
}

.updates-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3.05rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.updates-hero-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 0 0 auto;
}

.updates-live,
.updates-subscribe {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.35rem;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 750;
  white-space: nowrap;
}

.updates-live {
  border: 1px solid color-mix(in srgb, #22c79a 30%, var(--border));
  color: color-mix(in srgb, #22c79a 80%, var(--text));
  background: color-mix(in srgb, #22c79a 8%, var(--surface));
}

.updates-live i {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: #22c79a;
  box-shadow: 0 0 0 0.28rem color-mix(in srgb, #22c79a 14%, transparent);
}

.updates-subscribe {
  border: 1px solid color-mix(in srgb, var(--cyan) 45%, var(--border));
  color: #fff;
  background: linear-gradient(135deg, #0aa7d4, #1378d4);
  box-shadow: 0 10px 24px color-mix(in srgb, #087ec1 24%, transparent);
  font: inherit;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.updates-subscribe:hover {
  transform: translateY(-1px);
  box-shadow: 0 13px 30px color-mix(in srgb, #087ec1 32%, transparent);
}

.updates-subscribe svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.updates-workspace {
  display: grid;
  grid-template-columns: minmax(18rem, 22rem) minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--cyan) 12%, var(--border));
  border-radius: 1.35rem;
  background: color-mix(in srgb, var(--surface-solid) 89%, transparent);
  box-shadow: 0 28px 80px color-mix(in srgb, #000 22%, transparent);
  backdrop-filter: var(--glass-blur);
}

.updates-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 1rem;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--cyan) 5%, transparent), transparent 14rem),
    color-mix(in srgb, var(--surface) 90%, transparent);
}

.updates-sidebar-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.15rem 0.25rem 0.9rem;
}

.updates-app-icon {
  display: grid;
  place-items: center;
  width: 2.7rem;
  height: 2.7rem;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--cyan) 24%, var(--border));
  border-radius: 0.82rem;
  background: var(--cyan-dim);
  box-shadow: 0 8px 18px color-mix(in srgb, #075dc2 18%, transparent);
}

.updates-app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.updates-sidebar-head strong,
.updates-sidebar-head span { display: block; }
.updates-sidebar-head strong { font-size: 0.98rem; }
.updates-sidebar-head span { margin-top: 0.12rem; color: var(--dim); font-size: 0.74rem; }

.updates-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  flex: 0 0 auto;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.updates-tabs button {
  position: relative;
  padding: 0.58rem 0.2rem;
  border: 0;
  color: var(--dim);
  background: transparent;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.updates-tabs button::after {
  content: "";
  position: absolute;
  right: 20%;
  bottom: -0.78rem;
  left: 20%;
  height: 2px;
  border-radius: 2px;
  background: transparent;
}

.updates-tabs button.is-active { color: var(--text); }
.updates-tabs button.is-active::after { background: var(--cyan); }

.updates-list {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 0;
  margin: 0.75rem -0.2rem 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--cyan) 28%, transparent) transparent;
}

.updates-list-state { padding: 3rem 1rem; color: var(--dim); text-align: center; font-size: 0.84rem; }

.update-row {
  box-sizing: border-box;
  width: 100%;
  padding: 0.82rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 0.85rem;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.update-row:hover { background: color-mix(in srgb, var(--cyan) 5%, var(--surface)); }
.update-row.is-active { border-color: color-mix(in srgb, var(--cyan) 28%, var(--border)); background: color-mix(in srgb, var(--cyan) 10%, var(--surface)); }

.update-row-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.38rem; }
.update-source { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--cyan); font-family: var(--font-mono); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.04em; }
.update-source::before { content: ""; width: 0.42rem; height: 0.42rem; border-radius: 50%; background: currentColor; }
.update-source--official { color: #e8aa45; }
.update-row time { color: var(--dim); font-size: 0.69rem; }
.update-row strong { display: -webkit-box; overflow: hidden; color: var(--text); font-size: 0.86rem; line-height: 1.42; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.update-row p { display: -webkit-box; overflow: hidden; margin: 0.35rem 0 0; color: var(--muted); font-size: 0.74rem; line-height: 1.5; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.updates-more {
  flex: 0 0 auto;
  margin: 0.5rem 0.2rem 0.7rem;
  padding: 0.62rem;
  border: 1px solid color-mix(in srgb, var(--cyan) 20%, var(--border));
  border-radius: 0.75rem;
  color: var(--cyan);
  background: color-mix(in srgb, var(--cyan) 5%, transparent);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
  cursor: pointer;
}

.updates-detail {
  min-width: 0;
  min-height: 0;
  padding: clamp(1.35rem, 2.4vw, 2.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--cyan) 38%, transparent) transparent;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--cyan) 2%, transparent), transparent 15rem),
    color-mix(in srgb, var(--surface-solid) 94%, transparent);
}

.updates-detail::-webkit-scrollbar,
.updates-list::-webkit-scrollbar { width: 8px; }
.updates-detail::-webkit-scrollbar-thumb,
.updates-list::-webkit-scrollbar-thumb { border-radius: 10px; background: color-mix(in srgb, var(--cyan) 32%, transparent); }

.updates-empty { display: grid; place-items: center; align-content: center; min-height: 24rem; color: var(--dim); text-align: center; }
.updates-empty > span { display: grid; place-items: center; width: 3.5rem; height: 3.5rem; margin-bottom: 0.9rem; border: 1px solid var(--border); border-radius: 50%; font-size: 1.4rem; }
.updates-empty strong { color: var(--muted); }
.updates-empty p { margin: 0.35rem 0 0; font-size: 0.82rem; }

.update-detail-head { padding-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.update-detail-meta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.85rem; }
.update-detail-meta time { color: var(--dim); font-family: var(--font-mono); font-size: 0.76rem; }
.update-detail-head h2 { margin: 0; font-size: clamp(1.45rem, 2.05vw, 2.08rem); line-height: 1.28; letter-spacing: -0.025em; }

.update-detail-summary {
  margin: 0.9rem 0 0;
  padding: 0.85rem 1rem;
  border: 1px solid color-mix(in srgb, var(--cyan) 12%, transparent);
  border-left: 3px solid var(--cyan);
  border-radius: 0 0.72rem 0.72rem 0;
  color: var(--muted);
  background: linear-gradient(90deg, var(--cyan-dim), color-mix(in srgb, var(--cyan) 3%, transparent));
  font-size: 0.9rem;
  line-height: 1.65;
  white-space: pre-line;
}

.update-detail-body {
  max-width: 68rem;
  padding: 1.35rem 0 0.7rem;
  color: color-mix(in srgb, var(--text) 90%, var(--muted));
  font-size: 0.93rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.update-detail-line { min-height: 0.8rem; margin: 0 0 0.22rem; }
.update-detail-line--blank { height: 0.55rem; margin: 0; }
.update-detail-line--section { margin-top: 0.8rem; color: var(--text); font-size: 1rem; font-weight: 800; }
.update-detail-line--bullet { position: relative; padding-left: 1.05rem; }
.update-detail-line--bullet::before { content: ""; position: absolute; top: 0.7em; left: 0.15rem; width: 0.34rem; height: 0.34rem; border-radius: 50%; background: var(--cyan); }

.diff-old,
.diff-removed {
  padding: 0.05em 0.26em;
  border-radius: 0.3em;
  color: #dc5066;
  background: color-mix(in srgb, #dc5066 10%, transparent);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.diff-new,
.diff-added {
  padding: 0.05em 0.26em;
  border-radius: 0.3em;
  color: #16a67a;
  background: color-mix(in srgb, #16a67a 11%, transparent);
  font-weight: 750;
  text-decoration: none;
}

[data-theme="dark"] .diff-old,
[data-theme="dark"] .diff-removed { color: #ff7588; }
[data-theme="dark"] .diff-new,
[data-theme="dark"] .diff-added { color: #42d6aa; }

.update-source-link { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0.6rem 0 0.8rem; padding: 0.62rem 0.88rem; border: 1px solid color-mix(in srgb, var(--cyan) 28%, var(--border)); border-radius: 0.75rem; color: var(--cyan); text-decoration: none; font-size: 0.86rem; font-weight: 700; }
.updates-footer { display: none; }

.updates-subscribe-modal[hidden] { display: none; }
.updates-subscribe-modal { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 1rem; }
.updates-subscribe-backdrop { position: absolute; inset: 0; border: 0; background: rgba(4, 13, 28, 0.66); backdrop-filter: blur(8px); cursor: default; }
.updates-subscribe-dialog { position: relative; width: min(25rem, calc(100vw - 2rem)); padding: 1.65rem; border: 1px solid color-mix(in srgb, var(--cyan) 22%, var(--border)); border-radius: 1.35rem; background: color-mix(in srgb, var(--surface-solid) 96%, transparent); box-shadow: 0 32px 90px rgba(0, 0, 0, 0.38); text-align: center; }
.updates-subscribe-close { position: absolute; top: 0.65rem; right: 0.75rem; display: grid; place-items: center; width: 2rem; height: 2rem; border: 0; border-radius: 50%; color: var(--muted); background: transparent; font-size: 1.5rem; cursor: pointer; }
.updates-subscribe-close:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
.updates-subscribe-badge { display: grid; place-items: center; width: 3.5rem; height: 3.5rem; margin: 0 auto 0.8rem; overflow: hidden; border-radius: 1rem; box-shadow: 0 10px 25px color-mix(in srgb, #075dc2 28%, transparent); }
.updates-subscribe-badge img { width: 100%; height: 100%; object-fit: cover; }
.updates-subscribe-dialog h2 { margin: 0; font-size: 1.35rem; }
.updates-subscribe-dialog > p { max-width: 21rem; margin: 0.6rem auto 1rem; color: var(--muted); font-size: 0.86rem; line-height: 1.65; }
.updates-subscribe-qr { display: inline-grid; gap: 0.6rem; color: var(--cyan); font-size: 0.78rem; font-weight: 700; text-decoration: none; }
.updates-subscribe-qr img { width: min(13.75rem, 62vw); height: min(13.75rem, 62vw); padding: 0.5rem; border: 1px solid var(--border); border-radius: 1rem; background: #fff; object-fit: contain; transition: transform 0.16s ease, box-shadow 0.16s ease; }
.updates-subscribe-qr:hover img { transform: translateY(-2px); box-shadow: 0 14px 34px color-mix(in srgb, #000 18%, transparent); }

@media (max-width: 820px) {
  .updates-main { width: min(100% - 1rem, 1500px); padding: 0.65rem 0; }
  .updates-hero { align-items: center; gap: 0.75rem; }
  .updates-kicker { display: none; }
  .updates-title-row { gap: 0.6rem; }
  .updates-title-row img { width: 2.4rem; height: 2.4rem; border-radius: 0.72rem; }
  .updates-hero h1 { font-size: 1.55rem; }
  .updates-title-row .updates-subscribe { margin-left: auto; }
  .updates-live { display: none; }
  .updates-subscribe { min-height: 2.15rem; padding: 0.45rem 0.7rem; font-size: 0.75rem; }
  .updates-workspace { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); border-radius: 1rem; }
  .updates-sidebar { max-height: 14.5rem; border-right: 0; border-bottom: 1px solid var(--border); }
  .updates-sidebar-head { display: none; }
  .updates-more { margin-top: 0; }
  .updates-tabs { padding-bottom: 0.55rem; }
  .updates-tabs button::after { bottom: -0.58rem; }
  .updates-list { min-height: 5.25rem; }
  .updates-detail { padding: 1.1rem; }
  .update-detail-head h2 { font-size: 1.25rem; }
}

@media (max-width: 560px) {
  .updates-home-link { display: none; }
  .updates-hero-actions { gap: 0; }
  .updates-subscribe svg { display: none; }
  .updates-detail-summary { font-size: 0.82rem; }
  .update-detail-meta { align-items: flex-start; flex-direction: column; gap: 0.4rem; }
  .update-detail-body { font-size: 0.86rem; }
}
