:root {
  --bg: #07111f;
  --bg-deep: #040812;

  --text: #f4f7fb;
  --muted: #aeb8c8;

  --gold: #d8b45f;
  --gold-soft: rgba(216, 180, 95, 0.16);

  --cyan: #6ed6ff;
  --cyan-soft: rgba(110, 214, 255, 0.18);

  --green: #7ee787;
  --green-soft: rgba(126, 231, 135, 0.16);

  --panel: rgba(255, 255, 255, 0.07);
  --panel-strong: rgba(255, 255, 255, 0.105);
  --border: rgba(255, 255, 255, 0.14);
}

/* =========================================================
   Base
========================================================= */

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg-deep);
}

body {
  margin: 0;
  min-height: 100vh;

  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);

  background:
    radial-gradient(circle at 16% 8%, rgba(110, 214, 255, 0.18), transparent 30%),
    radial-gradient(circle at 86% 10%, rgba(216, 180, 95, 0.14), transparent 28%),
    radial-gradient(circle at 50% 92%, rgba(126, 231, 135, 0.08), transparent 34%),
    linear-gradient(145deg, #050913 0%, var(--bg) 58%, #0d1828 100%);
}

.app {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

/* =========================================================
   Hero
========================================================= */

.hero {
  padding: 18px 0 22px;
}

.label {
  margin: 0 0 8px;

  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  margin: 0;

  font-size: clamp(34px, 6vw, 64px);
  line-height: 1;
  letter-spacing: 0.05em;
}

.lead {
  max-width: 720px;
  margin: 14px 0 0;

  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

/* =========================================================
   Summary Cards
========================================================= */

.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;

  margin-top: 18px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 22px;

  background: var(--panel);
  backdrop-filter: blur(16px);

  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.25);
}

.metric {
  padding: 16px 18px;
}

.metric__title {
  margin: 0 0 8px;

  color: var(--muted);
  font-size: 12px;
}

.metric__value {
  margin: 0;

  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.metric__note {
  margin: 8px 0 0;

  color: var(--green);
  font-size: 12px;
}

/* =========================================================
   Section
========================================================= */

.section {
  margin-top: 18px;
  padding: 18px;
}

.section h2 {
  margin: 0 0 14px;

  font-size: 18px;
  letter-spacing: 0.06em;
}

/* =========================================================
   Stars List
========================================================= */

.site-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  align-items: start;
}

.site {
  position: relative;
  overflow: hidden;

  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;

  min-height: 132px;
  padding: 12px 14px 13px;

  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;

  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.055)),
    rgba(255, 255, 255, 0.07);

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 14px 34px rgba(0, 0, 0, 0.22);

  cursor: pointer;

  transition:
    transform 0.55s ease,
    opacity 0.55s ease,
    background 0.55s ease,
    box-shadow 0.55s ease,
    border-color 0.55s ease;
}

.site::before {
  content: "";
  position: absolute;
  inset: 0;

  background:
    radial-gradient(circle at 16% 18%, rgba(110, 214, 255, 0.18), transparent 30%),
    radial-gradient(circle at 88% 70%, rgba(216, 180, 95, 0.1), transparent 28%);

  opacity: 0;
  pointer-events: none;

  transition: opacity 0.55s ease;
}

.site:hover {
  transform: translateY(-2px);
  border-color: rgba(110, 214, 255, 0.34);
}

.site__name {
  position: relative;
  z-index: 1;

  margin: 0;
  overflow: hidden;

  color: rgba(244, 247, 251, 0.96);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: 0.02em;

  white-space: nowrap;
  text-overflow: ellipsis;
}

.site__main-number {
  position: relative;
  z-index: 1;

  display: flex;
  align-items: center;
  justify-content: center;

  min-height: 50px;
}

.site__daily {
  position: relative;
  z-index: 1;

  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;

  margin: 0;

  color: rgba(244, 247, 251, 0.78);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}

.site__daily-today {
  color: var(--gold);
}

.site__daily-yesterday {
  color: rgba(174, 184, 200, 0.76);
}

.site__daily-sep {
  color: rgba(174, 184, 200, 0.52);
  font-weight: 600;
}

.site__daily-label {
  margin-right: 2px;

  color: rgba(174, 184, 200, 0.62);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.site__url,
.score,
.site__numbers {
  display: none;
}

/* =========================================================
   Numbers
========================================================= */

.pill {
  position: relative;
  z-index: 1;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;

  color: #06101c;
  background: linear-gradient(135deg, #7ce0ff, var(--cyan));

  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;

  box-shadow:
    0 0 18px rgba(110, 214, 255, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.pill--now {
  min-width: 64px;
  height: 54px;
  padding: 0 18px;

  font-size: 30px;

  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.22);
}

.pill--today,
.pill--gold {
  display: none;
}

/* =========================================================
   Realtime Pages
========================================================= */

.site--expanded {
  grid-template-rows: auto auto auto auto;
  border-color: rgba(110, 214, 255, 0.42);
  background:
    linear-gradient(135deg, rgba(110, 214, 255, 0.11), rgba(216, 180, 95, 0.06)),
    rgba(255, 255, 255, 0.085);
}

.site--expanded::before {
  opacity: 0.8;
}

.site__pages {
  position: relative;
  z-index: 1;

  margin-top: 8px;
  padding-top: 10px;

  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.site__pages-title {
  margin: 0 0 8px;

  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.site__pages-list {
  display: grid;
  gap: 6px;
}

.site__page {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;

  margin: 0;
  padding: 7px 8px;

  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.site__page-title {
  overflow: hidden;

  color: rgba(244, 247, 251, 0.86);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;

  white-space: nowrap;
  text-overflow: ellipsis;
}

.site__page-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: 24px;
  height: 24px;

  border-radius: 999px;
  color: #06101c;
  background: var(--gold);

  font-size: 12px;
  font-weight: 900;
}

.site__pages-empty {
  margin: 0;

  color: rgba(174, 184, 200, 0.76);
  font-size: 12px;
  line-height: 1.5;
}

/* =========================================================
   Daily State
========================================================= */

.site--daily-up {
  border-color: rgba(126, 231, 135, 0.44);

  background:
    linear-gradient(135deg, rgba(126, 231, 135, 0.16), rgba(110, 214, 255, 0.08)),
    rgba(255, 255, 255, 0.09);

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 26px rgba(126, 231, 135, 0.14),
    0 16px 38px rgba(0, 0, 0, 0.24);
}

.site--daily-up::before {
  opacity: 0.8;
}

.site--daily-up .site__daily-today {
  color: var(--green);
  text-shadow: 0 0 14px rgba(126, 231, 135, 0.28);
}

.site--daily-down {
  border-color: rgba(216, 180, 95, 0.2);
}

.site--daily-down .site__daily-today {
  color: var(--gold);
}

/* =========================================================
   Motion: current increase / decrease
========================================================= */

.site--up {
  animation: sitePulseUp 1.5s ease both;
}

.site--down {
  animation: sitePulseDown 1.35s ease both;
}

.site--up::before,
.site--down::before {
  opacity: 1;
}

.site--up .pill--now {
  animation: numberPopUp 1.15s ease both;
}

.site--down .pill--now {
  animation: numberDropDown 1.1s ease both;
}

/* =========================================================
   Footer
========================================================= */

.footer {
  margin-top: 22px;

  color: rgba(255, 255, 255, 0.42);
  font-size: 12px;
  text-align: center;
}

/* =========================================================
   Keyframes
========================================================= */

@keyframes sitePulseUp {
  0% {
    transform: translateY(0) scale(1);
    border-color: rgba(255, 255, 255, 0.1);
  }

  34% {
    transform: translateY(-5px) scale(1.025);
    border-color: rgba(126, 231, 135, 0.66);
    background:
      linear-gradient(135deg, rgba(126, 231, 135, 0.2), rgba(110, 214, 255, 0.1)),
      rgba(255, 255, 255, 0.1);
    box-shadow:
      0 0 30px rgba(126, 231, 135, 0.28),
      0 18px 44px rgba(0, 0, 0, 0.28);
  }

  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes sitePulseDown {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }

  34% {
    transform: translateY(4px) scale(0.975);
    border-color: rgba(216, 180, 95, 0.54);
    background:
      linear-gradient(135deg, rgba(216, 180, 95, 0.14), rgba(255, 255, 255, 0.055)),
      rgba(255, 255, 255, 0.055);
    opacity: 0.76;
    box-shadow:
      0 0 20px rgba(216, 180, 95, 0.18),
      0 10px 24px rgba(0, 0, 0, 0.2);
  }

  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes numberPopUp {
  0% {
    transform: scale(1);
    background: linear-gradient(135deg, #7ce0ff, var(--cyan));
  }

  34% {
    transform: scale(1.26);
    background: linear-gradient(135deg, #a6ffbd, var(--green));
    box-shadow:
      0 0 30px rgba(126, 231, 135, 0.42),
      inset 0 1px 0 rgba(255, 255, 255, 0.42);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes numberDropDown {
  0% {
    transform: scale(1);
  }

  34% {
    transform: scale(0.82);
    background: linear-gradient(135deg, #f1d487, var(--gold));
    box-shadow:
      0 0 22px rgba(216, 180, 95, 0.32),
      inset 0 1px 0 rgba(255, 255, 255, 0.34);
  }

  100% {
    transform: scale(1);
  }
}

/* =========================================================
   Responsive
========================================================= */

@media (max-width: 720px) {
  .app {
    width: min(100% - 20px, 1120px);
    padding-top: 22px;
  }

  .hero {
    padding-top: 14px;
  }

  .lead {
    font-size: 13px;
  }

  .summary {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .section {
    padding: 14px;
  }

  .site-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .site {
    min-height: 142px;
    padding: 12px;
    border-radius: 16px;
  }

  .site__name {
    display: -webkit-box;
    min-height: 2.7em;

    overflow: hidden;
    white-space: normal;

    font-size: 13px;

    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .site__main-number {
    min-height: 48px;
  }

  .pill--now {
    min-width: 60px;
    height: 50px;
    font-size: 28px;
  }

  .site__daily {
    font-size: 12px;
  }

  .site__page-title {
    white-space: normal;
  }
}

@media (max-width: 420px) {
  .site-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site {
    border-radius: 14px;
  }
}

/* =========================================================
   Welina OS Tool Navigation
========================================================= */

.tool-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.tool-nav__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.055);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: border-color 0.25s ease, color 0.25s ease, background 0.25s ease;
}

.tool-nav__link:hover,
.tool-nav__link[aria-current="page"] {
  border-color: rgba(110, 214, 255, 0.44);
  color: var(--text);
  background: rgba(110, 214, 255, 0.1);
}

/* =========================================================
   Ranking
========================================================= */

.rank-list {
  display: grid;
  gap: 10px;
}

.rank-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
}

.rank-row__site,
.rank-row__keyword,
.rank-row__url,
.rank-row__note {
  margin: 0;
}

.rank-row__site {
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.rank-row__keyword {
  margin-top: 5px;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
}

.rank-row__url,
.rank-row__note {
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.rank-row__numbers {
  display: grid;
  justify-items: end;
  gap: 6px;
  min-width: 90px;
}

.rank-position {
  color: var(--cyan);
  font-size: 28px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.rank-change {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.rank-change--up { color: var(--green); }
.rank-change--down { color: var(--gold); }

.empty-state {
  margin: 0;
  padding: 24px 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
  text-align: center;
}

@media (max-width: 720px) {
  .tool-nav { margin-bottom: 12px; }
  .rank-row { grid-template-columns: minmax(0, 1fr) 76px; padding: 12px; }
  .rank-position { font-size: 24px; }
}

/* =========================================================
   Observation Keyword Registry
========================================================= */

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin: 4px 0 0;
}

.section-label,
.section-count {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.keyword-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field__label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field select,
.field input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;

  border: 1px solid var(--border);
  border-radius: 12px;

  color: var(--text);
  background: rgba(255, 255, 255, 0.055);

  font: inherit;
}

.field select:focus,
.field input:focus {
  outline: none;
  border-color: rgba(110, 214, 255, 0.6);
}

.field select option {
  color: #111827;
  background: #ffffff;
}

.button,
.keyword-delete {
  border: 1px solid rgba(110, 214, 255, 0.38);
  border-radius: 12px;

  color: var(--text);
  background: rgba(110, 214, 255, 0.1);

  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.button {
  min-height: 46px;
  padding: 0 18px;
}

.button:disabled,
.keyword-delete:disabled {
  opacity: 0.5;
  cursor: wait;
}

.form-message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

.keyword-site {
  padding: 17px;

  border: 1px solid var(--border);
  border-radius: 14px;

  background: rgba(255, 255, 255, 0.035);
}

.keyword-site__title {
  margin: 0;
  font-size: 16px;
}

.keyword-site__property {
  margin: 5px 0 14px;
  color: var(--muted);
  font-size: 11px;
  word-break: break-all;
}

.keyword-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.keyword-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;

  min-height: 42px;
  padding: 8px 10px 8px 13px;

  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
}

.keyword-row__name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.keyword-delete {
  flex: 0 0 auto;
  padding: 7px 11px;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 720px) {
  .section-heading {
    align-items: flex-end;
  }

  .keyword-form {
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.refresh-button {
  min-height: 36px;
  padding: 0 13px;

  border: 1px solid rgba(110, 214, 255, 0.38);
  border-radius: 999px;

  color: var(--text);
  background: rgba(110, 214, 255, 0.1);

  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.refresh-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

@media (max-width: 720px) {
  .section-actions {
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
  }
}
