:root {
  color-scheme: light;
  --ink: #4f4032;
  --muted: #826f5c;
  --paper: #fffaf0;
  --cream: #f8efd9;
  --green: #4f8a55;
  --green-dark: #356b40;
  --blue: #397fa3;
  --blue-soft: #eaf6f8;
  --gold: #e5aa55;
  --line: #dbb579;
  --shadow: 0 14px 32px rgba(92, 70, 39, 0.14);
}

* { box-sizing: border-box; }
html.english-admin-pending body { visibility: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Noto Sans Thai", "Segoe UI", Tahoma, sans-serif;
  background:
    linear-gradient(rgba(91, 132, 82, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91, 132, 82, 0.055) 1px, transparent 1px),
    linear-gradient(155deg, #fff8e8 0%, #f5f2d7 58%, #e7f3d0 100%);
  background-size: 32px 32px, 32px 32px, auto;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.english-shell { width: min(1180px, calc(100% - 28px)); margin: 0 auto; padding: 24px 0 56px; }
.english-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.back-link { color: var(--green-dark); font-weight: 800; text-decoration: none; }
.local-pill, .kicker, .price-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 7px 13px; font-weight: 800; }
.local-pill { color: #6b4a11; background: #ffedb8; border: 1px solid #e3b75f; }
.english-hero, .course-panel, .game-panel {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 30px;
  background: rgba(255, 250, 240, 0.94);
  box-shadow: var(--shadow);
}
.english-hero { min-height: 310px; display: grid; grid-template-columns: 1fr 270px; gap: 26px; align-items: center; padding: 42px 44px; }
.english-hero::after { content: "EN"; position: absolute; right: 225px; top: 12px; font: 900 120px/1 Georgia, serif; color: rgba(57, 127, 163, 0.07); }
.english-hero-copy { position: relative; z-index: 1; }
.course-language-switch {
  position: absolute;
  top: 20px;
  right: 22px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(183, 126, 56, 0.35);
  border-radius: 999px;
  background: rgba(255, 250, 239, 0.94);
  box-shadow: 0 12px 28px rgba(111, 74, 27, 0.13);
  backdrop-filter: blur(8px);
}
.course-language-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  padding: 9px 13px;
  border-radius: 999px;
  color: #7a5530;
  font-weight: 900;
  text-decoration: none;
  line-height: 1;
}
.course-language-switch a.is-active {
  color: #fffaf0;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  box-shadow: 0 7px 0 rgba(45, 91, 52, 0.22);
}
.course-language-switch a:not(.is-active):hover {
  color: var(--green-dark);
  background: #eef8dd;
}
.kicker { color: var(--green-dark); background: #e5f2d8; margin-bottom: 12px; }
.english-hero h1 { margin: 0; color: var(--green-dark); font-size: clamp(34px, 5vw, 62px); line-height: 1.04; }
.english-hero h1 span { color: var(--blue); display: block; }
.type-to-top-title span { margin-top: 8px; font-size: 0.58em; line-height: 1.26; }
.english-hero p { max-width: 720px; font-size: 18px; line-height: 1.7; }
.english-hero-cat { width: 260px; max-height: 275px; object-fit: contain; align-self: end; z-index: 1; }
.source-note { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.source-note span { padding: 8px 12px; border-radius: 12px; background: #fff; border: 1px solid #d6c49b; font-weight: 700; }
.section-heading { margin: 38px 0 18px; text-align: center; }
.section-heading h2 { margin: 0 0 6px; color: var(--green-dark); font-size: clamp(28px, 4vw, 42px); }
.section-heading p { margin: 0; color: var(--muted); }
.course-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.course-card { position: relative; min-height: 330px; padding: 28px; border: 2px solid #d6b37e; border-radius: 26px; background: rgba(255,255,255,.82); box-shadow: var(--shadow); overflow: hidden; }
.course-card.typing { background: linear-gradient(145deg, #fffaf0, #edf6fb); border-color: #8cb9cb; }
.course-icon { display: grid; place-items: center; width: 66px; height: 66px; border-radius: 20px; color: white; background: var(--green); font-size: 34px; box-shadow: 0 8px 0 #356b40; }
.typing .course-icon { background: var(--blue); box-shadow: 0 8px 0 #28627d; }
.course-card h3 { margin: 24px 0 8px; font-size: 30px; color: var(--green-dark); }
.typing h3 { color: var(--blue); }
.course-card p { min-height: 76px; color: var(--muted); line-height: 1.65; }
.price-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 20px 0; }
.price-pill { color: #fff; background: #dd872c; font-size: 22px; }
.price-row small { color: var(--muted); font-weight: 700; }
.card-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.primary-button, .secondary-button { cursor: pointer; border-radius: 16px; padding: 12px 18px; font-weight: 900; text-decoration: none; text-align: center; }
.primary-button { color: white; background: var(--green); border: 2px solid var(--green-dark); box-shadow: 0 5px 0 var(--green-dark); }
.typing .primary-button, .english-blue { background: var(--blue); border-color: #28627d; box-shadow: 0 5px 0 #28627d; }
.secondary-button { color: var(--green-dark); background: #fffdf7; border: 2px solid #79a574; }
.payment-modal[hidden] { display: none; }
.payment-modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px; background: rgba(53,43,31,.62); }
.payment-dialog { position: relative; width: min(540px,100%); max-height: 92vh; overflow: auto; padding: 28px; border: 3px solid #d77aa4; border-radius: 28px; background: #fff6df; }
.payment-dialog h2 { color: #a93b70; }
.payment-dialog img { display: block; width: min(330px,100%); margin: 16px auto; border-radius: 14px; }
.payment-qr { margin: 16px 0; padding: 14px; border: 2px solid #e7b2ca; border-radius: 20px; background: #fff; text-align: center; }
.payment-qr img { margin: 0 auto 10px; }
.payment-qr figcaption { color: #704e5d; font-weight: 800; line-height: 1.5; }
.payment-close { position: absolute; right: 16px; top: 14px; border: 0; background: transparent; font-size: 30px; cursor: pointer; }
.payment-dialog input { width: 100%; padding: 13px; border: 2px solid #d797b5; border-radius: 14px; background: white; }
.local-message { color: #7a5b22; font-weight: 700; }

.game-hero { min-height: 210px; grid-template-columns: 1fr 190px; padding: 30px 36px; }
.game-hero .english-hero-cat { width: 185px; max-height: 190px; }
.game-hero h1 { font-size: clamp(30px, 4.5vw, 50px); }
.game-hero .type-to-top-title { font-size: clamp(28px, 3.8vw, 44px); }
.game-panel { margin-top: 22px; padding: 26px; }
.game-toolbar, .mode-switch, .stat-grid, .answer-row, .word-actions { display: flex; gap: 12px; }
.game-toolbar { justify-content: space-between; align-items: center; flex-wrap: wrap; }
.game-toolbar select { padding: 10px 14px; border: 2px solid #b6ca9e; border-radius: 13px; background: white; }
.trial-fixed-label {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 10px 18px;
  border: 2px solid #9dbc8f;
  border-radius: 14px;
  color: var(--green-dark);
  background: #f2f8ea;
  font-weight: 900;
}
.trial-fixed-label[hidden] {
  display: none;
}
.mode-switch { margin: 18px 0; }
.mode-switch button { flex: 1; padding: 13px; border: 2px solid #8db483; border-radius: 15px; color: var(--green-dark); background: #fff; font-weight: 900; cursor: pointer; }
.mode-switch button.active { color: white; background: var(--green); }
.stat-grid { display: grid; grid-template-columns: repeat(4,1fr); }
.stat-grid article { padding: 14px; text-align: center; border: 1px solid #ddc59b; border-radius: 16px; background: #fffdf8; }
.stat-grid span { display: block; color: var(--muted); font-size: 13px; font-weight: 700; }
.stat-grid strong { font-size: 24px; color: var(--green-dark); }
.prompt-card { margin-top: 18px; padding: 30px; text-align: center; border: 2px solid #d9bb86; border-radius: 22px; background: #fffaf0; }
.prompt-card .prompt-label { color: var(--muted); font-weight: 800; }
.prompt-card h2 { margin: 12px 0 4px; font-size: clamp(38px, 7vw, 72px); color: var(--green-dark); }
.prompt-card .word-meta { color: var(--blue); font-weight: 800; }
.typing-answer-slots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  max-width: min(760px, 96%);
  margin: 18px auto 14px;
}
.typing-answer-slot {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 52px;
  border-bottom: 7px solid rgba(72, 86, 104, 0.34);
  color: var(--blue);
  font-size: 2rem;
  font-weight: 950;
  line-height: 1;
}
.typing-answer-slot.filled {
  border-bottom-color: #89a8ff;
  border-radius: 10px 10px 4px 4px;
  background: rgba(137, 168, 255, 0.12);
}
.prompt-card.keyboard-active {
  box-shadow: 0 0 0 3px rgba(137, 168, 255, 0.2), var(--shadow);
}
.word-actions { justify-content: center; margin: 18px 0; flex-wrap: wrap; }
.word-actions button { border: 2px solid #91b389; border-radius: 999px; padding: 9px 15px; background: #fff; color: var(--green-dark); font-weight: 800; cursor: pointer; }
.option-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
.option-grid button { min-height: 78px; padding: 15px; border: 2px solid #d7b77d; border-radius: 18px; background: #fff; color: var(--ink); font-size: 21px; font-weight: 800; cursor: pointer; }
.option-grid button.correct { color: white; background: #5a995d; }
.option-grid button.wrong { color: white; background: #bd5c54; }
.feedback { min-height: 28px; margin: 16px 0 0; text-align: center; font-weight: 900; }
.answer-row { margin-top: 20px; }
.answer-row input { flex: 1; min-width: 0; padding: 14px 16px; border: 2px solid #d5b77e; border-radius: 15px; background: #fff; font-size: 18px; }
.answer-row button { min-width: 135px; }
.typing-nav-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0 0;
}
.typing-nav-row .secondary-button {
  min-width: 150px;
}
.saved-panel { margin-top: 20px; padding: 18px; border-radius: 20px; background: #f2f8e9; border: 1px solid #b8cea1; }
.saved-panel[hidden] { display: none; }
.saved-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.saved-word { padding: 13px; border: 1px solid #c9b88e; border-radius: 14px; background: white; }
.saved-word strong, .saved-word span { display: block; }
.saved-word span { margin-top: 4px; color: var(--muted); }

@media (max-width: 760px) {
  .english-shell { width: min(100% - 18px, 620px); padding-top: 12px; }
  .english-hero { grid-template-columns: 1fr; padding: 76px 22px 0; text-align: center; }
  .course-language-switch {
    top: 14px;
    right: 14px;
  }
  .course-language-switch a {
    min-width: auto;
    padding: 8px 10px;
    font-size: 0.86rem;
  }
  .english-hero-cat { width: 190px; max-height: 190px; justify-self: center; }
  .english-hero::after { right: -10px; font-size: 90px; }
  .source-note { justify-content: center; }
  .course-grid { grid-template-columns: 1fr; }
  .course-card { min-height: 0; }
  .game-hero { grid-template-columns: 1fr 115px; padding: 20px; text-align: left; }
  .game-hero .english-hero-cat { width: 120px; max-height: 140px; }
  .game-hero p { font-size: 15px; }
  .game-panel { padding: 14px; }
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .prompt-card { padding: 22px 12px; }
  .typing-answer-slots { gap: 5px; }
  .typing-answer-slot { min-width: 31px; height: 42px; border-bottom-width: 5px; font-size: 1.45rem; }
  .option-grid { grid-template-columns: 1fr; }
  .answer-row { flex-direction: column; }
  .saved-grid { grid-template-columns: 1fr; }
}
.auth-status.payment-submitted {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  padding: 12px 16px;
  color: #256d2f;
  background: #eef9ed;
  border: 2px solid rgba(48, 129, 58, 0.35);
  border-radius: 18px;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(48, 129, 58, 0.12);
}

.site-update-notice {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  width: min(360px, calc(100vw - 36px));
  padding: 16px;
  border: 2px solid #79a45b;
  border-radius: 22px;
  background: #fff8df;
  box-shadow: 0 16px 36px rgba(84, 55, 25, 0.22);
  color: #5f432d;
  display: grid;
  gap: 8px;
}

.site-update-notice strong {
  color: #3f7a43;
  font-size: 1.05rem;
}

.site-update-notice span {
  line-height: 1.45;
}

.site-update-notice button {
  justify-self: start;
  border: 0;
  border-radius: 999px;
  padding: 9px 16px;
  background: #5f9c4e;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 #3d7335;
}
