:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #191c22;
  --panel-2: #232730;
  --line: #343a45;
  --text: #f7f4ee;
  --muted: #aeb5c2;
  --green: #4bd6a3;
  --amber: #f0b85a;
  --red: #ff6b5f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(75, 214, 163, 0.18), transparent 32%),
    radial-gradient(circle at 90% 10%, rgba(240, 184, 90, 0.14), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

button,
select,
textarea {
  font: inherit;
}

.app {
  width: min(100vw, calc(100dvh * 9 / 16));
  height: min(100dvh, calc(100vw * 16 / 9));
  aspect-ratio: 9 / 16;
  overflow-y: auto;
  padding: 16px clamp(12px, 4vw, 18px) 28px;
  background: rgba(16, 17, 20, 0.94);
}

.hero {
  min-height: 164px;
  padding: 18px;
  border: 1px solid rgba(75, 214, 163, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 17, 21, 0.72), rgba(15, 17, 21, 0.96)),
    url("https://images.unsplash.com/photo-1514888286974-6c03e2ca1dba?auto=format&fit=crop&w=1000&q=80");
  background-size: cover;
  background-position: center;
}

.hero p,
.hero span {
  margin: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.hero h1 {
  margin: 8px 0;
  font-size: 30px;
  line-height: 1.12;
}

.alert,
.card,
.result,
.form,
.panel label {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(25, 28, 34, 0.94);
}

.alert {
  margin-top: 12px;
  padding: 13px;
  border-color: rgba(255, 107, 95, 0.45);
}

.alert h2,
.section-head h2,
.card h3 {
  margin: 0;
  font-size: 18px;
}

.alert p,
.card p,
.result,
.panel label {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 12px 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 17, 20, 0.96);
}

.tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.tabs button.active {
  background: rgba(75, 214, 163, 0.14);
  color: var(--green);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 10px;
}

.section-head span {
  color: var(--muted);
  font-size: 12px;
}

.form,
.card {
  padding: 13px;
  margin-bottom: 10px;
}

.panel label {
  display: block;
  margin-bottom: 10px;
  padding: 11px;
  font-weight: 700;
}

select,
textarea {
  width: 100%;
  margin-top: 7px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: var(--panel-2);
  color: var(--text);
  resize: vertical;
}

.primary,
.card button {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: var(--green);
  color: #071313;
  font-weight: 900;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.button-row button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  font-weight: 900;
}

.button-row .primary {
  border: 0;
  background: var(--green);
  color: #071313;
}

button:disabled {
  opacity: 0.45;
}

audio {
  width: 100%;
  margin-top: 8px;
}

.auto-note {
  grid-column: 1 / -1;
  padding: 11px;
  border: 1px solid rgba(75, 214, 163, 0.34);
  border-radius: 7px;
  background: rgba(75, 214, 163, 0.1);
  color: #d9fff0;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.card button {
  margin-top: 10px;
}

.result {
  margin: 10px 0;
  padding: 13px;
  white-space: pre-wrap;
}

.result.danger {
  border-color: rgba(255, 107, 95, 0.65);
  color: #ffd8d4;
}

.result.warning {
  border-color: rgba(240, 184, 90, 0.6);
  color: #ffe4b7;
}

.result.safe {
  border-color: rgba(75, 214, 163, 0.55);
  color: #d9fff0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.84);
  color: white;
  font-size: 13px;
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 760px) {
  .app {
    width: min(100vw, calc(100dvh * 16 / 9));
    height: min(100dvh, calc(100vw * 9 / 16));
    aspect-ratio: 16 / 9;
    padding: 18px 28px 30px;
  }

  .panel.active {
    max-width: 980px;
    margin: 0 auto;
  }

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

  .form label,
  .form .primary {
    margin-bottom: 0;
  }

  .form label:last-of-type,
  .form .primary {
    grid-column: 1 / -1;
  }
}
