/* Styles for app.html (the diary) and auth.html (sign-up and login).
   The landing page, index.html, has its own landing.css. */

* { box-sizing: border-box; margin: 0; padding: 0; }

/* The hidden attribute must win over any element's own display rule. Without this,
   a class like .auth-link { display: block } overrides the browser's weak
   [hidden] { display: none }, so toggling the attribute in JS does nothing. */
[hidden] { display: none !important; }

html, body {
  min-height: 100%;
}

body {
  font-family: 'Lora', Georgia, serif;
  background: linear-gradient(160deg, #efdcf7 0%, #d4b3eb 45%, #b89dd9 100%);
  background-attachment: fixed;
  color: #3d2c5e;
  padding: 24px 16px 60px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.container {
  max-width: 620px;
  margin: 0 auto;
}

header {
  text-align: center;
  padding: 8px 0 22px;
}

/* Pinned to the top-right of the window (position: fixed), not the centred content
   column, so it sits in the real corner on any screen width. A rare click, so it
   stays quiet - a small outline, not a filled button competing with Check. */
.logout-btn {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 10;
  border: 1px solid rgba(184, 157, 217, 0.6);
  background: rgba(255, 253, 245, 0.6);
  border-radius: 6px;
  padding: 6px 12px;
  font-family: 'Lora', Georgia, serif;
  font-size: 13px;
  color: #4a2d7a;
  cursor: pointer;
}

.logout-btn:hover {
  background: #fffdf5;
  border-color: #9d7fc7;
}

h1 {
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 52px;
  color: #4a2d7a;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 10px rgba(74, 45, 122, 0.18);
  line-height: 1.1;
}

/* The title doubles as the way back to the landing page. It should look exactly like
   the plain heading - same colour, no underline - so the whole wordmark is the link. */
.home-link {
  color: inherit;
  text-decoration: none;
}

.date {
  text-align: center;
  font-style: italic;
  color: #4a2d7a;
  margin-bottom: 14px;
  font-size: 14px;
  opacity: 0.9;
}

.paper {
  background-color: #fffdf5;
  background-image:
    linear-gradient(to right, transparent 0, transparent 38px, #f0a8a8 38px, #f0a8a8 40px, transparent 40px, transparent 100%),
    repeating-linear-gradient(to bottom, transparent 0, transparent 31px, #d4c4e8 31px, #d4c4e8 32px);
  border-radius: 6px;
  padding: 0 18px 0 52px;
  line-height: 32px;
  font-family: 'Lora', Georgia, serif;
  font-size: 17px;
  color: #2d1f4a;
  box-shadow:
    0 1px 2px rgba(99, 67, 158, 0.15),
    0 14px 36px rgba(99, 67, 158, 0.28);
  position: relative;
}

.paper::before {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(to right, transparent, rgba(0,0,0,0.05));
  border-radius: 0 6px 6px 0;
  pointer-events: none;
}

textarea.paper {
  width: 100%;
  min-height: 416px;
  border: none;
  outline: none;
  resize: vertical;
  display: block;
  font-size: 17px;
  -webkit-appearance: none;
  appearance: none;
}

textarea.paper::placeholder {
  color: #b8a5d6;
  font-style: italic;
}

.actions {
  display: flex;
  justify-content: center;
  margin: 22px 0 6px;
}

button.primary {
  background: linear-gradient(135deg, #a68bd1 0%, #7a5ba8 100%);
  color: white;
  border: none;
  padding: 14px 36px;
  border-radius: 28px;
  font-family: 'Lora', Georgia, serif;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(122, 91, 168, 0.4);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  min-width: 220px;
}

button.primary:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(122, 91, 168, 0.5); }
button.primary:active { transform: translateY(0); }
button.primary:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

.corrections-section {
  margin-top: 10px;
  display: none;
}
.corrections-section.visible { display: block; }

.section-label {
  text-align: center;
  font-family: 'Caveat', cursive;
  font-size: 30px;
  color: #4a2d7a;
  margin: 18px 0 8px;
}

.paper.corrected {
  white-space: pre-wrap;
  word-wrap: break-word;
  padding-top: 12px;
  padding-bottom: 16px;
  min-height: 0;
}

.error-mark {
  display: inline;
  border-radius: 3px;
  outline: none;
  transition: background 0.15s;
}
/* Only the part that opens the tooltip reacts to the pointer: the green correction, or
   the red words when nothing replaces them. */
.error-mark ins.right,
.error-mark:not(:has(ins.right)) { cursor: pointer; }
.error-mark ins.right:hover { background: rgba(29, 110, 62, 0.17); }
.error-mark:not(:has(ins.right)):hover { background: rgba(184, 157, 217, 0.15); }
.error-mark:focus { background: rgba(184, 157, 217, 0.18); }

del.wrong {
  color: #b03030;
  text-decoration: line-through;
  text-decoration-color: #d04040;
  text-decoration-thickness: 2px;
  background: rgba(208, 64, 64, 0.07);
  padding: 0 1px;
  border-radius: 2px;
}

ins.right {
  color: #1d6e3e;
  text-decoration: none;
  font-weight: 500;
  background: rgba(29, 110, 62, 0.09);
  padding: 0 4px;
  border-radius: 3px;
  margin-left: 4px;
}

.delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: #b89dd9;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 10px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  font-family: inherit;
}

.delete-btn:hover {
  color: #b03030;
  background: rgba(208, 64, 64, 0.08);
}

.delete-btn:active {
  background: rgba(208, 64, 64, 0.16);
}

.edit-btn {
  position: absolute;
  top: 8px;
  right: 38px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: #b89dd9;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s, background 0.15s;
}

.edit-btn:hover,
.edit-btn:focus-visible {
  outline: none;
  color: #7a5ba8;
  background: rgba(184, 157, 217, 0.2);
}

.edit-btn::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  background: rgba(45, 31, 74, 0.96);
  color: #fffdf5;
  font-family: 'Lora', Georgia, serif;
  font-size: 12px;
  font-style: italic;
  padding: 5px 10px;
  border-radius: 5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  box-shadow: 0 4px 14px rgba(99, 67, 158, 0.28);
}

.edit-btn:hover::after,
.edit-btn:focus-visible::after { opacity: 1; }

.vocab-edit-input {
  width: 100%;
  margin-top: 6px;
  background: #fffdf5;
  border: 1px solid #9d7fc7;
  border-radius: 5px;
  padding: 8px 10px;
  font-family: 'Lora', Georgia, serif;
  font-size: 14px;
  color: #2d1f4a;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.vocab-edit-input:focus { box-shadow: 0 0 0 3px rgba(157, 127, 199, 0.18); }

.vocab-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

.vocab-edit-actions button {
  border-radius: 20px;
  padding: 7px 16px;
  font-family: 'Lora', Georgia, serif;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s;
}

.vocab-edit-cancel {
  background: transparent;
  border-color: rgba(157, 127, 199, 0.5);
  color: #4a2d7a;
}

.vocab-edit-cancel:hover { background: rgba(184, 157, 217, 0.16); }

.vocab-edit-save {
  background: linear-gradient(135deg, #a68bd1 0%, #7a5ba8 100%);
  color: white;
}

.vocab-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin: 12px 0;
}

.vocab-form input {
  background: rgba(255, 253, 245, 0.92);
  border: 1px solid rgba(184, 157, 217, 0.5);
  border-radius: 6px;
  padding: 11px 13px;
  font-family: 'Lora', Georgia, serif;
  font-size: 15px;
  color: #2d1f4a;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
}

.vocab-form input:focus {
  border-color: #9d7fc7;
  box-shadow: 0 0 0 3px rgba(157, 127, 199, 0.18);
}

.vocab-form input::placeholder {
  color: #b8a5d6;
  font-style: italic;
}

.vocab-search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 4px;
}

.add-btn,
.search-btn {
  background: linear-gradient(135deg, #a68bd1 0%, #7a5ba8 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 22px;
  font-weight: 400;
  cursor: pointer;
  padding: 0 18px;
  min-width: 48px;
  box-shadow: 0 3px 10px rgba(122, 91, 168, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
  line-height: 1;
}

.add-btn:hover,
.search-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(122, 91, 168, 0.4);
}

.add-btn:active,
.search-btn:active { transform: translateY(0); }

.search-btn {
  display: grid;
  place-items: center;
  font-size: 0;
}

.vocab-hint {
  color: #b03030;
  font-size: 13px;
  font-style: italic;
  margin: -4px 0 8px;
}

.vocab-edit-hint { margin: 6px 0 0; }

.vocab-search {
  width: 100%;
  min-width: 0;
  background: rgba(255, 253, 245, 0.92);
  border: 1px solid rgba(184, 157, 217, 0.5);
  border-radius: 6px;
  padding: 10px 13px;
  font-family: 'Lora', Georgia, serif;
  font-size: 14px;
  color: #2d1f4a;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.vocab-search:focus {
  border-color: #9d7fc7;
  box-shadow: 0 0 0 3px rgba(157, 127, 199, 0.18);
}

.vocab-search::placeholder {
  color: #b8a5d6;
  font-style: italic;
}

.vocab-list { margin-top: 6px; }

.vocab-entry {
  background: rgba(255, 253, 245, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 6px;
  padding: 12px 70px 12px 16px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(99, 67, 158, 0.13);
  position: relative;
}

.vocab-entry.editing { padding-right: 16px; }

.vocab-fr {
  font-weight: 500;
  color: #4a2d7a;
  font-size: 16px;
  margin-bottom: 2px;
  word-wrap: break-word;
}

.vocab-en {
  color: #6b4d96;
  font-size: 14px;
  font-style: italic;
  word-wrap: break-word;
}

.history-list { margin-top: 6px; }

.history-month { margin-bottom: 10px; }

.history-month-head {
  position: relative;
  display: block;
  width: 100%;
  background: rgba(122, 91, 168, 0.16);
  border: none;
  border-radius: 6px;
  padding: 12px 40px 12px 16px;
  text-align: left;
  font-family: inherit;
  color: #4a2d7a;
  cursor: pointer;
}
.history-month-head:hover,
.history-month-head:focus-visible {
  outline: none;
  background: rgba(122, 91, 168, 0.24);
}
.history-month-name { font-weight: 500; font-size: 16px; }
.history-month-count { font-size: 14px; color: #6b4d96; margin-left: 6px; }

.history-month-head .history-chevron { right: 16px; }
.history-month-head[aria-expanded="true"] .history-chevron {
  transform: translateY(-50%) rotate(180deg);
}

.history-month-body { margin-top: 8px; }

.history-entry {
  background: rgba(255, 253, 245, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 6px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(99, 67, 158, 0.13);
}

.history-row { position: relative; }

/* The padding sits on the button rather than the card so the whole row is clickable. */
.history-head {
  position: relative;
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  padding: 12px 76px 12px 16px;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  color: inherit;
  border-radius: 6px;
  transition: background 0.15s;
}

.history-head:hover { background: rgba(184, 157, 217, 0.12); }
.history-head:focus-visible {
  outline: none;
  background: rgba(184, 157, 217, 0.18);
}

.history-date {
  display: block;
  font-weight: 500;
  color: #4a2d7a;
  font-size: 15px;
  margin-bottom: 3px;
}

.history-preview {
  display: block;
  color: #6b4d96;
  font-size: 14px;
  word-wrap: break-word;
}

.history-chevron {
  position: absolute;
  top: 50%;
  right: 48px;
  transform: translateY(-50%);
  color: #9d7fc7;
  font-size: 13px;
  line-height: 1;
  transition: transform 0.18s;
}

.history-head[aria-expanded="true"] .history-chevron {
  transform: translateY(-50%) rotate(180deg);
}

.history-delete {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #b89dd9;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s, background 0.15s;
}

.history-delete:hover,
.history-delete:focus-visible {
  outline: none;
  color: #b03030;
  background: rgba(208, 64, 64, 0.1);
}

/* The label rides on the button itself rather than the browser's own grey tooltip. */
.history-delete::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: rgba(45, 31, 74, 0.96);
  color: #fffdf5;
  font-family: 'Lora', Georgia, serif;
  font-size: 12px;
  font-style: italic;
  padding: 5px 10px;
  border-radius: 5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  box-shadow: 0 4px 14px rgba(99, 67, 158, 0.28);
}

.history-delete:hover::after,
.history-delete:focus-visible::after { opacity: 1; }

.history-detail {
  padding: 0 16px 16px;
  border-top: 1px solid rgba(184, 157, 217, 0.3);
}

.history-detail .section-label { margin: 14px 0 8px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(45, 31, 74, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: modal-fade 0.18s ease-out;
}

@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 380px;
  background: #fffdf5;
  border-radius: 14px;
  padding: 26px 24px 20px;
  box-shadow: 0 20px 60px rgba(45, 31, 74, 0.35);
  text-align: center;
  animation: modal-rise 0.18s ease-out;
}

@keyframes modal-rise {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.modal-title {
  font-family: 'Caveat', cursive;
  font-size: 30px;
  color: #4a2d7a;
  line-height: 1.1;
  margin-bottom: 8px;
}

.modal-message {
  color: #6b4d96;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.modal-btn {
  flex: 1;
  border-radius: 24px;
  padding: 11px 18px;
  font-family: 'Lora', Georgia, serif;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.modal-btn:active { transform: translateY(1px); }

.modal-btn.cancel {
  background: transparent;
  border-color: rgba(157, 127, 199, 0.5);
  color: #4a2d7a;
}

.modal-btn.cancel:hover { background: rgba(184, 157, 217, 0.16); }

.modal-btn.danger {
  background: linear-gradient(135deg, #c25050 0%, #a03030 100%);
  color: #fffdf5;
  box-shadow: 0 5px 14px rgba(160, 48, 48, 0.32);
}

.modal-btn.danger:hover { background: linear-gradient(135deg, #cf5a5a 0%, #ad3636 100%); }

.empty-list {
  text-align: center;
  color: #6b4d96;
  font-style: italic;
  padding: 14px;
  font-size: 14px;
  opacity: 0.85;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -2px;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-msg {
  text-align: center;
  color: #8c2020;
  background: rgba(208, 64, 64, 0.1);
  padding: 14px;
  border-radius: 6px;
  margin: 12px 0;
  font-size: 14px;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.corrected-section {
  margin-top: 10px;
  display: none;
}
.corrected-section.visible { display: block; }

.pairs-box {
  margin-top: 8px;
  background: rgba(255, 253, 245, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 6px;
  padding: 14px 18px;
  box-shadow: 0 2px 10px rgba(99, 67, 158, 0.15);
}

.pairs-box .pair { margin-bottom: 10px; }
.pairs-box .pair:last-child { margin-bottom: 0; }

.pair-fr {
  color: #2d1f4a;
  font-size: 15px;
  line-height: 1.5;
}

.pair-en {
  color: #6b4d96;
  font-size: 14px;
  font-style: italic;
  line-height: 1.5;
  margin-top: 2px;
}

.no-errors-badge {
  text-align: center;
  font-style: italic;
  color: #4a7a4a;
  background: rgba(74, 122, 74, 0.08);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.4;
}

.word-count {
  text-align: right;
  font-size: 12px;
  font-style: italic;
  color: #6b4d96;
  margin-top: 6px;
  letter-spacing: 0.3px;
  opacity: 0.85;
}
.check-hint {
  text-align: center;
  font-size: 13px;
  font-style: italic;
  color: #6b4d96;
  margin-top: 8px;
}

.limit-msg {
  text-align: center;
  color: #4a2d7a;
  background: rgba(122, 91, 168, 0.12);
  padding: 16px 14px 18px;
  border-radius: 6px;
  margin: 12px 0;
}
.limit-msg p { margin: 0 0 14px; }

textarea.paper[readonly] { opacity: 0.7; cursor: not-allowed; }

.word-count.over {
  color: #b03030;
  font-weight: 500;
  opacity: 1;
}

.tooltip {
  position: absolute;
  background: rgba(45, 31, 74, 0.96);
  color: #fffdf5;
  padding: 8px 12px;
  border-radius: 6px;
  font-family: 'Lora', Georgia, serif;
  font-size: 13px;
  font-style: italic;
  line-height: 1.4;
  max-width: 260px;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 1000;
  box-shadow: 0 4px 16px rgba(99, 67, 158, 0.3);
  text-align: center;
}
.tooltip.visible { opacity: 1; }
.tooltip:not(.visible) { pointer-events: none; }

.tip-why { margin-bottom: 8px; }
.tip-why:only-child { margin-bottom: 0; }

.tip-save {
  background: rgba(255, 253, 245, 0.16);
  border: 1px solid rgba(255, 253, 245, 0.45);
  color: #fffdf5;
  font-family: inherit;
  font-style: normal;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s;
}

.tip-save:hover:not(:disabled) { background: rgba(255, 253, 245, 0.3); }
.tip-save:disabled { opacity: 0.6; cursor: default; }
.tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(45, 31, 74, 0.96);
}

.unmatched-list {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(184, 157, 217, 0.14);
  border-radius: 6px;
  font-size: 14px;
  color: #4a2d7a;
  line-height: 1.5;
}
.unmatched-list .label {
  font-style: italic;
  font-size: 12px;
  opacity: 0.85;
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}
.unmatched-list-item { margin: 4px 0; }
.unmatched-list-item .why {
  display: block;
  font-size: 12px;
  font-style: italic;
  opacity: 0.85;
  margin-left: 4px;
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 0 0 18px;
  flex-wrap: wrap;
}

.tab {
  background: rgba(255, 253, 245, 0.7);
  color: #4a2d7a;
  border: 1px solid rgba(184, 157, 217, 0.5);
  padding: 9px 18px;
  border-radius: 22px;
  font-family: 'Lora', Georgia, serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, transform 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.tab:hover { background: rgba(255, 253, 245, 0.95); }

.tab.active {
  background: linear-gradient(135deg, #a68bd1 0%, #7a5ba8 100%);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(122, 91, 168, 0.32);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.vocab-heading {
  text-align: center;
  font-family: 'Caveat', cursive;
  font-size: 32px;
  font-weight: 600;
  color: #4a2d7a;
  margin: 4px 0 14px;
  line-height: 1.1;
}

/* --- Sign-up / login --- */

.container.narrow {
  max-width: 420px;
}

.auth-card {
  background: rgba(255, 253, 245, 0.92);
  border: 1px solid rgba(184, 157, 217, 0.5);
  border-radius: 10px;
  padding: 26px 24px 28px;
  box-shadow:
    0 1px 2px rgba(99, 67, 158, 0.15),
    0 14px 36px rgba(99, 67, 158, 0.22);
}

.auth-card .vocab-heading {
  text-align: center;
  margin-top: 0;
}

/* Segmented switch between logging in and creating an account. The active side
   is filled; the two share the pill so it reads as one control, not two buttons. */
.auth-toggle {
  display: flex;
  gap: 4px;
  background: rgba(184, 157, 217, 0.14);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 18px;
}

.auth-toggle-btn {
  flex: 1;
  border: none;
  background: none;
  border-radius: 6px;
  padding: 9px 0;
  font-family: 'Lora', Georgia, serif;
  font-size: 14px;
  color: #7a5ba8;
  cursor: pointer;
}

.auth-toggle-btn.active {
  background: #fffdf5;
  color: #4a2d7a;
  box-shadow: 0 1px 3px rgba(99, 67, 158, 0.2);
}

.auth-label {
  display: block;
  font-size: 13px;
  color: #4a2d7a;
  letter-spacing: 0.3px;
  margin: 14px 0 5px;
}

.auth-form input {
  width: 100%;
  background: #fffdf5;
  border: 1px solid rgba(184, 157, 217, 0.5);
  border-radius: 6px;
  padding: 11px 13px;
  font-family: 'Lora', Georgia, serif;
  font-size: 16px;
  color: #2d1f4a;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.auth-form input:focus {
  border-color: #9d7fc7;
  box-shadow: 0 0 0 3px rgba(157, 127, 199, 0.18);
}

/* The password box holds a show/hide button pinned to its right edge. The
   input gets right padding so typed text never slides under the button. */
.password-field {
  position: relative;
}

.password-field input {
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: #7a5ba8;
  cursor: pointer;
}

.password-toggle:hover {
  color: #4a2d7a;
}

/* Shut (slashed) eye while the password is hidden, open eye once it's
   revealed - the icon mirrors what you can see. The state lives in
   aria-pressed, so the icon and the screen-reader label stay in sync. */
.password-toggle .icon-eye {
  display: none;
}

.password-toggle[aria-pressed="true"] .icon-eye {
  display: block;
}

.password-toggle[aria-pressed="true"] .icon-eye-off {
  display: none;
}

.auth-note {
  font-size: 12px;
  font-style: italic;
  color: #7a5ba8;
  opacity: 0.85;
  margin-top: 5px;
}

/* Turns green with a tick the moment the length rule is satisfied, so the
   hint reads as "done" rather than an unmet demand. Same green as a success
   message. Cosmetic only — auth.js and the server still decide the real rule. */
.auth-note.met {
  font-style: normal;
  color: #3d6b3d;
  opacity: 1;
}

.auth-note.met::before {
  content: "\2713\00a0";
  font-weight: 600;
}

/* "Keep me signed in". The checkbox opts out of the full-width text-box look
   every other input in the form gets. */
.auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 13px;
  color: #4a2d7a;
  cursor: pointer;
}

.auth-form .auth-remember input {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  -webkit-appearance: auto;
  appearance: auto;
  accent-color: #9d7fc7;
}

/* The "Forgot password?" / "Back to log in" text links. Real buttons (they change the
   form in place, they don't navigate), stripped down to look like a quiet link centred
   under the card. */
.auth-link {
  display: block;
  margin: 14px auto 0;
  border: none;
  background: none;
  font-family: 'Lora', Georgia, serif;
  font-size: 13px;
  color: #7a5ba8;
  text-decoration: underline;
  cursor: pointer;
}

.auth-link:hover {
  color: #4a2d7a;
}

.auth-message {
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.5;
  border-radius: 6px;
  padding: 12px 14px;
  /* Honour explicit line breaks (\n) in the message text while still wrapping long
     lines normally, so a two-sentence message can put each sentence on its own line. */
  white-space: pre-line;
}

.auth-message.error {
  color: #b03030;
  background: rgba(176, 48, 48, 0.08);
}

.auth-message.success {
  color: #3d6b3d;
  background: rgba(61, 107, 61, 0.09);
}

@media (max-width: 480px) {
  body { padding: 18px 12px 50px; }
  h1 { font-size: 44px; }
  /* The title fills the width on a phone, so the corner button would overlap its
     right end. Drop the title below the button's strip and shrink the button a little,
     so they share the top of the screen instead of colliding. */
  header { padding-top: 34px; }
  .logout-btn { top: 10px; right: 12px; padding: 5px 11px; font-size: 12px; }
  .paper { padding: 0 14px 0 44px; font-size: 16px; }
  .paper {
    background-image:
      linear-gradient(to right, transparent 0, transparent 32px, #f0a8a8 32px, #f0a8a8 34px, transparent 34px, transparent 100%),
      repeating-linear-gradient(to bottom, transparent 0, transparent 31px, #d4c4e8 31px, #d4c4e8 32px);
  }
  textarea.paper { font-size: 16px; min-height: 352px; }
  button.primary { width: 100%; }
  .vocab-form { grid-template-columns: 1fr; }
  .auth-card { padding: 22px 18px 24px; }
}
