:root {
  --bg: #e9eff8;
  --surface: rgba(255, 255, 255, 0.68);
  --surface-strong: rgba(255, 255, 255, 0.82);
  --surface-soft: rgba(255, 255, 255, 0.58);
  --text: #1b2b55;
  --text-soft: #66779f;
  --primary: #3767f6;
  --primary-soft: rgba(55, 103, 246, 0.12);
  --border: rgba(125, 145, 190, 0.22);
  --shadow: 0 10px 30px rgba(40, 70, 140, 0.08);

  --success: #18a76f;
  --success-bg: #e7f8ef;
  --success-border: #b8ead1;

  --warning: #d08a00;
  --warning-bg: #fff5df;
  --warning-border: #f1d18a;

  --danger: #d14545;
  --danger-bg: #fdeaea;
  --danger-border: #efb4b4;

  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;

  --container: 1280px;
  --topbar-height: 96px;
}

body[data-theme="dark"] {
  --bg: #0f172b;
  --surface: rgba(18, 28, 52, 0.82);
  --surface-strong: rgba(19, 31, 58, 0.92);
  --surface-soft: rgba(20, 32, 59, 0.72);
  --text: #edf3ff;
  --text-soft: #9fb1d3;
  --primary: #7ea0ff;
  --primary-soft: rgba(126, 160, 255, 0.16);
  --border: rgba(136, 157, 206, 0.2);
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.28);

  --success: #43d39e;
  --success-bg: rgba(67, 211, 158, 0.12);
  --success-border: rgba(67, 211, 158, 0.3);

  --warning: #ffbd59;
  --warning-bg: rgba(255, 189, 89, 0.12);
  --warning-border: rgba(255, 189, 89, 0.28);

  --danger: #ff8b8b;
  --danger-bg: rgba(255, 139, 139, 0.12);
  --danger-border: rgba(255, 139, 139, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.7), transparent 28%),
    linear-gradient(180deg, #edf3fb 0%, var(--bg) 100%);
  color: var(--text);
  min-height: 100vh;
  padding-top: calc(var(--topbar-height) + 16px);
}

body[data-theme="dark"] {
  background:
    radial-gradient(circle at top left, rgba(126, 160, 255, 0.08), transparent 28%),
    linear-gradient(180deg, #0b1325 0%, var(--bg) 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  width: min(var(--container), calc(100% - 32px));
  margin: 16px auto 28px;
}

.app-topbar {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: min(var(--container), calc(100% - 32px));
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface-strong);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #4e7bff, #2f58e8);
  color: #fff;
  font-weight: 800;
  font-size: 1.35rem;
  box-shadow: 0 10px 20px rgba(55, 103, 246, 0.24);
  flex: 0 0 auto;
}

.brand-text {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.top-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
}

.top-nav a {
  padding: 12px 18px;
  border-radius: 16px;
  color: var(--text);
  font-weight: 700;
  transition: 0.2s ease;
  white-space: nowrap;
}

.top-nav a:hover,
.top-nav a[aria-current="page"] {
  background: var(--primary-soft);
  color: var(--primary);
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 18px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  background: var(--surface-strong);
}

.btn-secondary {
  min-width: 96px;
}

.page-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
}

.card,
.page-hero,
.stat-card,
.project-card,
.tool-card,
.task-item {
  border: 1px solid var(--border);
  background: var(--surface-strong);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.card {
  padding: 20px;
  border-radius: var(--radius-xl);
  min-width: 0;
}

.wide {
  grid-column: span 12;
}

.page-hero {
  grid-column: span 12;
  border-radius: var(--radius-xl);
  padding: 18px 22px;
  min-height: 150px;
  display: flex;
  align-items: center;
}

.project-detail-hero {
  min-height: 160px;
}

.project-title-only {
  min-height: 120px;
}

.project-title-only .eyebrow,
.project-title-only .subtitle {
  display: none;
}

.project-title-only h1 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary);
}

.page-hero h1,
.card h2,
.card h3 {
  margin: 0;
  letter-spacing: -0.03em;
}

.page-hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
  font-weight: 800;
  color: #1e3a8a;
}

.subtitle {
  margin: 12px 0 0;
  color: var(--text-soft);
  font-size: 1.3rem;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head h3 {
  font-size: 1.15rem;
  font-weight: 850;
}

.filters-bar {
  grid-column: span 12;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.filters-bar input,
.filters-bar select {
  width: 100%;
  height: 48px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.32);
  color: var(--text);
  padding: 0 16px;
  outline: none;
}

body[data-theme="dark"] .filters-bar input,
body[data-theme="dark"] .filters-bar select {
  background: rgba(255, 255, 255, 0.03);
}

.filters-bar input::placeholder {
  color: var(--text-soft);
}

.stats-grid {
  grid-column: span 12;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.stat-card {
  padding: 20px;
  border-radius: var(--radius-xl);
}

.stat-card .label {
  color: var(--text-soft);
  font-weight: 700;
  margin-bottom: 10px;
}

.stat-card .value {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.card-grid,
.tools-grid {
  grid-column: span 12;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.project-card,
.tool-card {
  padding: 18px;
  border-radius: var(--radius-lg);
}

.project-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.project-card h4,
.tool-card h4 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.project-card-title {
  color: #1e40af;
}

.project-card p,
.tool-item p,
.task-content p,
.empty,
.activity-row span,
.summary-row span {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.65;
}

.project-links,
.link-group,
.task-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.project-links {
  margin-top: 14px;
}

.chip-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(55, 103, 246, 0.18);
  background: rgba(55, 103, 246, 0.08);
  color: var(--primary);
  font-weight: 800;
  transition: 0.2s ease;
}

.chip-link:hover {
  transform: translateY(-1px);
  background: rgba(55, 103, 246, 0.14);
}

.chip-daily {
  color: #0f9f6e;
  border-color: rgba(15, 159, 110, 0.22);
  background: rgba(15, 159, 110, 0.08);
}

.chip-daily:hover {
  background: rgba(15, 159, 110, 0.14);
}

.chip-faucet {
  color: #c57a00;
  border-color: rgba(197, 122, 0, 0.22);
  background: rgba(197, 122, 0, 0.08);
}

.chip-faucet:hover {
  background: rgba(197, 122, 0, 0.14);
}

.chip-open {
  color: #4f46e5;
  border-color: rgba(79, 70, 229, 0.22);
  background: rgba(79, 70, 229, 0.08);
}

.chip-open:hover {
  background: rgba(79, 70, 229, 0.14);
}

.empty {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px dashed var(--border);
  background: var(--surface-soft);
}

.summary-row,
.activity-row {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px dashed var(--border);
}

.summary-row:last-child,
.activity-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.project-name {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 900;
  border: 1px solid var(--project-border, var(--border));
  background: var(--project-bg, rgba(55, 103, 246, 0.08));
  color: var(--project-text, var(--primary));
}

.detail-grid > .card:not(.wide) {
  grid-column: span 12;
}

.detail-info-grid {
  grid-column: span 12;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.detail-info-card {
  height: 100%;
  min-width: 0;
}

.detail-info-card .section-head {
  margin-bottom: 14px;
}

.detail-info-card .link-group,
.detail-info-card .notes-list {
  align-content: flex-start;
}

.notes-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-soft);
}

.notes-list li {
  margin-bottom: 10px;
  line-height: 1.65;
}

.detail-info-card .notes-list li:last-child {
  margin-bottom: 0;
}

.meta-list {
  display: grid;
  gap: 0;
}

.meta-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px dashed var(--border);
}

.meta-row:last-child {
  border-bottom: 0;
}

.meta-label {
  color: var(--text-soft);
}

.meta-value {
  font-weight: 800;
}

.task-list {
  display: grid;
  gap: 14px;
}

.task-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 16px;
  padding: 18px;
  border-radius: var(--radius-lg);
}

.task-item.done {
  border-color: var(--success-border);
  background: linear-gradient(180deg, var(--surface-strong), var(--success-bg));
}

.task-checkbox {
  width: 22px;
  height: 22px;
  margin-top: 4px;
  accent-color: var(--primary);
  cursor: pointer;
}

.task-content h4 {
  margin: 0 0 8px;
  font-size: 1.12rem;
  font-weight: 850;
}

.task-meta {
  display: grid;
  justify-items: end;
  gap: 10px;
  min-width: 190px;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 800;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text-soft);
}

.tag.type {
  background: rgba(55, 103, 246, 0.08);
  color: var(--primary);
  border-color: rgba(55, 103, 246, 0.18);
}

.tag.daily {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}

.task-time {
  font-size: 0.95rem;
  color: var(--text-soft);
  text-align: right;
}

.tool-item + .tool-item {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

.dashboard-section,
.testnet-section,
.tools-section {
  grid-column: span 12;
}

.topbar-theme-btn {
  white-space: nowrap;
}

@media (max-width: 1024px) {
  :root {
    --topbar-height: 132px;
  }

  .app-topbar {
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
  }

  .brand {
    justify-content: flex-start;
  }

  .top-nav {
    justify-content: center;
  }

  .topbar-actions {
    justify-content: flex-end;
  }

  .card-grid,
  .tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-info-grid {
    grid-template-columns: 1fr;
  }

  .filters-bar {
    grid-template-columns: 1fr;
  }

  .summary-row,
  .activity-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .task-item {
    grid-template-columns: auto 1fr;
  }

  .task-meta {
    grid-column: 2;
    justify-items: start;
    min-width: 0;
  }

  .task-time {
    text-align: left;
  }
}

@media (max-width: 720px) {
  :root {
    --topbar-height: 78px;
  }

  body {
    padding-top: calc(var(--topbar-height) + 10px);
  }

  .shell {
    width: min(var(--container), calc(100% - 16px));
    margin: 8px auto 16px;
  }

  .app-topbar {
    top: 6px;
    width: calc(100% - 12px);
    padding: 8px 10px;
    border-radius: 16px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
  }

  .brand {
    gap: 0;
    justify-content: flex-start;
  }

  .brand-text {
    display: none;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 1.1rem;
  }

  .top-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    overflow: hidden;
  }

  .top-nav a {
    width: auto;
    padding: 6px 8px;
    border-radius: 10px;
    font-size: 0.84rem;
    line-height: 1.1;
    flex: 0 0 auto;
    text-align: center;
  }

  .topbar-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
  }

  .btn {
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 0.84rem;
    line-height: 1.1;
    min-width: auto;
    white-space: nowrap;
  }

  .btn-secondary {
    min-width: auto;
  }

  .page-hero {
    padding: 12px 14px;
    min-height: 82px;
    border-radius: 20px;
  }

  .project-title-only {
    min-height: 82px;
  }

  .page-hero h1 {
    font-size: 1.4rem;
    line-height: 1.2;
  }

  .project-title-only h1 {
    font-size: 1rem;
  }

  .subtitle {
    margin-top: 8px;
    font-size: 0.9rem;
    line-height: 1.45;
  }

  .eyebrow {
    margin-bottom: 6px;
    font-size: 0.78rem;
    letter-spacing: 0.14em;
  }

  .card,
  .project-card,
  .tool-card,
  .task-item,
  .stat-card {
    padding: 12px;
    border-radius: 18px;
  }

  .card-grid,
  .tools-grid,
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .filters-bar {
    padding: 12px;
    gap: 10px;
    border-radius: 18px;
  }

  .filters-bar input,
  .filters-bar select {
    height: 42px;
    padding: 0 14px;
    border-radius: 14px;
    font-size: 0.92rem;
  }

  .section-head h3,
  .card h2,
  .card h3 {
    font-size: 1rem;
  }

  .stat-card .value {
    font-size: 1.45rem;
  }

  .stat-card .label {
    font-size: 0.9rem;
  }

  .task-list {
    gap: 10px;
  }

  .task-item {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .task-content h4 {
    font-size: 1rem;
  }

  .task-content p,
  .task-time,
  .tag {
    font-size: 0.88rem;
  }

  .task-checkbox {
    margin-top: 0;
  }

  .task-meta {
    grid-column: auto;
    gap: 8px;
  }

  .project-name {
    min-height: 28px;
    padding: 4px 10px;
    font-size: 0.82rem;
  }

  .summary-row,
  .activity-row {
    padding: 10px 0;
    gap: 6px;
  }
}

@media (max-width: 560px) {
  :root {
    --topbar-height: 72px;
  }

  body {
    padding-top: calc(var(--topbar-height) + 8px);
  }

  .app-topbar {
    padding: 7px 9px;
    gap: 6px;
    border-radius: 14px;
    grid-template-columns: auto 1fr auto;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 1rem;
    border-radius: 11px;
  }

  .top-nav {
    gap: 2px;
  }

  .top-nav a {
    padding: 5px 7px;
    font-size: 0.8rem;
    border-radius: 9px;
  }

  .btn {
    padding: 5px 8px;
    font-size: 0.8rem;
    border-radius: 10px;
  }

  .project-title-only h1 {
    font-size: 0.9rem;
  }

  .page-hero {
    min-height: 76px;
    padding: 10px 12px;
  }

  .filters-bar input,
  .filters-bar select {
    height: 40px;
    font-size: 0.88rem;
  }
}