:root {
  --bg: #08131a;
  --bg-2: #0d1c26;
  --panel: rgba(12, 28, 39, 0.84);
  --panel-strong: rgba(11, 25, 34, 0.96);
  --panel-2: #132a38;
  --panel-3: #183544;
  --text: #edf7fb;
  --muted: #a7bfca;
  --accent: #22c7a8;
  --accent-strong: #0f766e;
  --accent-soft: rgba(34, 199, 168, 0.14);
  --border: rgba(255, 255, 255, 0.09);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
  --radius: 24px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(34, 199, 168, 0.08), transparent 30%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  min-height: 100vh;
}

button, input, select { font: inherit; }

.bg-orb {
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.45;
}

.bg-orb-1 {
  top: -100px;
  left: -70px;
  background: rgba(34, 199, 168, 0.2);
}

.bg-orb-2 {
  right: -70px;
  bottom: -80px;
  background: rgba(23, 120, 220, 0.16);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1200px, calc(100% - 24px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  margin-bottom: 18px;
}

.hero-copy { max-width: 820px; }
.eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: #83efd2;
  font-size: 0.78rem;
  font-weight: 700;
}

h1, h2 { margin: 0; }
h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.02;
  margin-bottom: 12px;
}

h2 { font-size: 1.25rem; }

.intro {
  max-width: 720px;
  color: var(--muted);
  margin: 0;
  line-height: 1.65;
  font-size: 1.02rem;
}

.hero-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.info-pill,
.ratio-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-weight: 700;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.72fr);
  gap: 18px;
}

.controls-panel,
.result-panel,
.favourites-panel,
.ad-panel {
  padding: 22px;
}

.result-panel {
  position: sticky;
  top: 18px;
  align-self: start;
}

.ad-panel--top {
  margin-bottom: 18px;
}

.ad-panel--sidebar {
  align-self: start;
}

.favourites-panel {
  grid-column: 1 / -1;
}

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

.compact-heading { align-items: center; }
.section-kicker {
  margin: 0 0 6px;
  color: #83efd2;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.75rem;
  font-weight: 700;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field-group {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 16px;
}

.field-span-2 { grid-column: 1 / -1; }

label {
  display: block;
  font-weight: 700;
  margin-bottom: 10px;
}

select,
input {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  background: var(--panel-2);
  color: var(--text);
  padding: 15px 16px;
  outline: none;
}

select:focus,
input:focus,
button:focus-visible {
  border-color: rgba(34, 199, 168, 0.8);
  box-shadow: 0 0 0 4px rgba(34, 199, 168, 0.16);
}

.hint {
  color: var(--muted);
  margin: 10px 0 0;
  font-size: 0.93rem;
  line-height: 1.45;
}

.inline-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.inline-input span {
  background: var(--panel-2);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 15px 16px;
  border-radius: 16px;
  min-width: 82px;
  text-align: center;
  font-weight: 700;
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

button {
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  padding: 13px 17px;
  transition: transform .12s ease, opacity .12s ease, box-shadow .12s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.16);
}

.primary-btn {
  background: linear-gradient(180deg, #34ddb7 0%, var(--accent) 100%);
  color: #04201b;
  font-weight: 800;
}

.secondary-btn {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.12);
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
  border: 1px dashed rgba(255,255,255,0.18);
}

.hidden { display: none !important; }

.ratio-badge {
  background: linear-gradient(180deg, rgba(34, 199, 168, 0.18), rgba(34, 199, 168, 0.08));
  color: #bffaea;
}

.result-card {
  background: linear-gradient(180deg, rgba(34, 199, 168, 0.18), rgba(34, 199, 168, 0.06));
  border: 1px solid rgba(34, 199, 168, 0.22);
  border-radius: 22px;
  padding: 24px;
  margin-bottom: 16px;
}

.result-label {
  margin: 0 0 10px;
  color: #9ff4de;
  font-weight: 700;
}

.result-main {
  margin: 0;
  font-size: clamp(2.6rem, 5vw, 4.4rem);
  font-weight: 800;
  line-height: 1;
}

.result-sub {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-item {
  background: rgba(255,255,255,0.045);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 15px;
}

.summary-item-highlight {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
}

.summary-item span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 7px;
}

.summary-item strong { font-size: 1.1rem; }

.note-box {
  background: rgba(255,255,255,0.05);
  border-radius: 18px;
  padding: 16px;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,0.06);
}

.note-box p { margin: 0; line-height: 1.5; }

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

.empty-state {
  color: var(--muted);
  padding: 10px 0;
}

.favourite-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  background: rgba(255,255,255,0.045);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 15px;
}

.favourite-item strong {
  display: block;
  margin-bottom: 4px;
}

.favourite-meta {
  color: var(--muted);
  font-size: 0.93rem;
}

.favourite-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.favourite-actions button { padding: 10px 12px; }

@media (max-width: 980px) {
  .app-grid {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }

  .ad-panel--sidebar {
    order: 4;
  }
}

@media (max-width: 720px) {
  .hero {
    flex-direction: column;
  }

  .controls-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .field-span-2 {
    grid-column: auto;
  }

  .hero-actions,
  .action-row,
  .favourite-actions {
    width: 100%;
  }

  .hero-actions > button,
  .action-row > button,
  .favourite-actions > button {
    flex: 1 1 0;
  }

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


.ad-panel {
  overflow: hidden;
}

.ad-panel-inner {
  display: grid;
  gap: 14px;
}

.ad-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ad-panel-copy {
  color: var(--muted);
  margin: 0;
  line-height: 1.55;
}

.ad-size-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.ad-box {
  border-radius: 22px;
  border: 1px dashed rgba(255,255,255,0.16);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  overflow: hidden;
}

.ad-box--top {
  min-height: 140px;
}

.ad-box--sidebar {
  min-height: 280px;
}

.ad-fallback-inner {
  min-height: inherit;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  padding: 24px;
}

.ad-kicker {
  margin: 0;
  color: #83efd2;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.74rem;
  font-weight: 800;
}

.ad-fallback-inner h3 {
  margin: 0;
  font-size: 1.25rem;
}

.ad-fallback-inner p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

body.standalone-app [data-ads-website-only="true"] .ad-panel {
  display: none !important;
}

body[data-ads-enabled="false"] .ad-panel {
  display: none !important;
}

@media (max-width: 640px) {
  .hero { padding: 22px; }
  .ad-panel-header { flex-direction: column; }
  .ad-size-pill { white-space: normal; }
  .ad-box--top { min-height: 110px; }
  .ad-box--sidebar { min-height: 220px; }
}
