:root {
  --bg: #f4f1ec;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #5c5c5c;
  --accent: #2d6a4f;
  --accent-hover: #1b4332;
  --accent-soft: #d8f3dc;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --border: #e4ded4;
  --shadow: 0 12px 40px rgba(26, 26, 26, 0.08);
  --radius: 16px;
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at top left, #d8f3dc 0%, transparent 40%),
    radial-gradient(circle at bottom right, #ffe8d6 0%, transparent 35%),
    var(--bg);
  line-height: 1.5;
}

a {
  color: var(--accent);
}

.container {
  width: min(100% - 2rem, 720px);
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.container--narrow {
  width: min(100% - 2rem, 480px);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--text);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.card + .card {
  margin-top: 1rem;
}

h1,
h2 {
  margin: 0 0 0.75rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
}

h2 {
  font-size: 1.125rem;
}

.lead {
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 24px rgba(45, 106, 79, 0.25);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  min-height: 56px;
  padding: 1rem 1.5rem;
  font-size: 1.0625rem;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
  font-size: 0.9375rem;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  background: #fff;
}

.field textarea {
  min-height: 180px;
  resize: vertical;
}

.field small {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.alert {
  padding: 0.875rem 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  font-size: 0.9375rem;
}

.alert-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.list-table {
  width: 100%;
  border-collapse: collapse;
}

.list-table th,
.list-table td {
  text-align: left;
  padding: 0.875rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.list-table th {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.list-cards {
  display: none;
}

.list-card {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.list-card:last-child {
  border-bottom: none;
}

.list-card h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.list-card p {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.875rem;
  word-break: break-all;
}

.list-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.inline-form {
  display: inline;
}

.randomizer {
  text-align: center;
  padding: 2rem 1.5rem;
}

.randomizer-title {
  margin-bottom: 0.5rem;
}

.randomizer-subtitle {
  color: var(--muted);
  margin: 0 0 2rem;
}

.result-box {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 1.5rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #f8faf8 0%, #eef5f0 100%);
  border: 1px dashed var(--border);
}

.result-text {
  margin: 0;
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  font-weight: 700;
  line-height: 1.3;
  transition: opacity 0.2s ease;
}

.result-text.is-spinning {
  opacity: 0.45;
}

.result-placeholder {
  margin: 0;
  color: var(--muted);
}

.footer-note {
  margin-top: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
}

@media (max-width: 640px) {
  .list-table {
    display: none;
  }

  .list-cards {
    display: block;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (min-width: 641px) {
  .card {
    padding: 2rem;
  }
}
