:root {
  --bg: #071018;
  --surface: rgba(11, 26, 35, 0.68);
  --surface-solid: #0c2230;
  --text: #eff7ff;
  --muted: #94b3c8;
  --primary: #20d9a4;
  --secondary: #ff9543;
  --ring-track: rgba(130, 157, 175, 0.25);
  --card-border: rgba(169, 198, 214, 0.22);
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(130% 150% at 10% 20%, #153348 0%, #0b1c29 42%, #070f18 100%);
  color: var(--text);
  font-family: 'Sora', sans-serif;
}

body {
  overflow-x: hidden;
}

.bg-layer {
  position: fixed;
  pointer-events: none;
  inset: -15%;
  z-index: 0;
}

.bg-layer-a {
  background:
    radial-gradient(circle at 16% 20%, rgba(32, 217, 164, 0.16), transparent 34%),
    radial-gradient(circle at 88% 30%, rgba(255, 149, 67, 0.2), transparent 30%),
    radial-gradient(circle at 60% 88%, rgba(80, 145, 255, 0.14), transparent 28%);
  animation: driftA 16s ease-in-out infinite alternate;
}

.bg-layer-b {
  background-image: linear-gradient(120deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px), linear-gradient(0deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 90px 90px;
  mix-blend-mode: soft-light;
  opacity: 0.35;
  animation: driftB 20s linear infinite;
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1024px;
  margin: 0 auto;
  padding: 36px 20px 60px;
}

.hero {
  animation: riseIn 500ms ease-out both;
}

.kicker {
  margin: 0;
  font-family: 'Syne', sans-serif;
  letter-spacing: 0.2em;
  color: #7ddfc5;
  font-size: 0.73rem;
}

h1 {
  margin: 10px 0 8px;
  font-family: 'Syne', sans-serif;
  font-size: clamp(1.9rem, 5vw, 3.2rem);
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 740px;
}

.panel {
  margin-top: 28px;
  border: 1px solid var(--card-border);
  background: var(--surface);
  backdrop-filter: blur(12px);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.panel-main {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 28px;
  padding: 24px;
  animation: riseIn 650ms ease-out both;
}

.gauge-wrap {
  display: grid;
  place-items: center;
  min-height: 340px;
}

.gauge {
  --value: 0;
  --glow: 0.22;
  width: min(75vw, 360px);
  aspect-ratio: 1;
  border-radius: 999px;
  background: conic-gradient(from -90deg, var(--primary) calc(var(--value) * 1%), var(--secondary) calc(var(--value) * 1% + 8%), var(--ring-track) calc(var(--value) * 1% + 8%));
  display: grid;
  place-items: center;
  box-shadow: 0 0 40px rgba(32, 217, 164, var(--glow)), inset 0 0 30px rgba(255, 255, 255, 0.06);
  transition: box-shadow 200ms ease;
}

.gauge-inner {
  width: calc(100% - 24px);
  height: calc(100% - 24px);
  border-radius: inherit;
  background: linear-gradient(160deg, rgba(12, 30, 43, 0.98), rgba(8, 21, 30, 0.98));
  border: 1px solid rgba(145, 195, 218, 0.22);
  display: grid;
  place-content: center;
  text-align: center;
}

.gauge-label {
  margin: 0;
  color: #8ec6b3;
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gauge-value {
  margin: 9px 0 3px;
  font-size: clamp(2rem, 6vw, 3.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.gauge-unit {
  margin: 0;
  color: #8eb2c7;
}

.controls {
  align-self: center;
  display: grid;
  gap: 10px;
}

label {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8db0c4;
}

input {
  width: 100%;
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid rgba(173, 206, 227, 0.3);
  background: rgba(6, 20, 30, 0.72);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

select {
  width: 100%;
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid rgba(173, 206, 227, 0.3);
  background: rgba(6, 20, 30, 0.72);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

input:focus {
  border-color: rgba(32, 217, 164, 0.78);
  box-shadow: 0 0 0 4px rgba(32, 217, 164, 0.18);
}

select:focus {
  border-color: rgba(32, 217, 164, 0.78);
  box-shadow: 0 0 0 4px rgba(32, 217, 164, 0.18);
}

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(90deg, var(--primary), #27ebbe);
  color: #052015;
}

.btn-ghost {
  background: rgba(148, 179, 200, 0.16);
  color: #d5e8f5;
}

.btn-secondary {
  background: linear-gradient(95deg, #ff9543, #ffb16e);
  color: #2a1203;
}

.status {
  margin: 8px 0 0;
  color: var(--muted);
  min-height: 2.5em;
}

.metrics-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  animation: riseIn 760ms ease-out both;
}

.metric-card {
  background: linear-gradient(160deg, rgba(9, 24, 35, 0.9), rgba(12, 32, 45, 0.85));
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 14px;
}

.metric-label {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #90afc1;
}

.metric-value {
  margin: 12px 0 4px;
  font-size: clamp(1.2rem, 3.5vw, 1.8rem);
  font-weight: 700;
}

.metric-unit {
  font-size: 0.84rem;
  color: #95b7ca;
}

.panel-history {
  margin-top: 18px;
  padding: 18px;
  animation: riseIn 860ms ease-out both;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

h2 {
  margin: 0;
  font-family: 'Syne', sans-serif;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
}

.history-note {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.history-empty {
  border: 1px dashed rgba(173, 206, 227, 0.36);
  border-radius: 14px;
  padding: 14px;
  color: #9ebccd;
}

.history-item {
  display: grid;
  grid-template-columns: 1.2fr repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(169, 198, 214, 0.2);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(9, 24, 35, 0.9), rgba(12, 32, 45, 0.85));
}

.history-item .name {
  font-weight: 600;
}

.history-item .stamp {
  display: block;
  margin-top: 4px;
  color: #8aafc4;
  font-size: 0.8rem;
}

.history-item .cell {
  color: #d7ebf8;
  text-align: right;
  font-weight: 600;
}

.history-item .cell span {
  color: #8eb2c7;
  font-size: 0.8rem;
  margin-left: 3px;
}

@media (max-width: 900px) {
  .panel-main {
    grid-template-columns: 1fr;
  }

  .gauge-wrap {
    min-height: 280px;
  }

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

  .history-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .history-item .cell {
    text-align: left;
  }
}

@media (max-width: 540px) {
  .app-shell {
    padding: 26px 14px 36px;
  }

  .button-row {
    flex-direction: column;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

@keyframes driftA {
  from {
    transform: translate3d(-1.2%, -0.8%, 0) rotate(-1deg);
  }
  to {
    transform: translate3d(1.2%, 1.6%, 0) rotate(1deg);
  }
}

@keyframes driftB {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(90px, 0, 0);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-features {
  display: flex;
  gap: 20px;
  margin-top: 16px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--muted);
  animation: riseIn 600ms ease-out both;
}

.hero-features span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-features i {
  color: var(--primary);
}

.panel-share {
  text-align: center;
  animation: riseIn 960ms ease-out both;
}

.panel-share h2 {
  margin-bottom: 12px;
}

.panel-share p {
  margin: 0 0 18px;
  color: var(--muted);
}

.social-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms ease;
  text-decoration: none;
}

.social-btn i {
  font-size: 1.1rem;
}

.social-btn.twitter {
  background: #1DA1F2;
  color: white;
}

.social-btn.twitter:hover {
  background: #1a91da;
  transform: translateY(-2px);
}

.social-btn.facebook {
  background: #1877F2;
  color: white;
}

.social-btn.facebook:hover {
  background: #0a66c2;
  transform: translateY(-2px);
}

.social-btn.linkedin {
  background: #0A66C2;
  color: white;
}

.social-btn.linkedin:hover {
  background: #095195;
  transform: translateY(-2px);
}

.social-btn.copy {
  background: var(--primary);
  color: #052015;
}

.social-btn.copy:hover {
  background: #27ebbe;
  transform: translateY(-2px);
}

.copy-feedback {
  position: fixed;
  bottom: 30px;
  right: 30px;
  padding: 14px 18px;
  background: var(--primary);
  color: #052015;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 1000;
  animation: slideIn 300ms ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
