:root {
  --bg: #1a1614;
  --bg-elevated: #241f1c;
  --surface: #2c2622;
  --border: #3d342e;
  --text: #f2ebe3;
  --text-muted: #a89888;
  --accent: #e8a04a;
  --accent-hover: #f0b45e;
  --accent-pressed: #c9842e;
  --rust: #c45c3a;
  --danger: #e07060;
  --focus: #e8a04a;
  --radius: 14px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  --tap: 52px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  color: var(--text);
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, #3a2a1e 0%, transparent 55%),
    var(--bg);
}

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.25rem 1.1rem 2.5rem;
  padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
}

.header {
  margin-bottom: 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.brand-mark {
  color: var(--accent);
  font-size: 1.35rem;
  line-height: 1;
}

.header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.4rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.banner {
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
}

.banner-error {
  background: rgba(224, 112, 96, 0.15);
  border: 1px solid rgba(224, 112, 96, 0.45);
  color: #ffc4ba;
}

.textarea {
  width: 100%;
  min-height: 220px;
  padding: 1rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  resize: vertical;
  box-shadow: var(--shadow);
  -webkit-appearance: none;
  appearance: none;
}

.textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
}

.textarea:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-color: var(--accent);
}

.meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0 0.15rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.rate-value {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 700;
}

.select {
  width: 100%;
  min-height: var(--tap);
  padding: 0.65rem 2.5rem 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23e8a04a' d='M1 1l5 5 5-5'/%3E%3C/svg%3E")
    no-repeat right 1rem center;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.select:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.range {
  width: 100%;
  height: 44px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: -0.35rem;
}

.controls {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 0.65rem;
  margin-top: 0.35rem;
}

.btn {
  min-height: var(--tap);
  padding: 0.75rem 1rem;
  border: none;
  border-radius: var(--radius);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

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

.btn-primary {
  background: var(--accent);
  color: #1a1208;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:active:not(:disabled) {
  background: var(--accent-pressed);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: #36302b;
  border-color: #52483f;
}

.footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.footer p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 480px) {
  .textarea {
    min-height: 280px;
  }

  .header h1 {
    font-size: 2rem;
  }
}

.hint {
  margin: 1rem 0 0;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
