:root {
  --bg-primary: #000000;
  --bg-surface: #1c1e21;
  --text-primary: #ffffff;
  --text-secondary: #e4e6eb;
  --text-muted: #b0b3b8;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --chg-up: #00ff88;
  --chg-down: #ff4466;
  --chg-vol: #ffd23f;
  --chg-news: #00d4ff;
  --chg-earn: #ff9f43;
  --chg-idx: #e4e6eb;
  --ink: #0a0a0f;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 600px;
  height: 600px;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#app {
  width: 600px;
  height: 600px;
  padding: 8px;
}

.screen {
  width: 584px;
  height: 584px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 88px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border-radius: 12px;
  flex-shrink: 0;
  gap: 4px;
}

.header-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header h1 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.header.header-compact {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 16px;
}

.screen.hidden {
  display: none;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.clock {
  flex-shrink: 0;
}

#updated {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-meta.is-error {
  color: var(--chg-down);
}

.terminal {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
}

.row {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  width: 100%;
  min-height: 88px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border-radius: 10px;
  overflow: hidden;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 600;
  color: var(--focus-ring);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kind-badge {
  flex-shrink: 0;
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--ink);
  background: var(--accent, var(--chg-news));
}

.kind-badge.up,
.row.up,
.detail-card.up {
  --accent: var(--chg-up);
}

.kind-badge.down,
.row.down,
.detail-card.down {
  --accent: var(--chg-down);
}

.kind-badge.vol,
.row.vol,
.detail-card.vol {
  --accent: var(--chg-vol);
}

.kind-badge.news,
.row.news,
.detail-card.news {
  --accent: var(--chg-news);
}

.kind-badge.earn,
.row.earn,
.detail-card.earn {
  --accent: var(--chg-earn);
}

.kind-badge.idx,
.row.idx,
.detail-card.idx {
  --accent: var(--chg-idx);
}

.kind-badge.down {
  color: #ffffff;
}

.row.up,
.row.down,
.row.vol,
.row.news,
.row.earn,
.row.idx,
.detail-card.up,
.detail-card.down,
.detail-card.vol,
.detail-card.news,
.detail-card.earn,
.detail-card.idx {
  box-shadow: inset 8px 0 0 var(--accent);
}

.row.focusable:focus.up,
.row.focusable:focus.down,
.row.focusable:focus.vol,
.row.focusable:focus.news,
.row.focusable:focus.earn,
.row.focusable:focus.idx {
  box-shadow: inset 8px 0 0 var(--accent), 0 0 20px var(--focus-glow);
}

.row-headline {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row.up .row-headline {
  color: var(--chg-up);
}

.row.down .row-headline {
  color: var(--chg-down);
}

.focusable {
  min-height: 88px;
  padding: 0 20px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  opacity: 0.8;
  flex-shrink: 0;
  transition:
    transform 475ms cubic-bezier(0.6, 0, 0.4, 1),
    opacity 300ms cubic-bezier(0.4, 0.04, 0.5, 1),
    border-color 300ms ease,
    box-shadow 300ms ease;
}

.row.focusable {
  text-align: left;
  padding: 8px 12px;
  font-size: inherit;
  font-weight: inherit;
}

.focusable:focus {
  outline: none;
  opacity: 1;
  border-color: var(--focus-ring);
  box-shadow: 0 0 20px var(--focus-glow);
  transform: scale(calc(1 - 8 / 88));
}

.detail-card {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px 16px 12px 20px;
  background: var(--bg-surface);
  border-radius: 12px;
  user-select: none;
}

.detail-card .row-meta {
  margin-bottom: 10px;
}

.detail-headline {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 12px;
}

.detail-card.up .detail-headline {
  color: var(--chg-up);
}

.detail-card.down .detail-headline {
  color: var(--chg-down);
}

.detail-summary {
  font-size: 20px;
  line-height: 1.35;
  color: var(--text-secondary);
}
