:root {
  color-scheme: dark;
  --bg: #0a0a0a;
  --panel: #111111;
  --panel-hover: #1a1a1a;
  --border: #222222;
  --text: #e5e5e5;
  --text-muted: #888888;
  --text-strong: #ffffff;
  --accent: #60a5fa;
  --success: #22c55e;
  --font: ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Mono", monospace;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f3eee5;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-hover: #ffffff;
  --border: rgba(89, 76, 58, 0.14);
  --text: #26201b;
  --text-muted: #7c7266;
  --text-strong: #26201b;
  --accent: #2563eb;
  --success: #16a34a;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  transition: background-color 160ms ease, color 160ms ease;
}

button, a { font: inherit; }

.page {
  width: min(100% - 32px, 720px);
  margin: 0 auto;
  padding: clamp(40px, 10vh, 96px) 0 32px;
}

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.eyebrow, h1, .subtitle { margin: 0; }
.eyebrow { margin-bottom: 12px; color: var(--success); font-size: 12px; }
h1 { color: var(--text-strong); font-size: clamp(24px, 6vw, 36px); line-height: 1.1; letter-spacing: -0.04em; }
.subtitle { max-width: 560px; margin-top: 10px; color: var(--text-muted); font-size: 13px; line-height: 1.6; }

.theme-toggle {
  flex: 0 0 auto;
  min-width: 62px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
}
.theme-toggle:hover { background: var(--panel-hover); color: var(--text); }
.theme-toggle:focus-visible, .link-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.links-panel {
  margin-top: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.panel-header h2 { margin: 0; color: var(--text-strong); font-size: 13px; font-weight: 500; }
.status { display: inline-flex; align-items: center; gap: 7px; color: var(--text-muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px color-mix(in srgb, var(--success) 65%, transparent); }

.links { display: grid; }
.loading, .error { margin: 0; padding: 22px 16px; color: var(--text-muted); font-size: 12px; }
.error { color: #ef4444; }

.link-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: background-color 120ms ease;
}
.link-card:last-child { border-bottom: 0; }
.link-card:hover { background: var(--panel-hover); }
.link-card:hover .link-title { text-decoration: underline; text-underline-offset: 3px; }
.link-card:hover .arrow { color: var(--accent); }
.link-meta { display: flex; align-items: center; gap: 18px; min-width: 0; }
.permissions { flex: 0 0 auto; color: var(--text-muted); font-size: 10px; }
.link-copy { display: grid; gap: 4px; min-width: 0; }
.link-title { overflow: hidden; color: var(--accent); font-size: 14px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.link-description { overflow: hidden; color: var(--text-muted); font-size: 11px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.arrow { flex: 0 0 auto; color: var(--text-muted); font-size: 13px; }

footer { display: flex; gap: 10px; margin-top: 18px; color: var(--text-muted); font-size: 10px; }

@media (max-width: 520px) {
  .page { width: min(100% - 24px, 720px); padding-top: 36px; }
  .header { gap: 14px; }
  .permissions { display: none; }
  .link-card { min-height: 68px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
