:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --radius-lg: 0.75rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 0 1rem;
}

.site-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
}

.header-controls select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  background: #fff;
}

.main-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr;
  gap: 1rem;
  margin-top: 1rem;
  margin-bottom: 2rem;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(229, 231, 235, 0.7);
  border-radius: var(--radius-lg);
  padding: 1rem 1.2rem 1.4rem;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.04);
}

.input-panel textarea {
  width: 100%;
  resize: vertical;
  padding: 0.6rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.4rem;
  background: #f9fafb;
  font-family: inherit;
  min-height: 220px;
  transition: border 0.15s ease;
}

.input-panel textarea:focus {
  outline: none;
  border: 1px solid var(--primary);
  background: #fff;
}

.input-actions {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
  flex-wrap: wrap;
}

button,
.button-like {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.45rem 0.8rem;
  border-radius: 0.4rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

button:hover,
.button-like:hover {
  background: var(--primary-dark);
}

.button-like {
  display: inline-block;
}

.privacy-note {
  font-size: 0.8rem;
  color: var(--muted);
}

.hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.warning {
  background: rgba(249, 115, 22, 0.12);
  border: 1px solid rgba(249, 115, 22, 0.5);
  padding: 0.5rem;
  border-radius: 0.4rem;
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
  margin-top: 0.5rem;
}

.options-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.85rem;
}

.options-grid input[type="text"],
.options-grid input[type="number"],
.options-grid select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  background: #fff;
}

.primary-button {
  margin-top: 0.4rem;
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.stat {
  background: #f9fafb;
  border: 1px solid #edf0f3;
  border-radius: 0.4rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
}

.table-block {
  margin-bottom: 1.2rem;
}

.table-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.table-controls {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.table-controls input,
.table-controls select {
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  font-size: 0.8rem;
  background: #fff;
}

.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
  font-size: 0.82rem;
  border: 1px solid var(--border);
}

.data-table thead {
  background: #eef2ff;
}

.data-table th,
.data-table td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.4rem;
  text-align: left;
}

.data-table tbody tr:nth-child(even) {
  background: #f9fafb;
}

.pagination {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}

.pagination button {
  padding: 0.25rem 0.5rem;
}

#phrase-frequency-section {
  margin-top: 1.25rem;
  border-top: 1px solid #e5e7eb;
  padding-top: 1rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 1rem 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

/* responsive */
@media (max-width: 900px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }
  .options-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .options-grid {
    grid-template-columns: 1fr;
  }
  .table-title-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .table-controls {
    width: 100%;
  }
  .table-controls input,
  .table-controls select {
    width: 100%;
  }
}

.footer-content {
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  line-height: 1.4;
}

.footer-content a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.footer-content a:hover {
  text-decoration: underline;
}

.donation-link {
  margin-top: 0.6rem;
}

