:root {
  --bg-main: #f6f8f2;
  --ink: #122620;
  --ink-soft: #34534a;
  --panel: #ffffffd9;
  --line: #bfd4c8;
  --accent: #007f73;
  --accent-strong: #005f56;
  --warn: #c74f00;
  --shadow: 0 16px 38px rgba(18, 38, 32, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(100% 70% at 20% 10%, #ffe6cf 0%, transparent 60%),
    radial-gradient(90% 80% at 100% 0%, #d8f3dc 0%, transparent 60%),
    var(--bg-main);
  overflow-x: hidden;
}

body.entry-gated {
  overflow: hidden;
}

.bg-shape {
  position: fixed;
  z-index: -1;
  filter: blur(0.7px);
}

.shape-a {
  width: 380px;
  height: 380px;
  border-radius: 54% 46% 56% 44%;
  background: #ffd7b5;
  top: -100px;
  right: -70px;
  opacity: 0.55;
}

.shape-b {
  width: 240px;
  height: 240px;
  border-radius: 43% 57% 62% 38%;
  background: #a9dfbf;
  bottom: -80px;
  left: -50px;
  opacity: 0.7;
}

.app-shell {
  width: min(1100px, 94vw);
  margin: 2rem auto 3rem;
  display: grid;
  gap: 1rem;
}

.hero {
  background: linear-gradient(120deg, #e6f5ef, #ffe9d6 55%, #ecfaf0);
  border: 1px solid #dce8e0;
  border-radius: 22px;
  padding: 1.6rem;
  box-shadow: var(--shadow);
  animation: slideIn 500ms ease-out;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.hero h1 {
  margin: 0.4rem 0 0.3rem;
  font-family: "Archivo Black", "Trebuchet MS", sans-serif;
  line-height: 1.05;
  font-size: clamp(1.5rem, 2.6vw, 2.4rem);
}

.subtitle {
  margin: 0;
  color: #35584e;
}

.panel {
  background: var(--panel);
  border: 1px solid #d7e5db;
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1rem 1.15rem;
  animation: fadeUp 420ms ease both;
}

.panel h2 {
  margin: 0 0 0.8rem;
  font-size: 1.1rem;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.panel-btn-row {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.connection-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.code-box {
  margin: 0;
  border: 1px dashed #7fb2a0;
  border-radius: 12px;
  background: #f1faf5;
  padding: 0.62rem 0.75rem;
  min-width: 220px;
  font-family: "Archivo Black", "Trebuchet MS", sans-serif;
  letter-spacing: 0.06em;
  color: #115040;
}

.row {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

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

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 500;
  color: var(--ink);
}

input[type="text"],
input[type="password"],
input[type="time"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.58rem 0.62rem;
  font: inherit;
  color: var(--ink);
  background: #ffffff;
}

textarea {
  resize: vertical;
  min-height: 120px;
  font-size: 0.86rem;
  background: #f7fcf9;
}

input[type="range"] {
  accent-color: var(--accent);
}

.hint {
  font-size: 0.86rem;
  color: #4d6a61;
}

.switch-row {
  background: #f2f8f4;
  border: 1px solid #d8e8dd;
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.switch-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.quiet-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  background: #f8fbf9;
}

.quiet-wrap p {
  margin: 0 0 0.35rem;
  font-weight: 600;
}

.quiet-times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.rule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.rule-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fcfa;
  padding: 0.7rem;
}

.rule-card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.guardian-list {
  display: grid;
  gap: 0.7rem;
}

.guardian-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fcfa;
  padding: 0.75rem;
  display: grid;
  gap: 0.55rem;
}

.guardian-row {
  display: grid;
  grid-template-columns: 1.5fr 1.5fr 1fr auto;
  gap: 0.5rem;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.direct-alerts {
  display: grid;
  gap: 0.55rem;
}

.direct-alert-item {
  border: 1px solid #d6e5dd;
  border-radius: 12px;
  background: #f8fcfa;
  padding: 0.62rem 0.7rem;
}

.direct-alert-item strong {
  display: block;
  color: #15493c;
}

.direct-alert-item small {
  display: block;
  color: #4f6f64;
}

.app-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  background: #f9fcfa;
  display: grid;
  gap: 0.55rem;
}

.app-card h3 {
  margin: 0;
  font-size: 0.98rem;
}

.summary-panel {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
}

#summaryText {
  margin: 0.1rem 0 0;
  color: #234c40;
  max-width: 60ch;
}

.simulate-box {
  width: min(320px, 100%);
  display: grid;
  gap: 0.6rem;
}

.btn {
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  padding: 0.62rem 0.82rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease;
}

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

.btn.danger {
  background: var(--warn);
}

.btn.danger:hover {
  background: #a84402;
}

.btn.light {
  background: #d8ece1;
  color: var(--ink);
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background: #173d34;
  color: #fff;
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.entry-gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(17, 32, 28, 0.58);
  backdrop-filter: blur(10px);
}

.entry-gate-card {
  width: min(580px, 100%);
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(242, 250, 246, 0.97));
  box-shadow: 0 22px 42px rgba(18, 38, 32, 0.22);
  padding: 1.2rem;
}

.entry-gate-kicker {
  margin: 0 0 0.35rem;
  letter-spacing: 0.1em;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.entry-gate-card h2 {
  margin: 0;
  font-family: "Archivo Black", "Trebuchet MS", sans-serif;
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  line-height: 1.05;
}

.entry-gate-copy {
  margin: 0.55rem 0 1rem;
  color: #35584e;
}

.entry-gate-code-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  border: 1px solid #d7e5db;
  border-radius: 16px;
  padding: 0.8rem;
  background: #f7fcf9;
}

.entry-gate-label {
  margin: 0 0 0.3rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.entry-gate-code {
  border: 1px dashed #7fb2a0;
  border-radius: 12px;
  background: #f1faf5;
  padding: 0.62rem 0.75rem;
  min-width: 220px;
  font-family: "Archivo Black", "Trebuchet MS", sans-serif;
  letter-spacing: 0.06em;
  color: #115040;
}

.entry-gate-form {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.entry-gate-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.entry-gate-status {
  margin: 0.85rem 0 0;
  border-radius: 12px;
  padding: 0.72rem 0.82rem;
  border: 1px solid #d7e5db;
  background: #f8fcfa;
}

.entry-gate-status.ok {
  border-color: #9ad1b5;
  background: #eefaf3;
  color: #13583c;
}

.entry-gate-status.warn {
  border-color: #ecc18d;
  background: #fff6eb;
  color: #995a18;
}

.entry-gate-status.error {
  border-color: #e0a6a0;
  background: #fff1ef;
  color: #b7362f;
}

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

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

@media (max-width: 900px) {
  .two-col,
  .three-col,
  .rule-grid,
  .apps-grid,
  .guardian-row {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    flex-direction: column;
  }
}
