* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #1a1208;
  color: #e8d5a3;
  font-family: Georgia, serif;
  min-height: 100vh;
}

header {
  text-align: center;
  padding: 40px 20px 20px;
  border-bottom: 1px solid #5a3e1b;
}

h1 {
  font-size: 3rem;
  color: #f0c060;
  letter-spacing: 6px;
  text-transform: uppercase;
  margin-bottom: 20px;
}

nav {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.tab-btn {
  background: transparent;
  border: 1px solid #5a3e1b;
  color: #e8d5a3;
  padding: 8px 24px;
  font-family: Georgia, serif;
  font-size: 0.95rem;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.tab-btn:hover {
  background: #5a3e1b;
  color: #f0c060;
}

.tab-btn.active {
  background: #5a3e1b;
  color: #f0c060;
  border-color: #f0c060;
}

main {
  max-width: 860px;
  margin: 40px auto;
  padding: 0 20px;
}

.tab {
  display: none;
}

.tab.active {
  display: block;
}

h2 {
  font-size: 1.8rem;
  color: #f0c060;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 24px;
  padding-bottom: 10px;
  border-bottom: 1px solid #5a3e1b;
}

/* --- Form --- */
.add-word-form {
  background: #2a1f0e;
  border: 1px solid #5a3e1b;
  padding: 20px;
  margin-bottom: 30px;
}

.form-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

input, select {
  background: #1a1208;
  border: 1px solid #5a3e1b;
  color: #e8d5a3;
  padding: 10px 14px;
  font-family: Georgia, serif;
  font-size: 0.9rem;
  flex: 1;
  min-width: 140px;
}

input::placeholder {
  color: #7a6040;
}

input:focus, select:focus {
  outline: none;
  border-color: #f0c060;
}

select option {
  background: #1a1208;
}

button {
  background: #5a3e1b;
  border: 1px solid #f0c060;
  color: #f0c060;
  padding: 10px 24px;
  font-family: Georgia, serif;
  font-size: 0.9rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s ease;
}

button:hover {
  background: #f0c060;
  color: #1a1208;
}

/* --- IPA Helper --- */
.ipa-helper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.ipa-label {
  color: #7a6040;
  font-size: 0.8rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.ipa-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ipa-btn {
  background: #1a1208;
  border: 1px solid #5a3e1b;
  color: #e8d5a3;
  padding: 4px 8px;
  font-size: 0.85rem;
  cursor: pointer;
  letter-spacing: 0;
  transition: all 0.2s;
  min-width: unset;
}

.ipa-btn:hover {
  border-color: #f0c060;
  color: #f0c060;
  background: #1a1208;
}

/* --- Definitions --- */
#definitions-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.definition-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.definition-row select {
  flex: 0 0 120px;
  min-width: unset;
}

.definition-row .input-definition {
  flex: 2;
}

.definition-row .input-notes {
  flex: 1;
  min-width: 120px;
}

.remove-def-btn {
  background: transparent;
  border: 1px solid #5a3e1b;
  color: #7a6040;
  padding: 8px 12px;
  font-size: 0.8rem;
  flex: 0 0 auto;
  min-width: unset;
}

.remove-def-btn:hover {
  background: #5a3e1b;
  color: #e8d5a3;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

#add-def-btn {
  background: transparent;
  border-color: #5a3e1b;
  color: #7a6040;
  font-size: 0.85rem;
  padding: 8px 16px;
}

#add-def-btn:hover {
  background: #5a3e1b;
  color: #e8d5a3;
}

/* --- Search --- */
#search-input {
  width: 100%;
  margin-bottom: 24px;
}

/* --- Word Cards --- */
#word-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.word-card {
  background: #2a1f0e;
  border: 1px solid #5a3e1b;
  padding: 22px 26px;
  transition: border-color 0.3s;
}

.word-card:hover {
  border-color: #f0c060;
}

.word-card-header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.word-solaran {
  font-size: 1.8rem;
  color: #f0c060;
  letter-spacing: 2px;
}

.word-pronunciations {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}

.word-informal {
  font-size: 0.95rem;
  color: #c8a870;
}

.word-ipa {
  font-size: 0.9rem;
  color: #7a6040;
  font-style: italic;
}

.word-definitions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid #3a2a12;
  padding-top: 12px;
}

.word-definition-entry {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}

.def-number {
  color: #7a6040;
  font-size: 0.8rem;
  min-width: 16px;
}

.def-pos {
  color: #c8a870;
  font-style: italic;
  font-size: 0.85rem;
  min-width: 70px;
}

.def-text {
  color: #e8d5a3;
  font-size: 0.95rem;
  flex: 1;
}

.def-notes {
  color: #7a6040;
  font-size: 0.8rem;
  font-style: italic;
}

.word-card-footer {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.delete-btn {
  background: transparent;
  border: 1px solid #3a2a12;
  color: #7a6040;
  padding: 4px 12px;
  font-size: 0.75rem;
  letter-spacing: 1px;
}

.delete-btn:hover {
  background: #3a2a12;
  color: #e8d5a3;
}

/* --- Grammar --- */
.grammar-categories {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 40px;
}

.grammar-category {
  background: #2a1f0e;
  border: 1px solid #5a3e1b;
  padding: 22px 26px;
}

.grammar-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #3a2a12;
}

.grammar-category-title {
  font-size: 1.1rem;
  color: #f0c060;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.grammar-category-subtitle {
  font-size: 0.8rem;
  color: #7a6040;
  font-style: italic;
  margin-top: 2px;
}

.grammar-rules-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.grammar-rule {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 14px;
  background: #1a1208;
  border: 1px solid #3a2a12;
}

.grammar-rule-text {
  flex: 1;
  font-size: 0.95rem;
  color: #e8d5a3;
  line-height: 1.5;
}

.grammar-rule-delete {
  background: transparent;
  border: none;
  color: #5a3e1b;
  padding: 0 4px;
  font-size: 0.8rem;
  cursor: pointer;
  letter-spacing: 0;
  min-width: unset;
}

.grammar-rule-delete:hover {
  background: transparent;
  color: #f0c060;
}

.add-rule-row {
  display: flex;
  gap: 8px;
}

.add-rule-row input {
  flex: 1;
}

.add-rule-row button {
  flex: 0 0 auto;
  padding: 10px 16px;
  font-size: 0.85rem;
}

/* --- Conjugation Table --- */
.conj-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.conj-table th {
  background: #1a1208;
  color: #f0c060;
  padding: 8px 12px;
  text-align: left;
  letter-spacing: 1px;
  font-weight: normal;
  border: 1px solid #3a2a12;
}

.conj-table td {
  padding: 8px 12px;
  border: 1px solid #3a2a12;
  color: #e8d5a3;
}

.conj-table tr:nth-child(even) td {
  background: #1a1208;
}

.conj-highlight {
  color: #f0c060;
  font-style: italic;
}

/* --- Aclemina Table --- */
.aclemina-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.aclemina-table th {
  background: #1a1208;
  color: #f0c060;
  padding: 8px 12px;
  text-align: left;
  letter-spacing: 1px;
  font-weight: normal;
  border: 1px solid #3a2a12;
}

.aclemina-table td {
  padding: 8px 12px;
  border: 1px solid #3a2a12;
  color: #e8d5a3;
}

/* --- Grammar Divider --- */
.grammar-section-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  color: #7a6040;
  font-size: 0.85rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.grammar-section-divider::before,
.grammar-section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #3a2a12;
}

/* --- Scratchpad Notes --- */
.add-note-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.add-note-form input {
  flex: 1;
}

#notes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.note-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px;
  background: #2a1f0e;
  border: 1px solid #3a2a12;
}

.note-item:hover {
  border-color: #5a3e1b;
}

.note-bullet {
  color: #f0c060;
  font-size: 0.7rem;
  margin-top: 4px;
}

.note-text {
  flex: 1;
  font-size: 0.9rem;
  color: #e8d5a3;
  line-height: 1.5;
}

.note-delete {
  background: transparent;
  border: none;
  color: #5a3e1b;
  padding: 0 4px;
  font-size: 0.8rem;
  cursor: pointer;
  min-width: unset;
}

.note-delete:hover {
  background: transparent;
  color: #f0c060;
}

/* --- Translator --- */
.translator-box {
  background: #2a1f0e;
  border: 1px solid #5a3e1b;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.translator-direction {
  display: flex;
  align-items: center;
  gap: 12px;
}

.direction-label {
  color: #f0c060;
  font-size: 0.85rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

#translator-input {
  width: 100%;
  min-height: 120px;
  background: #1a1208;
  border: 1px solid #5a3e1b;
  color: #e8d5a3;
  padding: 14px;
  font-family: Georgia, serif;
  font-size: 1rem;
  resize: vertical;
  line-height: 1.6;
}

#translator-input:focus {
  outline: none;
  border-color: #f0c060;
}

.translator-actions {
  display: flex;
  justify-content: flex-end;
}

.translator-output {
  border-top: 1px solid #3a2a12;
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.output-label {
  font-size: 0.75rem;
  color: #7a6040;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.output-solaran {
  font-size: 1.4rem;
  color: #f0c060;
  line-height: 1.6;
  letter-spacing: 1px;
}

.output-breakdown {
  font-size: 0.9rem;
  color: #e8d5a3;
  line-height: 1.8;
  white-space: pre-wrap;
}

.translator-loading {
  text-align: center;
  color: #7a6040;
  font-style: italic;
  font-size: 0.95rem;
  padding: 10px;
}

.dots {
  display: inline-block;
  animation: blink 1.2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.translator-error {
  color: #c0614a;
  font-size: 0.9rem;
  font-style: italic;
  padding: 10px;
  border: 1px solid #c0614a;
  background: #1a0a08;
}

.hidden {
  display: none;
}