:root {
  color-scheme: dark;
  --bg: #030505;
  --panel: #07100d;
  --panel-2: #0b1714;
  --line: #17352f;
  --line-soft: #0d2420;
  --text: #e6eef2;
  --muted: #8ca0a8;
  --yellow: #ffd21a;
  --cyan: #19e4e8;
  --red: #ff3030;
  --orange: #ff934d;
  --blue: #73a7ff;
  --green-text: #f0f6a6;
  --row-hover: #081d20;
  --input: #020807;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #06120f 0, #020303 142px, #000 100%);
  color: var(--text);
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(44px, 1fr) 52px minmax(180px, 420px) 52px minmax(172px, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 72px;
  padding: 0 22px;
  background: rgba(8, 22, 17, 0.96);
  border-bottom: 1px solid #1c3c32;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(10px);
}

.edge-code {
  min-width: 0;
  color: rgba(215, 232, 230, 0.32);
  font-size: 1rem;
  font-weight: 800;
  overflow: hidden;
  white-space: nowrap;
}

.stock-title {
  min-width: 0;
  color: var(--yellow);
  font-size: 1.55rem;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 18px rgba(255, 210, 26, 0.18);
}

.stock-title span + span {
  margin-left: 0.16em;
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 6px;
  background: transparent;
  color: var(--yellow);
  font-size: 2.15rem;
  font-weight: 900;
  line-height: 1;
}

.icon-button:hover,
.icon-button:focus-visible {
  background: rgba(255, 210, 26, 0.09);
  outline: 1px solid rgba(255, 210, 26, 0.45);
}

.return-button {
  font-size: 1.8rem;
}

.return-button.dimmed {
  opacity: 0.32;
}

.menu-button {
  font-size: 1.7rem;
}

.refresh-button {
  height: 34px;
  min-width: 54px;
  border-radius: 4px;
  background: #f20b0b;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 900;
  outline: 1px solid var(--yellow);
  box-shadow: 0 0 16px rgba(242, 11, 11, 0.24);
}

.refresh-button:hover,
.refresh-button:focus-visible {
  background: #ff2525;
}

.selector {
  position: sticky;
  top: 72px;
  z-index: 18;
  display: grid;
  grid-template-columns: minmax(280px, 430px) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px 36px;
  background: rgba(2, 6, 6, 0.97);
  border-bottom: 1px solid var(--line-soft);
}

.stock-form {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 68px;
  gap: 8px;
}

.stock-form input {
  min-width: 0;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--input);
  color: var(--text);
  padding: 0 13px;
  outline: none;
}

.stock-form input::placeholder {
  color: #6f838b;
}

.stock-form input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(25, 228, 232, 0.12);
}

.stock-form button {
  height: 40px;
  border-radius: 6px;
  background: #0d6f72;
  color: #fff;
  font-weight: 900;
}

.stock-form button:hover,
.stock-form button:focus-visible {
  background: #0f8588;
}

.quick-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.quick-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.quick-list button {
  flex: 0 0 auto;
  height: 34px;
  border-radius: 6px;
  border: 1px solid #153d4a;
  background: #041012;
  color: #bbe6ee;
  padding: 0 11px;
  white-space: nowrap;
}

.quick-list button:hover,
.quick-list button:focus-visible {
  border-color: var(--cyan);
  color: #fff;
}

.quick-list button.active {
  border-color: var(--yellow);
  color: var(--yellow);
  background: #141403;
}

.quick-list button.home-chip {
  border-color: #315348;
  color: #e5f5d7;
  background: #0b1912;
}

.quick-list button.home-chip.active {
  border-color: var(--cyan);
  color: var(--cyan);
  background: #06191a;
}

.edit-quick-button,
.quick-editor-actions button {
  height: 34px;
  border-radius: 6px;
  border: 1px solid #24464c;
  background: #061113;
  color: #cbe5e8;
  padding: 0 12px;
  white-space: nowrap;
}

.edit-quick-button:hover,
.edit-quick-button:focus-visible,
.quick-editor-actions button:hover,
.quick-editor-actions button:focus-visible {
  border-color: var(--cyan);
  color: #fff;
}

.quick-editor {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(260px, 620px) minmax(220px, 1fr);
  gap: 12px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #020807;
}

.quick-editor textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #000;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  line-height: 1.55;
}

.quick-editor textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(25, 228, 232, 0.12);
}

.quick-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.quick-editor-hint {
  flex: 1 1 260px;
  color: var(--muted);
  font-size: 0.9rem;
}

.workspace {
  min-height: calc(100vh - 124px);
  background: #000;
}

.news-pane {
  padding: 22px 36px 72px;
}

.status-line {
  min-height: 28px;
  max-width: 1180px;
  color: var(--muted);
  font-size: 0.95rem;
}

.news-groups {
  max-width: 1180px;
}

.date-group {
  margin-top: 10px;
}

.date-heading {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
  margin: 22px 0 12px;
  color: #dfff10;
  font-size: 1.06rem;
  font-weight: 900;
}

.date-heading::before,
.date-heading::after {
  content: "";
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(223, 255, 16, 0.38));
}

.date-heading::after {
  background: linear-gradient(90deg, rgba(223, 255, 16, 0.38), transparent);
}

.news-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  width: 100%;
  min-height: 36px;
  align-items: start;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 4px 8px;
}

.news-row:hover,
.news-row:focus-visible {
  background: var(--row-hover);
  outline: 1px solid #123947;
}

.news-time {
  color: var(--red);
  font-size: 1.08rem;
  line-height: 1.48;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.news-title {
  min-width: 0;
  color: #e2edf2;
  font-size: 1.08rem;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.news-headline {
  color: #e2edf2;
}

.news-source {
  color: var(--orange);
}

.news-provider {
  color: #879aa2;
  font-size: 0.88rem;
  white-space: nowrap;
}

.article-pane {
  max-width: 1180px;
  padding: 34px 36px 96px;
}

.article-back-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  margin: 0 0 20px;
  border: 1px solid #1f4e53;
  border-radius: 6px;
  background: #061517;
  color: var(--cyan);
  padding: 0 13px;
  font-size: 0.96rem;
  font-weight: 800;
  cursor: pointer;
}

.article-back-button:hover,
.article-back-button:focus-visible {
  background: #082124;
  outline: 1px solid rgba(0, 239, 239, 0.35);
}

.article-pane h1 {
  margin: 0 0 16px;
  color: var(--green-text);
  font-size: 1.34rem;
  line-height: 1.52;
  font-weight: 900;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
  color: #9fb3ba;
  font-size: 0.95rem;
}

.article-meta a {
  color: var(--blue);
  text-decoration: none;
}

.article-meta a:hover {
  text-decoration: underline;
}

.article-body {
  color: #e8f0f3;
  font-size: 1.28rem;
  line-height: 1.86;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.hidden {
  display: none;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: #17343a;
}

::-webkit-scrollbar-track {
  background: #010404;
}

@media (max-width: 860px) {
  .topbar {
    grid-template-columns: 34px 40px minmax(0, 1fr) 40px auto;
    gap: 4px;
    min-height: 60px;
    padding: 0 8px;
  }

  .edge-code {
    font-size: 0.78rem;
  }

  .stock-title {
    font-size: 1.14rem;
  }

  .top-actions {
    gap: 4px;
  }

  .icon-button {
    width: 34px;
    height: 38px;
    font-size: 1.85rem;
  }

  .return-button,
  .menu-button {
    font-size: 1.5rem;
  }

  .refresh-button {
    min-width: 42px;
    height: 29px;
    font-size: 0.78rem;
  }

  .selector {
    top: 60px;
    grid-template-columns: 1fr;
    padding: 10px 12px;
  }

  .quick-strip,
  .quick-editor {
    grid-template-columns: 1fr;
  }

  .edit-quick-button {
    justify-self: start;
  }

  .news-pane {
    padding: 18px 10px 60px;
  }

  .news-row {
    grid-template-columns: 54px minmax(0, 1fr);
    min-height: 36px;
    padding: 4px 4px;
  }

  .news-time,
  .news-title {
    font-size: 0.98rem;
  }

  .news-provider {
    display: block;
    margin-top: 1px;
    font-size: 0.78rem;
  }

  .article-pane {
    padding: 24px 12px 72px;
  }

  .article-back-button {
    width: 100%;
    justify-content: center;
    margin-bottom: 16px;
  }

  .article-pane h1 {
    font-size: 1.12rem;
  }

  .article-body {
    font-size: 1.05rem;
    line-height: 1.78;
  }
}
