:root {
  --font-sans: "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Modern Default — Webnerd.ai Nordic Dusk & Tactile Cockpit */
  --bg-primary: #0d1417;
  --bg-secondary: #0a1013;
  --bg-tertiary: #182328;
  --bg-card: #151f24;
  --bg-card-header: #18252c;
  --bg-card-hover: #1b272d;
  --bg-row-hover: rgba(75, 182, 235, 0.08);
  --border-color: #25363e;
  --border-subtle: #1c2a31;
  --border-active: #4bb6eb;
  --text-primary: #eef5f7;
  --text-secondary: #c4d6dc;
  --text-muted: #93aeb7;
  --brand-text: #eef5f7;
  --brand-tld: #4bb6eb;
  --accent: #ff9442;
  --accent-hover: #ffb070;
  --accent-blue: #4bb6eb;
  --link-color: #6ad0ff;
  --unread-dot: #ff7500;
  --positive: #3ec7ac;
  --negative: #f87171;
  --warning: #f0bc34;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 4px 14px -3px rgba(0, 0, 0, 0.45);
  --widget-bar-border: 1px solid var(--border-subtle);
  color-scheme: light dark;

  &:has(> head > meta[name="color-scheme"][content="dark"]) {
    color-scheme: dark;
  }

  &:has(> head > meta[name="color-scheme"][content="light"]) {
    color-scheme: light;
  }
}

/* Classic Portal Theme — Matches Webnerd.ai classic-rss + iGoogle / My Excite heritage */
[data-theme="classic"] {
  --bg-primary: #eef2f6;
  --bg-secondary: #e5ebf3;
  --bg-tertiary: #dce4ef;
  --bg-card: #ffffff;
  --bg-card-header: #e8f0fe;
  --bg-card-hover: #f8fafc;
  --bg-row-hover: #ffffe0;
  --border-color: #b7c7dc;
  --border-subtle: #dde4ee;
  --border-active: #3366cc;
  --text-primary: #222222;
  --text-secondary: #3f4650;
  --text-muted: #666e7a;
  --brand-text: #1c3d7a;
  --brand-tld: #d14836;
  --accent: #d14836;
  --accent-hover: #b93827;
  --accent-blue: #3366cc;
  --link-color: #1155cc;
  --unread-dot: #d14836;
  --positive: #137333;
  --negative: #c5221f;
  --warning: #b06000;
  --radius-sm: 3px;
  --radius-md: 4px;
  --radius-lg: 5px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  --widget-bar-border: 1px solid #c3d3ea;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.45;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--link-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Top Unified Webnerd Trifecta Bar */
.wn-trifecta-bar {
  border-block-start: 3px solid #4bb6eb;
  background-color: #111619;
  background-image: radial-gradient(circle, rgba(237, 244, 246, 0.08) 1px, transparent 1.25px);
  background-size: 9px 9px;
  border-block-end: 1px solid #20313a;
  color: #c8d6dc;
  font-size: 0.78rem;
}

[data-theme="classic"] .wn-trifecta-bar {
  border-block-start: 3px solid #3366cc;
  background-color: #2d2d2d;
  background-image: none;
  border-block-end: 1px solid #000000;
  color: #d4d4d4;
}

.wn-trifecta-inner {
  max-width: 1460px;
  margin: 0 auto;
  padding: 0.35rem clamp(0.65rem, 1.8vw, 1.25rem);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.wn-trifecta-nav {
  min-width: 0;
  flex: 1 1 auto;
}

.wn-trifecta-list {
  list-style: none;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.wn-trifecta-list::-webkit-scrollbar {
  display: none;
}

.wn-trifecta-link {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.28rem 0.62rem;
  min-block-size: 2rem;
  border-radius: 7px;
  color: #c8d6dc;
  font-weight: 500;
  white-space: nowrap;
  scroll-snap-align: start;
  border: 1px solid transparent;
  transition: background-color 0.14s ease, color 0.14s ease;
}

@media (max-width: 640px) {
  .wn-lbl-prefix {
    display: none;
  }
  .wn-trifecta-list {
    padding-right: 1.5rem;
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent 100%);
    mask-image: linear-gradient(to right, #000 88%, transparent 100%);
  }
  .wn-trifecta-link {
    padding: 0.26rem 0.52rem;
    min-block-size: 2.15rem;
    font-size: 0.76rem;
  }
  .clock-pill {
    display: none;
  }
}

.wn-trifecta-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  text-decoration: none;
}

.wn-trifecta-link.is-active {
  background: rgba(75, 182, 235, 0.16);
  border-color: rgba(75, 182, 235, 0.45);
  color: #ffffff;
  font-weight: 600;
}

.wn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.dot-blue { background: #4bb6eb; }
.dot-amber { background: #f0bc34; }
.dot-orange { background: #ff7500; }
.dot-purple { background: #a855f7; }
.dot-teal { background: #3ec7ac; }

.wn-trifecta-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.clock-pill {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: #93aeb7;
  padding: 0.2rem 0.45rem;
}

.top-action-btn {
  appearance: none;
  background: rgba(255, 255, 255, 0.08);
  color: #eef5f7;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  padding: 0.28rem 0.65rem;
  min-block-size: 2rem;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

.top-action-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.top-action-btn.btn-auth {
  background: rgba(75, 182, 235, 0.2);
  border-color: rgba(75, 182, 235, 0.5);
}

[data-theme="modern"] .theme-label-classic { display: none; }
[data-theme="classic"] .theme-label-modern { display: none; }

/* Masthead + Google Search */
.portal-header {
  background: var(--bg-secondary);
  border-block-end: 1px solid var(--border-color);
}

[data-theme="classic"] .portal-header {
  background: linear-gradient(180deg, #ffffff 0%, #eaf0f8 100%);
}

.portal-header-inner {
  max-width: 1460px;
  margin: 0 auto;
  padding: 0.85rem clamp(0.75rem, 2vw, 1.35rem) 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1.25rem;
}

.brand-lockup {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
}

.brand-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--brand-text);
  text-decoration: none;
}

.brand-logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: block;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
}

.brand-wordmark:hover {
  text-decoration: none;
}

.brand-tld {
  color: var(--brand-tld);
}

.brand-tagline {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 500;
}

.google-search-form {
  flex: 1 1 360px;
  max-width: 680px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.google-search-form input[type="search"] {
  flex: 1 1 220px;
  min-block-size: 2.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.92rem;
}

.google-search-form input[type="search"]:focus {
  outline: 2px solid var(--border-active);
  outline-offset: 1px;
}

.search-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.btn-primary,
.btn-secondary,
.btn-danger-ghost {
  appearance: none;
  min-block-size: 2.35rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent-blue);
  color: #071318;
}

[data-theme="classic"] .btn-primary {
  background: #3366cc;
  color: #ffffff;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--negative);
  border-color: transparent;
}

.btn-danger-ghost:hover {
  background: rgba(239, 68, 68, 0.12);
}

/* iGoogle-style Portal Tabs */
.portal-tabs-bar {
  border-block-start: 1px solid var(--border-subtle);
}

.portal-tabs-inner {
  max-width: 1460px;
  margin: 0 auto;
  padding: 0 clamp(0.75rem, 2vw, 1.35rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.portal-tabs {
  display: flex;
  align-items: flex-end;
  gap: 0.25rem;
  padding-top: 0.35rem;
  overflow-x: auto;
}

.portal-tab {
  appearance: none;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 0.45rem 0.95rem;
  min-block-size: 2.2rem;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.portal-tab:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.portal-tab.is-active {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--border-color);
  position: relative;
  top: 1px;
}

[data-theme="classic"] .portal-tab.is-active {
  background: var(--bg-primary);
  color: #1c3d7a;
  border-top: 2px solid #3366cc;
}

.tab-utility-btn {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-sm);
}

.tab-utility-btn:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

/* Live Market Ticker Strip */
.ticker-strip {
  background: var(--bg-tertiary);
  border-block-end: 1px solid var(--border-color);
  font-size: 0.78rem;
}

.ticker-strip-inner {
  max-width: 1460px;
  margin: 0 auto;
  padding: 0.38rem clamp(0.75rem, 2vw, 1.35rem);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.ticker-strip-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent);
  flex-shrink: 0;
}

.ticker-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  padding: 0.14rem 0.45rem;
  border-radius: 5px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.ticker-chip:hover {
  border-color: var(--border-active);
  text-decoration: none;
}

.delta-up { color: var(--positive); font-weight: 700; }
.delta-down { color: var(--negative); font-weight: 700; }

/* Main Multi-Column Widget Grid */
.portal-main {
  flex: 1;
  width: 100%;
  max-width: 1460px;
  margin: 0 auto;
  padding: clamp(0.75rem, 1.8vw, 1.25rem);
}

.portal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}

@media (min-width: 740px) {
  .portal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1120px) {
  .portal-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.15fr) minmax(0, 0.95fr);
  }
}

.portal-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 4rem;
  border-radius: var(--radius-md);
  transition: outline-color 0.15s ease, background-color 0.15s ease;
}

.portal-column.is-drop-target {
  outline: 2px dashed var(--border-active);
  outline-offset: 4px;
  background: rgba(75, 182, 235, 0.06);
}

/* Widget Card */
.widget-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.widget-card.is-dragging {
  opacity: 0.45;
}

.widget-card.is-drop-before {
  box-shadow: 0 -3px 0 0 var(--border-active), var(--shadow);
}

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.5rem 0.65rem;
  background: var(--bg-card-header);
  border-block-end: var(--widget-bar-border);
  cursor: grab;
  user-select: none;
}

.widget-header:active {
  cursor: grabbing;
}

/* Classic iGoogle colored top accent per widget type */
[data-theme="classic"] .widget-card[data-widget="webnerd"] .widget-header { background: #e8f0fe; border-top: 2px solid #1a73e8; }
[data-theme="classic"] .widget-card[data-widget="nerdticker"] .widget-header { background: #fef0e6; border-top: 2px solid #e65100; }
[data-theme="classic"] .widget-card[data-widget="bluesky"] .widget-header { background: #e6f4ff; border-top: 2px solid #0285ff; }
[data-theme="classic"] .widget-card[data-widget="stocks"] .widget-header { background: #e6f4ea; border-top: 2px solid #137333; }
[data-theme="classic"] .widget-card[data-widget="weather"] .widget-header { background: #fef7e0; border-top: 2px solid #f29900; }
[data-theme="classic"] .widget-card[data-widget="calendar"] .widget-header { background: #f3e8fd; border-top: 2px solid #7627bb; }
[data-theme="classic"] .widget-card[data-widget="gmail"] .widget-header { background: #fce8e6; border-top: 2px solid #c5221f; }
[data-theme="classic"] .widget-card[data-widget="tabfodder"] .widget-header { background: #f3e8ff; border-top: 2px solid #7e22ce; }
[data-theme="classic"] .widget-card[data-widget="sports"] .widget-header { background: #e8f5e9; border-top: 2px solid #2e7d32; }

.widget-move-group {
  display: inline-flex;
  align-items: center;
  border-right: 1px solid var(--border-subtle);
  padding-right: 0.2rem;
  margin-right: 0.1rem;
}

.icon-btn.move-btn {
  min-width: 1.45rem;
  min-height: 1.65rem;
  font-size: 0.72rem;
}

.icon-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.widget-title-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.widget-drag-grip {
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: -1px;
}

.widget-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.widget-badge {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  background: var(--bg-card);
  flex-shrink: 0;
}

.widget-badge.is-live {
  color: var(--positive);
  border-color: color-mix(in oklab, var(--positive) 45%, transparent);
}

.widget-badge.is-mock {
  color: var(--warning);
  border-color: color-mix(in oklab, var(--warning) 45%, transparent);
}

.widget-controls {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}

.icon-btn {
  appearance: none;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: 6px;
  min-width: 1.85rem;
  min-height: 1.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--bg-row-hover);
  color: var(--text-primary);
}

.widget-body {
  padding: 0.65rem 0.75rem 0.75rem;
  font-size: 0.86rem;
}

.widget-card.is-collapsed .widget-body {
  display: none;
}

/* Shared Sub-controls inside Widgets */
.widget-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.76rem;
}

.pill-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.mini-pill {
  appearance: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
}

.mini-pill.is-active {
  background: var(--accent-blue);
  color: #071318;
  border-color: transparent;
}

[data-theme="classic"] .mini-pill.is-active {
  background: #3366cc;
  color: #ffffff;
}

.widget-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.widget-row {
  padding: 0.48rem 0.35rem;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 4px;
  transition: background-color 0.12s ease;
}

.widget-row:last-child {
  border-bottom: none;
}

.widget-row:hover {
  background: var(--bg-row-hover);
}

.row-title {
  display: block;
  font-weight: 600;
  color: var(--link-color);
  line-height: 1.32;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.18rem;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.row-summary {
  margin-top: 0.25rem;
  font-size: 0.79rem;
  color: var(--text-secondary);
  line-height: 1.38;
}

.widget-footer-link {
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* Weather Widget */
.weather-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.weather-temp-wrap {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.weather-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.weather-temp {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.weather-cond {
  font-size: 0.84rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.weather-stats {
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.weather-forecast {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.35rem;
  text-align: center;
}

.forecast-day {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.38rem 0.2rem;
  font-size: 0.74rem;
}

.forecast-day-name {
  font-weight: 700;
  color: var(--text-secondary);
}

.forecast-day-icon {
  font-size: 1.15rem;
  margin: 0.18rem 0;
}

.forecast-temps {
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.forecast-low {
  color: var(--text-muted);
}

.weather-zip-form {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
}

.weather-zip-form input {
  width: 6.2rem;
  min-block-size: 1.9rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.weather-zip-form button {
  min-block-size: 1.9rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
}

.weather-zip-hint {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* TabFodder Arcade Visual Game Buttons */
.tabfodder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.game-tile {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  text-decoration: none;
  border-inline-start: 4px solid var(--tile-accent, var(--accent-blue));
  transition: transform 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}

.game-tile:hover {
  transform: translateY(-1px);
  border-color: var(--tile-accent, var(--accent-blue));
  background: var(--bg-card-hover);
  text-decoration: none;
}

.game-tile-icon {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  background: color-mix(in oklab, var(--tile-accent, #4bb6eb) 18%, var(--bg-card));
  border: 1px solid color-mix(in oklab, var(--tile-accent, #4bb6eb) 42%, transparent);
}

.game-tile-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.game-tile-title {
  font-size: 0.81rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.game-tile-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.12rem;
}

/* Stocks & Currencies Widget */
.stock-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) auto auto auto;
  align-items: center;
  gap: 0.45rem;
}

.stock-remove-btn {
  min-width: 1.4rem;
  min-height: 1.4rem;
  font-size: 0.78rem;
  opacity: 0.55;
}

.stock-row:hover .stock-remove-btn {
  opacity: 1;
}

.stock-symbol {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.86rem;
  color: var(--link-color);
}

.stock-name {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stock-spark {
  width: 58px;
  height: 20px;
  display: block;
}

.stock-price-col {
  text-align: right;
  font-family: var(--font-mono);
}

.stock-price {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
}

.stock-delta {
  font-size: 0.73rem;
}

.quick-add-stock {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.quick-add-stock input {
  flex: 1;
  min-block-size: 2rem;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

/* Calendar Widget */
.cal-row {
  display: grid;
  grid-template-columns: 4.9rem minmax(0, 1fr);
  gap: 0.55rem;
  align-items: start;
}

.cal-time {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  padding-top: 0.1rem;
}

.cal-title {
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.cal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cal-row.is-past {
  opacity: 0.6;
}

/* Gmail Widget */
.mail-row.is-unread .mail-from,
.mail-row.is-unread .mail-subject {
  font-weight: 700;
  color: var(--text-primary);
}

.mail-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
}

.mail-from {
  color: var(--text-secondary);
}

.mail-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.mail-subject {
  display: block;
  color: var(--link-color);
  font-size: 0.84rem;
  margin-top: 0.1rem;
}

.mail-snippet {
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.1rem;
}

/* Bluesky Widget */
.bsky-text {
  color: var(--text-primary);
  font-size: 0.84rem;
  line-height: 1.38;
  white-space: pre-wrap;
  word-break: break-word;
}

.bsky-card-link {
  display: block;
  margin-top: 0.3rem;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
  font-size: 0.75rem;
  color: var(--link-color);
}

/* Footer */
.portal-footer {
  border-block-start: 1px solid var(--border-color);
  background: var(--bg-secondary);
  margin-top: auto;
}

.portal-footer-inner {
  max-width: 1460px;
  margin: 0 auto;
  padding: 0.75rem clamp(0.75rem, 2vw, 1.35rem);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Native Modal Dialogs */
.portal-dialog {
  margin: auto;
  width: min(560px, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 2rem);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  padding: 0;
  overflow: hidden;
}

.portal-dialog::backdrop {
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(3px);
}

.dialog-shell {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 2rem);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card-header);
}

.dialog-header h2 {
  font-size: 1rem;
}

.dialog-body {
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dialog-section {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}

.dialog-section legend {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0 0.35rem;
  color: var(--text-secondary);
}

.theme-picker {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

@media (min-width: 480px) {
  .theme-picker {
    grid-template-columns: 1fr 1fr;
  }
}

.theme-option {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  cursor: pointer;
  background: var(--bg-secondary);
}

.theme-option-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.82rem;
}

.theme-option-body small {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.widget-toggles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 0.45rem;
}

.widget-toggle-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  font-size: 0.82rem;
  cursor: pointer;
}

.inline-field {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.inline-field input,
.inline-field select {
  flex: 1;
  min-block-size: 2.25rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.84rem;
}

.field-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.field-hint {
  margin-top: 0.45rem;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card-header);
}

.auth-copy {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.auth-list {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.loading-state,
.empty-state {
  padding: 0.85rem 0.25rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* Visual Lead Photo Cards & Story Thumbnails */
.lead-photo-card {
  display: block;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
  margin-bottom: 0.55rem;
  text-decoration: none;
  transition: border-color 0.14s ease;
}

.lead-photo-card:hover {
  border-color: var(--border-active);
  text-decoration: none;
}

.lead-photo-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-secondary);
}

.lead-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.lead-photo-card:hover .lead-photo-img {
  transform: scale(1.03);
}

.lead-photo-body {
  padding: 0.55rem 0.65rem 0.6rem;
}

.lead-photo-title {
  display: block;
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.28;
  color: var(--link-color);
}

.story-with-thumb {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  gap: 0.6rem;
  align-items: start;
}

.story-thumb {
  width: 78px;
  height: 54px;
  border-radius: 5px;
  object-fit: cover;
  display: block;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
}

.publisher-favicon {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  vertical-align: -2px;
  flex-shrink: 0;
}

/* Bluesky Visual Avatars, Photos & Link Cards */
.bsky-author-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.28rem;
}

.bsky-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
}

.bsky-media-img {
  width: 100%;
  max-height: 210px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-top: 0.38rem;
  border: 1px solid var(--border-subtle);
  display: block;
}

.bsky-card-with-thumb {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.35rem;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
  color: var(--link-color);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.28;
}

.bsky-card-thumb {
  width: 64px;
  height: 44px;
  border-radius: 4px;
  object-fit: cover;
  display: block;
}

/* Weather Visual Sky Banner */
.weather-hero {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
}

[data-theme="classic"] .weather-hero.wx-clear {
  background: linear-gradient(135deg, #fff9db 0%, #e7f5ff 100%);
  border-color: #d0e2f8;
}

[data-theme="classic"] .weather-hero.wx-cloudy {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-color: #cbd5e1;
}

[data-theme="classic"] .weather-hero.wx-rain {
  background: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 100%);
  border-color: #93c5fd;
}

[data-theme="modern"] .weather-hero.wx-clear {
  background: linear-gradient(135deg, rgba(240, 188, 52, 0.14) 0%, rgba(75, 182, 235, 0.14) 100%);
}

[data-theme="modern"] .weather-hero.wx-cloudy {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.14) 0%, rgba(71, 85, 105, 0.16) 100%);
}

[data-theme="modern"] .weather-hero.wx-rain {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.16) 0%, rgba(30, 64, 175, 0.18) 100%);
}

/* Gmail Sender Avatars */
.mail-row-grid {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 0.55rem;
  align-items: start;
}

.mail-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  font-weight: 800;
  color: #ffffff;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* Custom Tabs & Cloud Sync Controls */
.portal-tabs-group {
  display: flex;
  align-items: flex-end;
  gap: 0.3rem;
  min-width: 0;
  overflow-x: auto;
}

.portal-tab-add {
  appearance: none;
  background: transparent;
  color: var(--link-color);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.6rem;
  margin-bottom: 0.28rem;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.portal-tab-add:hover {
  background: var(--bg-tertiary);
  border-style: solid;
}

.tabs-right-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.sync-status {
  font-size: 0.72rem;
  color: var(--positive);
  font-weight: 600;
  white-space: nowrap;
}

#tabNameInput {
  width: 100%;
  min-block-size: 2.35rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.92rem;
}

/* Sports Scores Widget */
.sports-game {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.sports-game:hover {
  text-decoration: none;
}

.sports-teams {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.sports-team-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  font-size: 0.82rem;
}

.sports-team-line.is-winner {
  font-weight: 700;
  color: var(--text-primary);
}

.sports-team-left {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  min-width: 0;
}

.sports-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
}

.sports-score {
  font-family: var(--font-mono);
  font-weight: 700;
  min-width: 1.8rem;
  text-align: right;
}

.sports-status {
  font-size: 0.71rem;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
  padding-left: 0.5rem;
  border-left: 1px solid var(--border-subtle);
}

.sports-status.is-live {
  color: var(--positive);
  font-weight: 700;
}
