:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #171717;
  --muted: #667085;
  --border: #e7eaf1;
  --primary: #5b4ce6;
  --primary-hover: #4d3fdb;
  --soft: #f7f8ff;
  --danger-text: #c81e1e;
  --danger-bg: #fff4f4;
  --shadow: 0 16px 40px rgba(16, 24, 40, 0.06);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 40px;
}

.hero {
  margin-bottom: 24px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: 56px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.hero p {
  margin: 0;
  font-size: 20px;
  color: var(--muted);
  font-weight: 500;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

label {
  display: block;
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
}

textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
  font: inherit;
  background: #fff;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 18px;
}

textarea:focus,
select:focus {
  border-color: rgba(91, 76, 230, 0.5);
  box-shadow: 0 0 0 4px rgba(91, 76, 230, 0.08);
}

textarea.lg {
  min-height: 170px;
  resize: vertical;
}

textarea.md {
  min-height: 150px;
  resize: vertical;
}

.row.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.sliders {
  margin: 8px 0 22px;
}

.slider-group {
  margin-bottom: 16px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 600;
}

input[type="range"] {
  width: 100%;
}

.main-btn,
.actions button {
  font: inherit;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease, background 0.2s ease;
}

.main-btn:active,
.actions button:active {
  transform: scale(0.98);
}

.main-btn {
  width: 100%;
  padding: 16px 20px;
  border-radius: 16px;
  background: var(--primary);
  color: white;
  font-size: 18px;
  font-weight: 700;
}

.main-btn:hover {
  background: var(--primary-hover);
}

.main-btn:disabled {
  opacity: 0.72;
  cursor: default;
}

.result-head h2 {
  margin: 0 0 18px;
  font-size: 24px;
  font-weight: 800;
}

.analysis-box,
.error-box {
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.analysis-box {
  background: #f8fafc;
  border: 1px solid #edf2f7;
}

.error-box {
  background: #fff6ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  margin-top: 16px;
}

.meta-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.result-box {
  min-height: 260px;
  border-radius: 18px;
  background: var(--soft);
  padding: 20px;
  font-size: 18px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.tone-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 8px;
  font-weight: 600;
}

.tone-bar {
  flex: 1;
  height: 10px;
  background: #e9edf3;
  border-radius: 999px;
  overflow: hidden;
}

#toneFill {
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, #18a957 0%, #f59e0b 55%, #ef4444 100%);
}

.warning-row {
  min-height: 26px;
  margin-bottom: 10px;
}

.danger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  color: var(--danger-text);
  cursor: help;
  background: var(--danger-bg);
  border: 1px solid #ffd9d9;
  border-radius: 999px;
  width: 34px;
  height: 34px;
}

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

.actions button {
  padding: 11px 14px;
  border-radius: 14px;
  background: #eef2ff;
  color: #2d2f36;
  font-weight: 600;
}

.actions button:hover {
  background: #e4e9ff;
}

.hidden {
  display: none !important;
}

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

  .hero h1 {
    font-size: 42px;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 18px 14px 28px;
  }

  .card {
    padding: 20px;
  }

  .row.two {
    grid-template-columns: 1fr;
  }

  .hero p {
    font-size: 17px;
  }
}
