:root {
  --rly-pro-bg: #050609;
  --rly-pro-panel: rgba(16, 18, 24, 0.74);
  --rly-pro-panel-strong: rgba(22, 24, 31, 0.9);
  --rly-pro-line: rgba(255, 255, 255, 0.085);
  --rly-pro-line-strong: rgba(255, 255, 255, 0.15);
  --rly-pro-text-soft: rgba(255, 255, 255, 0.56);
  --rly-pro-cyan: #86f0ff;
  --rly-pro-blue: #5aa8ff;
  --rly-pro-violet: #b99cff;
  --rly-pro-green: #89e6b6;
  --rly-pro-amber: var(--rly-pro-cyan);
}

body {
  background-color: var(--rly-pro-bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.032), transparent 240px);
  background-size: 88px 88px, 88px 88px, 100% 100%;
}

body::before,
body::after {
  opacity: 0;
}

.rail {
  background: rgba(5, 6, 9, 0.82);
  border-right-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.025);
}

.rail-btn {
  background: transparent;
  color: rgba(255, 255, 255, 0.58);
  box-shadow: none;
}

.rail-btn:hover {
  background: rgba(255, 255, 255, 0.075);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.rail-btn.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.105);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.rail-btn.active::before {
  background: var(--rly-pro-cyan);
  box-shadow: 0 0 8px rgba(134, 240, 255, 0.28);
}

.rail .avatar {
  background: linear-gradient(135deg, #5568ff, #8a6cff);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.page-heading .eyebrow-label,
.eyebrow,
.badge,
.meta-stat .label,
.rly-table th,
.cell-mono,
.delete-btn,
.compare-bar .info,
.hmc-meta,
.hmc-sub-pill {
  letter-spacing: 0.06em;
}

.page-heading h1 {
  letter-spacing: -0.025em;
}

.tile,
.meta-stats,
.history-card,
.hmc-card {
  background: var(--rly-pro-panel);
  box-shadow:
    inset 0 0 0 1px var(--rly-pro-line),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 28px rgba(0, 0, 0, 0.20);
}

.tile {
  border-radius: 10px;
}

.meta-stats {
  border-radius: 16px;
}

.meta-stat + .meta-stat::before {
  background: rgba(255, 255, 255, 0.075);
}

.meta-stat .label {
  color: rgba(255, 255, 255, 0.46);
}

.meta-stat .value {
  color: #f7f8fb;
}

.btn,
.rly-input,
.rly-select,
.delete-btn {
  background: rgba(255, 255, 255, 0.052);
  box-shadow: inset 0 0 0 1px var(--rly-pro-line);
}

.btn:hover,
.delete-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  box-shadow: inset 0 0 0 1px var(--rly-pro-line-strong);
}

.btn.amber {
  background: linear-gradient(180deg, #93f1ff, #63c5f2);
  color: #041315;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    0 10px 24px rgba(46, 151, 255, 0.16);
}

.btn.amber:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.44),
    0 12px 28px rgba(46, 151, 255, 0.18);
}

.rly-input:focus {
  box-shadow:
    inset 0 0 0 1px rgba(125, 219, 208, 0.52),
    0 0 0 3px rgba(125, 219, 208, 0.12);
}

.rly-select {
  background-color: rgba(255, 255, 255, 0.052);
}

.history-table th {
  background: rgba(12, 14, 19, 0.92);
}

.rly-table th {
  color: rgba(255, 255, 255, 0.43);
}

.rly-table tbody tr {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.rly-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.045);
}

.history-table th.sort-active {
  color: var(--rly-pro-cyan);
}

.history-table.compare-mode tbody tr.selected {
  background: rgba(125, 219, 208, 0.085);
  box-shadow: inset 3px 0 0 var(--rly-pro-cyan);
}

.compare-bar {
  background: rgba(125, 219, 208, 0.095);
  border-color: rgba(125, 219, 208, 0.26);
}

.compare-bar .pulse-dot {
  background: var(--rly-pro-cyan);
  box-shadow: 0 0 8px rgba(134, 240, 255, 0.30);
}

.sbi-track {
  background: rgba(255, 255, 255, 0.075);
}

.sbi-item-hook {
  --bar: var(--rly-pro-cyan);
}

.sbi-item-story {
  --bar: var(--rly-pro-blue);
}

.sbi-item-visual {
  --bar: var(--rly-pro-violet);
}

.sbi-item-hook .sbi-grade {
  color: var(--rly-pro-cyan);
}

.sbi-item-story .sbi-grade {
  color: var(--rly-pro-blue);
}

.sbi-item-visual .sbi-grade {
  color: var(--rly-pro-violet);
}

.grade-badge {
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.11);
}

.grade-a {
  background: rgba(137, 230, 182, 0.14);
  color: #ccf9df;
  box-shadow: inset 0 0 0 1px rgba(137, 230, 182, 0.28);
}

.grade-b {
  background: rgba(125, 219, 208, 0.14);
  color: #c9fffa;
  box-shadow: inset 0 0 0 1px rgba(125, 219, 208, 0.28);
}

.grade-c {
  background: rgba(134, 240, 255, 0.10);
  color: #d6f8ff;
  box-shadow: inset 0 0 0 1px rgba(134, 240, 255, 0.20);
}

.grade-d,
.grade-f {
  background: rgba(255, 111, 111, 0.13);
  color: #ffc7c7;
  box-shadow: inset 0 0 0 1px rgba(255, 111, 111, 0.26);
}

.hmc-card {
  border-radius: 16px;
}

mark {
  background: rgba(125, 219, 208, 0.18) !important;
  color: #d3fffb !important;
}

@media (max-width: 760px) {
  body {
    background-size: 64px 64px, 64px 64px, 100% 100%;
  }

  .main {
    padding: 16px 14px calc(112px + env(safe-area-inset-bottom, 0px));
    gap: 14px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .page-heading h1 {
    font-size: 30px;
    line-height: 1.1;
    letter-spacing: 0;
  }

  .top-actions {
    width: 100%;
    margin-left: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .btn,
  .btn.amber,
  .compare-bar > .btn {
    width: 100%;
    min-height: 46px;
    justify-content: center;
  }

  .meta-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
    border-radius: 12px;
  }

  .meta-stat {
    min-width: 0;
    padding: 14px 12px;
  }

  .meta-stat + .meta-stat::before {
    display: none;
  }

  .meta-stat .value {
    font-size: 22px;
    letter-spacing: 0;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .rly-input,
  .rly-select {
    width: 100%;
    min-height: 48px;
    font-size: 16px;
  }

  .compare-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .history-mobile-cards {
    gap: 10px;
  }

  .hmc-card {
    border-radius: 12px;
  }

  .hmc-title {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 430px) {
  .meta-stats {
    grid-template-columns: 1fr;
  }
}
