/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #f0f4f8;
  color: #1a202c;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

/* ── App shell ────────────────────────────────────────────────────────────── */
.app-header {
  width: 100%;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 56px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.app-header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: #2d3748;
  letter-spacing: -0.3px;
}

.app-header .logo-flag {
  font-size: 22px;
}

.app-header .logo-badge {
  background: #4f46e5;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.3px;
}

/* ── Main layout ──────────────────────────────────────────────────────────── */
.app-main {
  width: 100%;
  max-width: 680px;
  padding: 32px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  padding: 28px 28px 24px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #718096;
  margin-bottom: 16px;
}

/* ── Input group ──────────────────────────────────────────────────────────── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.input-group label {
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
}

.input-group input,
.input-group select {
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 15px;
  color: #2d3748;
  background: #f7fafc;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.input-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23718096' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.input-group input:focus,
.input-group select:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
  background: #ffffff;
}

/* ── Controls row ─────────────────────────────────────────────────────────── */
.controls-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

/* ── Translate button ─────────────────────────────────────────────────────── */
#translate-button {
  width: 100%;
  height: 48px;
  background: #4f46e5;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(79,70,229,0.3);
}

#translate-button:hover {
  background: #4338ca;
  box-shadow: 0 4px 12px rgba(79,70,229,0.4);
}

#translate-button:active {
  transform: scale(0.98);
}

/* ── Message ──────────────────────────────────────────────────────────────── */
#message {
  font-size: 14px;
  color: #e53e3e;
  text-align: center;
  min-height: 20px;
  padding: 0 4px;
  margin-top: 8px;
}

/* ── Result card ──────────────────────────────────────────────────────────── */
#result-card {
  display: none;
}

#result-card.visible {
  display: block;
}

.lemma-display {
  text-align: center;
  margin-bottom: 24px;
}

.lemma-display .lemma-russian {
  font-size: 36px;
  font-weight: 700;
  color: #2d3748;
  letter-spacing: -0.5px;
}

.lemma-display .lemma-case-label {
  font-size: 13px;
  color: #a0aec0;
  margin-top: 4px;
  font-weight: 500;
}

/* ── Declension table ─────────────────────────────────────────────────────── */
.declension-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.declension-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #718096;
  border-bottom: 2px solid #e2e8f0;
}

.declension-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #f0f4f8;
  color: #2d3748;
}

.declension-table tr:last-child td {
  border-bottom: none;
}

.declension-table tr.highlighted td {
  background: #eef2ff;
  font-weight: 600;
  color: #4338ca;
}

.declension-table td:first-child {
  color: #718096;
  font-weight: 600;
  font-size: 13px;
  width: 140px;
}

.declension-table tr:hover td {
  background: #f7f8ff;
}

.declension-table tr.highlighted:hover td {
  background: #e8edff;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
.app-footer {
  margin-top: auto;
  padding: 16px;
  font-size: 12px;
  color: #a0aec0;
  text-align: center;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .card {
    padding: 20px 16px;
    border-radius: 12px;
  }

  .lemma-display .lemma-russian {
    font-size: 28px;
  }

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