:root {
  --bg: #FAF6EC;
  --surface: #EFEBE0;
  --ink: #000000;
  --white: #FFFFFF;
  --teal: #0F6B66;
  --teal-hover: #0B4F4B;
  --teal-light: #7FC9C4;
  --danger: #B3261E;
  --disabled-bg: #CFCFCF;
  --disabled-fg: #8A8A8A;
  /* Footer is already black-on-cream by design in light mode; pinned to its
     own tokens (rather than --ink/--bg) so it doesn't get pulled along when
     those flip for dark mode below. */
  --footer-bg: #000000;
  --footer-text: #FAF6EC;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    /* "insides of dropdown boxes" - select/text inputs, the hamburger menu,
       and the phrase/guess display boxes all go dark gray. */
    --white: #2E2E2E;
    --surface: #262626;
    --ink: #F2F2F2;
    /* Lighter blue accent, swapped in as a family so hover/highlight states
       stay consistent with the new base color. */
    --teal: #4FA8FF;
    --teal-hover: #2F86E0;
    --teal-light: #9ED2FF;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Roboto', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection {
  background: var(--teal);
  color: var(--white);
}

button {
  font-family: inherit;
}

#app {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */

.site-header {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 72px 8px;
  text-align: center;
}

.logo-btn {
  display: inline-block;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.logo-img {
  height: 44px;
  width: auto;
  display: block;
  margin: 0 auto 10px;
  border-radius: 4px;
}

.site-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0;
  color: var(--ink);
}

/* ---------- Hamburger + menu ---------- */

.hamburger {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 36px;
  background: var(--bg);
  border: 2px solid var(--ink);
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  z-index: 40;
  transition: border-color 0.15s ease;
}

.hamburger:hover {
  border-color: var(--teal);
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  transition: background-color 0.15s ease;
}

.hamburger:hover span {
  background: var(--teal);
}

.menu-dropdown {
  position: fixed;
  top: 64px;
  right: 24px;
  width: 210px;
  background: var(--white);
  border: 2px solid var(--ink);
  z-index: 40;
}

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--white);
  border: none;
  border-bottom: 1px solid var(--ink);
  padding: 12px 16px;
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
}

.menu-item:hover {
  background: var(--surface);
}

.menu-item-last {
  border-bottom: none;
}

/* ---------- Main content ---------- */

main.page-container {
  flex: 1;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 24px 56px;
}

.center {
  text-align: center;
}

.field-block {
  margin-bottom: 28px;
}

.label-caps {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.label-bold {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.difficulty-row {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
}

.difficulty-slider {
  width: 220px;
  accent-color: var(--teal);
}

.difficulty-value {
  font-weight: 700;
  min-width: 60px;
}

.difficulty-value .cefr {
  font-weight: 400;
  color: #555;
}

.banner {
  text-align: center;
  margin-bottom: 20px;
  font-size: 14px;
  font-style: italic;
}

.banner-error {
  color: var(--danger);
  font-style: normal;
  font-weight: 700;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--teal);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  font-size: 14px;
  font-style: normal;
  margin-left: 6px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.select-input,
.text-input {
  width: 100%;
  padding: 10px;
  border: 2px solid var(--ink);
  background: var(--white);
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  color: var(--ink);
}

.phrase-box {
  background: var(--surface);
  border: 2px solid var(--ink);
  padding: 16px;
  min-height: 110px;
  font-size: 16px;
  line-height: 1.5;
}

.guess-box {
  background: var(--surface);
  border: 2px solid var(--ink);
  padding: 16px;
  min-height: 110px;
  font-size: 16px;
  font-family: 'Roboto', sans-serif;
  resize: none;
  width: 100%;
  color: var(--ink);
}

.guess-box:disabled {
  opacity: 0.6;
}

.result-block {
  margin-bottom: 18px;
  font-size: 14px;
  line-height: 1.7;
}

.result-points {
  font-weight: 700;
  font-style: italic;
  margin-top: 4px;
}

.result-feedback {
  margin-top: 4px;
  color: #444;
}

.submit-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.total-points {
  font-size: 14px;
  font-weight: 700;
}

.btn {
  padding: 12px 26px;
  background: var(--teal);
  color: var(--white);
  border: 2px solid var(--ink);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.btn:hover:not(:disabled) {
  background: var(--teal-hover);
}

.btn:disabled {
  background: var(--disabled-bg);
  color: var(--disabled-fg);
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--white);
  color: var(--ink);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface);
}

.history-title {
  margin-bottom: 12px;
}

.history-date-group {
  margin-top: 8px;
}

.history-date-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 8px;
  margin-top: 24px;
  border-bottom: 2px solid var(--ink);
  font-weight: 700;
  font-size: 15px;
}

.history-row {
  border-top: 1px solid var(--ink);
  padding: 14px 0;
}

.history-row .two-col {
  margin-bottom: 0;
  font-size: 14px;
}

.history-points {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
}

.history-points.zero {
  color: var(--danger);
}

/* ---------- About / Contact / Subscription / Profile ---------- */

.section-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  margin: 24px 0 14px;
}

.prose {
  font-size: 15px;
  line-height: 1.7;
  max-width: 480px;
  margin: 0 auto 32px;
}

.prose.steps {
  text-align: left;
  padding-left: 20px;
}

.faq-list {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.faq-item {
  text-align: center;
}

.faq-question {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
}

.faq-answer {
  font-size: 14px;
  line-height: 1.6;
}

.contact-form,
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 440px;
  margin: 0 auto;
}

.contact-form .select-input,
.contact-form .text-input {
  background: var(--surface);
}

.body-input {
  min-height: 150px;
  resize: none;
}

.confirmation-box {
  text-align: center;
  padding: 28px;
  border: 2px solid var(--ink);
  font-weight: 700;
  font-size: 15px;
  max-width: 440px;
  margin: 0 auto;
}

.center-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding-top: 12px;
}

.profile-card {
  max-width: 320px;
  margin: 0 auto 24px;
  border: 2px solid var(--ink);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}

/* ---------- Auth modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
}

.modal {
  background: var(--bg);
  border: 2px solid var(--ink);
  padding: 28px 24px 24px;
  max-width: 380px;
  width: 100%;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.auth-switch {
  display: block;
  margin: 16px auto 0;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--footer-bg);
  padding: 22px 24px;
  display: flex;
  justify-content: center;
  gap: 32px;
}

.footer-link {
  display: inline-block;
  background: none;
  border: none;
  color: var(--footer-text);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}

.footer-link:hover {
  color: var(--teal-light);
}

@media (max-width: 480px) {
  .site-header {
    padding: 28px 56px 8px;
  }
  .two-col {
    grid-template-columns: 1fr;
  }
}
