/*
 * IELTS Writing Preview — Citadel Command HUD
 * Visual layer only. Question data, graph images, answer controls and
 * application behaviour remain owned by the existing page and scripts.
 */

:root {
  --hud-gold: #f2bf18;
  --hud-gold-bright: #ffe45f;
  --hud-gold-deep: #9b6500;
  --hud-ivory: #fff4d7;
  --hud-parchment: #eee7d4;
  --hud-parchment-deep: #d7c9aa;
  --hud-ink: #15110c;
  --hud-smoke: rgba(7, 8, 7, .91);
  --hud-smoke-soft: rgba(16, 15, 12, .82);
  --hud-oxblood: #7d0008;
  --hud-oxblood-dark: #2c0004;
  --hud-oxblood-hot: #b70b13;
  --hud-line: rgba(242, 191, 24, .74);
  --hud-muted: #c9bea6;
  --hud-shadow: rgba(0, 0, 0, .68);
}

html {
  color-scheme: dark;
  background: #090907;
}

body,
body:has(#panel-task2:not([hidden])),
body[data-task2-theme='light']:has(#panel-task2:not([hidden])) {
  min-height: 100vh;
  color: var(--hud-ivory);
  background-color: #090907;
  background-image:
    linear-gradient(rgba(4, 5, 5, .36), rgba(8, 5, 3, .72)),
    url("https://edmund-public-media.edmundeducation.workers.dev/ielts-writing-preview/assets/citadel-command-background.webp");
  background-attachment: fixed;
  background-position: center top;
  background-size: cover;
}

body::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% -15%, rgba(243, 190, 31, .11), transparent 42rem),
    linear-gradient(90deg, rgba(0, 0, 0, .42), transparent 18%, transparent 82%, rgba(0, 0, 0, .42));
}

::selection {
  color: #160d00;
  background: var(--hud-gold-bright);
}

/* Top command bar */
.site-header.edmund-system-header {
  position: sticky;
  top: 0;
  z-index: 80;
  border: 0;
  border-bottom: 2px solid var(--hud-gold);
  color: var(--hud-ivory);
  background:
    linear-gradient(180deg, rgba(21, 18, 14, .94), rgba(5, 6, 6, .95)),
    url("https://edmund-public-media.edmundeducation.workers.dev/ielts-writing-preview/assets/citadel-command-background.webp") center 16% / cover;
  box-shadow:
    0 2px 0 rgba(44, 17, 0, .95),
    0 4px 0 rgba(242, 191, 24, .42),
    0 10px 30px rgba(0, 0, 0, .58);
  backdrop-filter: blur(14px) saturate(.78);
}

.site-header.edmund-system-header::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -7px;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--hud-gold-deep) 12%, var(--hud-gold) 50%, var(--hud-gold-deep) 88%, transparent);
  opacity: .9;
  pointer-events: none;
}

.site-header .header-inner {
  width: min(1840px, calc(100% - 28px));
  min-height: 76px;
  gap: 18px;
}

.site-header .edmund-system-switcher__trigger {
  min-height: 56px;
  padding: 5px 14px 5px 6px;
  border: 1px solid var(--hud-line);
  border-radius: 1px;
  color: var(--hud-gold-bright);
  background: linear-gradient(180deg, rgba(17, 15, 12, .95), rgba(4, 5, 5, .96));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .88), 0 0 12px rgba(0, 0, 0, .36);
}

.site-header .edmund-system-switcher__trigger:hover,
.site-header .edmund-system-switcher__trigger:focus-visible,
.site-header .edmund-system-switcher[data-open="true"] .edmund-system-switcher__trigger {
  border-color: var(--hud-gold-bright);
  background: linear-gradient(180deg, #3a1710, #150705);
}

.site-header .edmund-system-switcher__logo {
  width: 43px;
  height: 43px;
  border: 1px solid var(--hud-gold);
  border-radius: 0;
  box-shadow: inset 0 0 0 1px #000, 0 0 8px rgba(242, 191, 24, .16);
}

.site-header .edmund-system-switcher__copy strong {
  color: var(--hud-gold-bright);
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  font-size: 1.35rem;
  font-variant: small-caps;
  letter-spacing: .035em;
  text-shadow: 0 2px 3px #000;
}

.site-header .edmund-system-switcher__copy small,
.site-header .edmund-system-switcher__chevron,
.site-header .edmund-system-switcher__homebase,
.header-context,
.account-label {
  color: var(--hud-muted);
}

.header-context {
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  letter-spacing: .14em;
}

.header-action,
.edmund-system-header .edmund-system-tools .edmund-pomodoro-header-button,
.edmund-system-header .edmund-system-tools .edmund-music-header-button,
.edmund-system-header .edmund-system-tools [data-answer-sound-toggle] {
  min-height: 42px;
  border: 1px solid var(--hud-gold-deep);
  border-radius: 1px;
  color: var(--hud-ivory);
  background: linear-gradient(180deg, #383733, #121313 58%, #080909);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), 0 2px 6px rgba(0, 0, 0, .5);
}

.header-action:hover,
.edmund-system-header .edmund-system-tools .edmund-pomodoro-header-button:hover,
.edmund-system-header .edmund-system-tools .edmund-music-header-button:hover,
.edmund-system-header .edmund-system-tools [data-answer-sound-toggle]:hover {
  border-color: var(--hud-gold-bright);
  color: #fff8d8;
  background: linear-gradient(180deg, var(--hud-oxblood-hot), var(--hud-oxblood) 45%, var(--hud-oxblood-dark));
}

.edmund-system-header .edmund-system-tools .edmund-pomodoro-header-button small {
  color: var(--hud-muted);
}

.site-header .edmund-system-switcher__homebase,
.site-header .edmund-system-tools > button {
  border: 1px solid var(--hud-gold-deep) !important;
  border-radius: 1px !important;
  color: var(--hud-ivory) !important;
  background: linear-gradient(180deg, #383733, #121313 58%, #080909) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), 0 2px 6px rgba(0, 0, 0, .5) !important;
}

.site-header .edmund-system-switcher__homebase:hover,
.site-header .edmund-system-switcher__homebase:focus-visible,
.site-header .edmund-system-tools > button:hover,
.site-header .edmund-system-tools > button:focus-visible {
  border-color: var(--hud-gold-bright) !important;
  color: #fff8d8 !important;
  background: linear-gradient(180deg, var(--hud-oxblood-hot), var(--hud-oxblood) 45%, var(--hud-oxblood-dark)) !important;
  transform: none;
}

.site-header .edmund-system-tools small {
  color: var(--hud-muted) !important;
}

.site-header .edmund-pomodoro-header-button,
.site-header .edmund-music-header-button,
.site-header [data-answer-sound-toggle] {
  border: 1px solid var(--hud-gold-deep) !important;
  border-radius: 1px !important;
  color: var(--hud-ivory) !important;
  background: linear-gradient(180deg, #383733, #121313 58%, #080909) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), 0 2px 6px rgba(0, 0, 0, .5) !important;
}

.site-header.edmund-system-header .edmund-system-tools .edmund-pomodoro-header-button,
.site-header.edmund-system-header .edmund-system-tools .edmund-music-header-button,
.site-header.edmund-system-header .edmund-system-tools [data-answer-sound-toggle] {
  border: 1px solid var(--hud-gold-deep) !important;
  border-radius: 1px !important;
  color: var(--hud-ivory) !important;
  background: linear-gradient(180deg, #383733, #121313 58%, #080909) !important;
}

/* Main command deck */
.shell {
  width: min(1780px, calc(100% - 42px));
  padding: 34px 0 70px;
}

.tabs,
body:has(#panel-task2:not([hidden])) .tabs,
body[data-task2-theme='light']:has(#panel-task2:not([hidden])) .tabs {
  width: min(720px, 100%);
  margin: 0 0 18px;
  padding: 5px;
  gap: 5px;
  border: 1px solid var(--hud-gold);
  border-radius: 0;
  background: rgba(4, 5, 5, .9);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .95), 0 10px 22px rgba(0, 0, 0, .42);
}

.tab,
.tab.is-active,
body:has(#panel-task2:not([hidden])) .tab,
body:has(#panel-task2:not([hidden])) .tab.is-active,
body[data-task2-theme='light']:has(#panel-task2:not([hidden])) .tab,
body[data-task2-theme='light']:has(#panel-task2:not([hidden])) .tab.is-active {
  min-height: 62px;
  border: 1px solid transparent;
  border-radius: 0;
  color: #cfc4ac;
  background: linear-gradient(180deg, rgba(45, 44, 39, .76), rgba(9, 10, 9, .82));
  box-shadow: none;
  transform: none;
}

.tab:hover,
body:has(#panel-task2:not([hidden])) .tab:hover {
  border-color: rgba(242, 191, 24, .55);
  color: var(--hud-ivory);
  background: linear-gradient(180deg, #4c1815, #220606);
  box-shadow: inset 0 0 15px rgba(0, 0, 0, .44);
  transform: none;
}

.tab.is-active,
.tab.is-active:hover,
body:has(#panel-task2:not([hidden])) .tab.is-active,
body[data-task2-theme='light']:has(#panel-task2:not([hidden])) .tab.is-active {
  border-color: var(--hud-gold-bright);
  color: #fff6d6;
  background: linear-gradient(180deg, #b20d14 0%, #790008 50%, #300004 100%);
  box-shadow: inset 0 0 0 1px rgba(76, 0, 0, .9), inset 0 8px 18px rgba(255, 78, 55, .12), 0 0 9px rgba(242, 191, 24, .17);
}

.tab-index,
.tab.is-active .tab-index {
  width: 38px;
  height: 38px;
  border: 1px solid var(--hud-gold-deep);
  border-radius: 0;
  color: var(--hud-gold-bright);
  background: #11110f;
  box-shadow: inset 0 0 0 1px #000;
}

.tab strong {
  color: inherit;
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  font-size: 1.2rem;
  font-variant: small-caps;
  letter-spacing: .045em;
}

.tab small,
.tab.is-active small,
body[data-task2-theme='light']:has(#panel-task2:not([hidden])) .tab small {
  color: #d6ccb6;
}

.panel,
#panel-task2,
body[data-task2-theme='light'] #panel-task2 {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 0 0 26px;
  border: 2px solid var(--hud-gold-deep);
  border-radius: 0;
  color: var(--hud-ivory);
  background:
    linear-gradient(rgba(9, 9, 8, .79), rgba(5, 5, 4, .9)),
    url("https://edmund-public-media.edmundeducation.workers.dev/ielts-writing-preview/assets/citadel-command-background.webp") center 44% / cover fixed;
  box-shadow:
    inset 0 0 0 1px #090704,
    inset 0 0 0 3px rgba(242, 191, 24, .14),
    0 28px 70px rgba(0, 0, 0, .62);
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  z-index: 20;
  top: 10px;
  width: 33px;
  height: 33px;
  border-top: 3px double var(--hud-gold);
  pointer-events: none;
}

.panel::before {
  left: 10px;
  border-left: 3px double var(--hud-gold);
}

.panel::after {
  right: 10px;
  border-right: 3px double var(--hud-gold);
}

.panel-heading,
#panel-task2 .panel-heading,
body[data-task2-theme='light'] #panel-task2 .panel-heading {
  position: relative;
  z-index: 1;
  min-height: 164px;
  margin: 0 0 18px;
  padding: 30px clamp(26px, 4vw, 58px);
  border: 0;
  border-bottom: 1px solid var(--hud-line);
  color: var(--hud-ivory);
  background:
    linear-gradient(90deg, rgba(7, 7, 6, .95), rgba(14, 13, 10, .82) 60%, rgba(36, 17, 8, .72)),
    url("https://edmund-public-media.edmundeducation.workers.dev/ielts-writing-preview/assets/citadel-command-background.webp") center 17% / cover;
  box-shadow: inset 0 -3px 0 rgba(52, 17, 0, .8), 0 9px 25px rgba(0, 0, 0, .35);
}

.panel-heading::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: 0;
  bottom: 0;
  width: min(46%, 660px);
  height: 100%;
  border-radius: 0;
  background:
    linear-gradient(135deg, transparent 0 62%, rgba(242, 191, 24, .06) 62% 63%, transparent 63%),
    radial-gradient(circle at 80% 10%, rgba(242, 191, 24, .09), transparent 52%);
  box-shadow: none;
}

.panel-heading .eyebrow,
#panel-task2 .panel-heading .eyebrow {
  color: var(--hud-gold-bright);
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  font-size: .78rem;
  letter-spacing: .22em;
  text-shadow: 0 2px 2px #000;
}

.panel-heading h2,
#panel-task2 .panel-heading h2 {
  color: var(--hud-gold-bright);
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  font-size: clamp(2.4rem, 4vw, 4rem);
  font-weight: 500;
  letter-spacing: .01em;
  line-height: 1.05;
  text-shadow: 0 2px 2px #000, 0 0 12px rgba(242, 191, 24, .16);
}

.panel-heading p:not(.eyebrow),
#panel-task2 .panel-heading p:not(.eyebrow) {
  color: #e3d8c0;
  font-size: .95rem;
}

.progress-block,
#panel-task2 .progress-block,
body[data-task2-theme='light'] #panel-task2 .progress-block {
  align-self: center;
  justify-items: stretch;
  width: 230px;
  min-width: 230px;
  padding: 15px 17px;
  border: 1px solid var(--hud-gold);
  border-radius: 0;
  color: var(--hud-ivory);
  background: linear-gradient(180deg, rgba(53, 8, 7, .9), rgba(18, 4, 3, .95));
  box-shadow: inset 0 0 0 1px #140000, inset 0 0 16px rgba(0, 0, 0, .5), 0 5px 13px rgba(0, 0, 0, .42);
}

.progress-block::before {
  content: "完成進度 / PROGRESS";
  color: var(--hud-gold-bright);
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .13em;
}

.progress-block .count,
#panel-task2 .progress-block .count {
  padding: 0;
  border: 0;
  color: #fff8dc;
  background: transparent;
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  font-size: 1.45rem;
  text-shadow: 0 2px 3px #000;
}

.progress-track,
#panel-task2 .progress-track,
body[data-task2-theme='light'] #panel-task2 .progress-track {
  height: 7px;
  border: 1px solid #140a00;
  border-radius: 0;
  background: #090807;
  box-shadow: inset 0 1px 3px #000;
}

.progress-track > span,
#panel-task2 .progress-track > span,
body[data-task2-theme='light'] #panel-task2 .progress-track > span {
  border-radius: 0;
  background: linear-gradient(90deg, #a45c00, var(--hud-gold-bright));
  box-shadow: 0 0 7px rgba(242, 191, 24, .45);
}

/* Search and tool panels */
.study-tools,
#panel-task1 > .toolbar,
#panel-task2 .study-tools,
body[data-task2-theme='light'] #panel-task2 .study-tools {
  margin: 0 22px 16px;
  padding: 16px 18px;
  border: 1px solid var(--hud-line);
  border-radius: 0;
  color: var(--hud-ivory);
  background: linear-gradient(180deg, rgba(17, 17, 15, .93), rgba(7, 8, 7, .94));
  box-shadow: inset 0 0 0 1px #050504, 0 9px 20px rgba(0, 0, 0, .3);
}

.toolbar label,
.toolbar .filter,
.control-label,
.reading-control__label,
#panel-task2 .toolbar label,
#panel-task2 .control-label {
  color: var(--hud-gold-bright);
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  font-size: .75rem;
  letter-spacing: .08em;
}

.toolbar input,
.menu-trigger,
.translation-toggle,
.reading-control__trigger,
.study-tools-toggle,
.highlight-toggle,
.highlight-clear,
.task2-theme-toggle,
#panel-task2 .menu-trigger,
#panel-task2 .translation-toggle,
#panel-task2 .reading-control__trigger {
  min-height: 48px;
  border: 1px solid #8e6b18;
  border-radius: 0;
  color: var(--hud-ivory);
  background: linear-gradient(180deg, #292825, #101111 58%, #090909);
  box-shadow: inset 0 0 0 1px #050505, 0 3px 8px rgba(0, 0, 0, .38);
}

.toolbar input {
  color: #fff8de;
  background: rgba(3, 4, 4, .82);
}

.toolbar input::placeholder {
  color: #998f7b;
}

.toolbar input:focus,
.menu-trigger:focus-visible,
.translation-toggle:focus-visible,
.reading-control__trigger:focus-visible,
.answer-trigger:focus-visible,
.question-audio:focus-visible,
.diagram-button:focus-visible,
.header-action:focus-visible,
.tab:focus-visible {
  outline: 3px solid var(--hud-gold-bright);
  outline-offset: 3px;
}

.menu-trigger:hover,
.translation-toggle:hover,
.reading-control__trigger:hover,
.study-tools-toggle:hover,
.highlight-toggle:hover,
.highlight-clear:hover,
.task2-theme-toggle:hover {
  border-color: var(--hud-gold-bright);
  background: linear-gradient(180deg, #55100f, #230405);
}

.translation-toggle[aria-pressed="true"],
.highlight-toggle[aria-pressed="true"],
.task2-view-filters button[aria-pressed="true"],
body[data-task2-theme='light'] #panel-task2 .translation-toggle[aria-pressed='true'],
body[data-task2-theme='light'] #panel-task2 .highlight-toggle[aria-pressed='true'] {
  border-color: var(--hud-gold-bright);
  color: #fff8dc;
  background: linear-gradient(180deg, #ad1016, var(--hud-oxblood) 55%, var(--hud-oxblood-dark));
}

.study-tools__lower {
  border-top-color: rgba(242, 191, 24, .32);
}

.task2-view-filters,
body[data-task2-theme='light'] #panel-task2 .task2-view-filters {
  border: 1px solid #80631e;
  border-radius: 0;
  background: #080807;
}

.task2-view-filters button {
  color: #d9ceb6;
}

/* Scrollable records area */
.table-scroll,
#panel-task2 .table-scroll,
body[data-task2-theme='light'] #panel-task2 .table-scroll {
  height: min(70vh, 850px);
  margin: 0 22px;
  padding: 10px 12px 16px;
  border: 1px solid rgba(242, 191, 24, .42);
  border-radius: 0;
  color: var(--hud-ivory);
  background: rgba(4, 5, 4, .69);
  box-shadow: inset 0 0 26px rgba(0, 0, 0, .5);
  scrollbar-color: var(--hud-gold-deep) #0a0907;
}

.table-scroll:focus-visible {
  outline-color: var(--hud-gold-bright);
}

.table-scroll table {
  border-spacing: 0 14px;
}

.table-scroll tbody tr {
  filter: drop-shadow(0 9px 10px rgba(0, 0, 0, .48));
}

.table-scroll tbody td,
.table-scroll tbody tr:nth-child(even) td {
  border-color: rgba(118, 82, 19, .75);
}

/* Task 1 records: parchment evidence on the left, command choices on the right. */
#panel-task1 tbody tr {
  border: 1px solid var(--hud-gold-deep);
  border-radius: 0;
  background: var(--hud-smoke);
  box-shadow: inset 0 0 0 1px #070604;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, .48));
}

#panel-task1 tbody tr:hover {
  border-color: var(--hud-gold-bright);
}

#panel-task1 tbody td:nth-child(1),
#panel-task1 tbody tr:nth-child(even) td:nth-child(1) {
  border: 0;
  border-right: 1px solid var(--hud-line);
  border-radius: 0;
  color: var(--hud-ink);
  background:
    linear-gradient(rgba(250, 246, 232, .97), rgba(229, 217, 191, .97)),
    repeating-linear-gradient(0deg, transparent 0 29px, rgba(91, 68, 24, .05) 29px 30px);
  box-shadow: inset 0 0 28px rgba(91, 57, 10, .11);
}

#panel-task1 tbody td:nth-child(n+2),
#panel-task1 tbody tr:nth-child(even) td:nth-child(n+2) {
  border: 0;
  border-radius: 0;
  color: var(--hud-ivory);
  background: linear-gradient(90deg, rgba(13, 13, 11, .96), rgba(25, 18, 12, .92));
}

#panel-task1 tbody td:nth-child(3),
#panel-task1 tbody td:nth-child(4) {
  border-top: 1px solid rgba(242, 191, 24, .25);
}

#panel-task1 .chart-cell .row-id {
  color: #8b5e00;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 800;
  letter-spacing: .12em;
}

#panel-task1 .chart-cell .question {
  color: #21180d;
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  font-size: calc(1.35rem * var(--question-scale, 1));
  font-weight: 700;
  line-height: 1.52;
}

#panel-task1 .question-audio,
#panel-task2 .question-audio {
  border: 1px solid #9f761a;
  border-radius: 0;
  color: #fff1c6;
  background: linear-gradient(180deg, #6f080b, #320204);
}

#panel-task1 .question-audio:hover,
#panel-task1 .question-audio.is-playing,
#panel-task2 .question-audio:hover,
#panel-task2 .question-audio.is-playing {
  border-color: var(--hud-gold-bright);
  background: linear-gradient(180deg, #b41419, #5e0308);
}

#panel-task1 .diagram-button {
  padding: 16px;
  border: 1px solid #9e7a2d;
  border-radius: 0;
  background: #f8f5e9;
  box-shadow: inset 0 0 0 4px #e2d8bf, 0 6px 12px rgba(51, 33, 7, .15);
}

#panel-task1 .diagram-button:hover {
  border-color: #6e4800;
  background: #fffdf5;
}

#panel-task1 .diagram-button img {
  max-height: 370px;
  filter: none;
}

#panel-task1 .diagram-button span {
  color: #4f3915;
}

#panel-task1 .task1-answer-cell::before {
  color: var(--hud-gold-bright);
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
  letter-spacing: .1em;
}

.answer-trigger,
#panel-task1 .answer-trigger,
#panel-task2 .answer-trigger,
#panel-task2:not(.is-admin) .answer-trigger {
  min-height: 54px;
  border: 1px solid var(--hud-gold-deep);
  border-radius: 0;
  color: #e7dcc3;
  background: linear-gradient(180deg, #2a2925, #121212 58%, #090909);
  box-shadow: inset 0 0 0 1px #030303, 0 4px 9px rgba(0, 0, 0, .42);
}

.answer-trigger:hover,
#panel-task1 .answer-trigger:hover,
#panel-task2 .answer-trigger:hover {
  border-color: var(--hud-gold-bright);
  color: #fff8da;
  background: linear-gradient(180deg, #6a0d0d, #2f0304);
  transform: none;
}

.answer-trigger.is-selected,
#panel-task1 .answer-trigger.is-selected,
#panel-task2 .answer-trigger.is-selected,
#panel-task2:not(.is-admin) .answer-trigger.is-selected {
  border-color: var(--hud-gold-bright);
  color: #fff9dc;
  background: linear-gradient(180deg, #bd1117, #7b0008 52%, #310004);
  box-shadow: inset 0 0 0 1px #3c0003, 0 0 10px rgba(242, 191, 24, .2);
}

.answer-trigger .answer-marker,
.answer-trigger.is-selected .answer-marker {
  color: var(--hud-gold-bright);
}

/* Task 2 keeps the long-form question on an uncluttered parchment plane. */
#panel-task2:not(.is-admin) .table-scroll tbody tr,
body[data-task2-theme='light'] #panel-task2:not(.is-admin) .table-scroll tbody tr:nth-child(n) {
  border: 1px solid var(--hud-gold-deep);
  border-radius: 0;
  background: transparent;
  box-shadow: 0 10px 16px rgba(0, 0, 0, .4);
}

#panel-task2:not(.is-admin) .table-scroll tbody td,
#panel-task2:not(.is-admin) .table-scroll tbody tr:nth-child(even) td {
  border-color: #725418;
  border-radius: 0;
}

#panel-task2:not(.is-admin) .task2-meta-cell,
#panel-task2:not(.is-admin) tbody tr:nth-child(even) .task2-meta-cell {
  border-left: 4px solid var(--hud-gold);
  color: var(--hud-ivory);
  background: linear-gradient(180deg, #211c15, #0c0c0a);
}

#panel-task2:not(.is-admin) .task2-meta-cell .row-id {
  color: var(--hud-gold-bright);
}

#panel-task2:not(.is-admin) .task2-meta-cell .topic {
  color: var(--hud-muted);
}

#panel-task2:not(.is-admin) .prompt-cell,
#panel-task2:not(.is-admin) tbody tr:nth-child(even) .prompt-cell,
body[data-task2-theme='light'] #panel-task2:not(.is-admin) .prompt-cell {
  color: #1c160e;
  background: linear-gradient(180deg, #f4eedc, #ded0b1);
}

#panel-task2:not(.is-admin) .table-scroll tbody td.prompt-cell,
#panel-task2:not(.is-admin) .table-scroll tbody tr:nth-child(even) td.prompt-cell,
#panel-task2:not(.is-admin) .table-scroll tbody tr:hover td.prompt-cell,
body[data-task2-theme='light'] #panel-task2:not(.is-admin) .table-scroll tbody td.prompt-cell {
  color: #1c160e;
  background: linear-gradient(180deg, #f4eedc, #ded0b1);
  box-shadow: inset 0 0 28px rgba(91, 57, 10, .08);
}

#panel-task2:not(.is-admin) .question {
  color: #1b150e;
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
}

#panel-task2:not(.is-admin) .prompt-task-line {
  color: #65320b;
}

#panel-task2:not(.is-admin) .table-scroll tbody td.prompt-cell .translation {
  border-top-color: #a58a55;
  color: #4b3824;
}

#panel-task2:not(.is-admin) tbody td:last-child,
#panel-task2:not(.is-admin) tbody tr:nth-child(even) td:last-child,
body[data-task2-theme='light'] #panel-task2:not(.is-admin) tbody td:last-child {
  border-left: 1px solid var(--hud-line);
  color: var(--hud-ivory);
  background: linear-gradient(180deg, #171613, #090a09);
}

#panel-task2:not(.is-admin) tbody td:last-child::before {
  color: var(--hud-gold-bright);
  font-family: Georgia, "Times New Roman", "Noto Serif TC", serif;
}

#panel-task2 .task2-theme-toggle,
body[data-task2-theme='light'] #panel-task2 .task2-theme-toggle {
  border: 1px solid var(--hud-gold) !important;
  border-radius: 0 !important;
  color: var(--hud-ivory) !important;
  background: linear-gradient(180deg, #55100f, #230405) !important;
}

#panel-task2 .task2-feedback.is-correct {
  border-color: #d6a91a;
  color: #fff6cc;
  background: #21351f;
}

#panel-task2 .task2-feedback.is-wrong {
  border-color: #d39a24;
  color: #fff0d0;
  background: #4b1714;
}

/* Popovers and dialogs */
.choice-menu,
.choice-menu.is-compact,
.choice-menu.is-task2-menu,
.choice-menu.is-task2-menu.is-compact,
body[data-task2-theme='light'] .choice-menu.is-task2-menu,
body[data-task2-theme='light'] .choice-menu.is-task2-menu.is-compact {
  border: 1px solid var(--hud-gold);
  border-radius: 0;
  color: var(--hud-ivory);
  background: rgba(10, 10, 9, .98);
  box-shadow: inset 0 0 0 1px #000, 0 18px 45px rgba(0, 0, 0, .7);
  backdrop-filter: blur(14px);
}

.choice-menu__option,
.choice-menu.is-task2-menu .choice-menu__option,
body[data-task2-theme='light'] .choice-menu.is-task2-menu .choice-menu__option {
  color: #e8ddc4;
}

.choice-menu__option:hover,
.choice-menu__option:focus-visible,
.choice-menu.is-task2-menu .choice-menu__option:hover,
.choice-menu.is-task2-menu .choice-menu__option:focus-visible,
body[data-task2-theme='light'] .choice-menu.is-task2-menu .choice-menu__option:hover,
body[data-task2-theme='light'] .choice-menu.is-task2-menu .choice-menu__option:focus-visible {
  color: #fff6d2;
  background: #4d0b0c;
}

.choice-menu__option[aria-checked="true"],
.choice-menu.is-compact .choice-menu__option[aria-checked="true"],
.choice-menu.is-task2-menu .choice-menu__option[aria-checked='true'],
.choice-menu.is-task2-menu.is-compact .choice-menu__option[aria-checked='true'],
body[data-task2-theme='light'] .choice-menu.is-task2-menu .choice-menu__option[aria-checked='true'] {
  color: #fff9dc;
  background: linear-gradient(90deg, #8c030b, #420205);
}

dialog,
.login-dialog,
.highlight-dialog {
  border: 2px solid var(--hud-gold);
  border-radius: 0;
  color: var(--hud-ink);
  background: linear-gradient(145deg, #f5efde, #d8c9a8);
  box-shadow: inset 0 0 0 2px #5b3b08, 0 30px 90px rgba(0, 0, 0, .78);
}

dialog::backdrop {
  background: rgba(2, 3, 3, .8);
  backdrop-filter: blur(8px);
}

.dialog-close,
.login-submit,
.highlight-dialog-actions button {
  border: 1px solid var(--hud-gold);
  border-radius: 0;
  color: var(--hud-ivory);
  background: linear-gradient(180deg, #a50b12, var(--hud-oxblood) 55%, var(--hud-oxblood-dark));
}

#diagram-dialog img {
  border: 1px solid #8a6724;
  background: #fff;
  filter: none;
}

.login-gate {
  border: 2px solid var(--hud-gold-deep);
  border-radius: 0;
  color: var(--hud-ivory);
  background:
    linear-gradient(115deg, rgba(8, 8, 7, .96), rgba(31, 13, 8, .88)),
    url("https://edmund-public-media.edmundeducation.workers.dev/ielts-writing-preview/assets/citadel-command-background.webp") center / cover;
  box-shadow: inset 0 0 0 2px #090704, 0 24px 70px rgba(0, 0, 0, .62);
}

.login-gate-intro .eyebrow,
.login-gate-intro h2 {
  color: var(--hud-gold-bright);
  text-shadow: 0 2px 3px #000;
}

.login-gate-intro > p:last-child {
  text-wrap: balance;
}

.login-gate-title-line {
  display: block;
  white-space: nowrap;
}

.login-gate-intro > p:last-child,
.login-form > label {
  color: #e0d4ba;
}

.login-form input[type="text"],
.login-form input[type="password"] {
  border-color: #8d6a1c;
  border-radius: 0;
  color: #fff6da;
  background: #090908;
}

.gate-form-host .login-form,
.login-dialog .login-form {
  border: 1px solid var(--hud-gold-deep);
  border-radius: 0;
  color: var(--hud-ivory);
  background: linear-gradient(155deg, rgba(25, 22, 17, .98), rgba(8, 8, 7, .98));
  box-shadow: inset 0 0 0 1px #050504, 0 16px 34px rgba(0, 0, 0, .42);
}

.gate-form-host .login-form h2,
.login-dialog .login-form h2,
.gate-form-host .login-form > label,
.login-dialog .login-form > label,
.gate-form-host .login-modes,
.login-dialog .login-modes {
  color: var(--hud-ivory);
}

.gate-form-host .login-form h2,
.login-dialog .login-form h2 {
  color: var(--hud-gold-bright);
}

.gate-form-host .login-form input,
.login-dialog .login-form input {
  accent-color: var(--hud-gold);
}

@media (max-width: 900px) {
  .header-context { display: none; }

  #panel-task1 tbody tr {
    grid-template-columns: minmax(0, 1.25fr) minmax(230px, .75fr);
  }

  #panel-task2:not(.is-admin) tbody tr {
    overflow: hidden;
    border-left: 4px solid var(--hud-gold);
  }

  #panel-task2:not(.is-admin) .task2-meta-cell {
    border-left: 0;
    border-bottom: 1px solid var(--hud-line);
  }

  #panel-task2:not(.is-admin) tbody td:last-child {
    border-top: 1px solid var(--hud-line);
    border-left: 0;
  }
}

@media (max-width: 700px) {
  body,
  body:has(#panel-task2:not([hidden])),
  body[data-task2-theme='light']:has(#panel-task2:not([hidden])) {
    background-attachment: scroll;
    background-position: center top;
  }

  .site-header .header-inner {
    width: min(100% - 14px, 1840px);
    min-height: 64px;
  }

  .site-header .edmund-system-switcher__trigger {
    min-height: 48px;
    padding: 4px 8px 4px 4px;
  }

  .site-header .edmund-system-switcher__logo {
    width: 38px;
    height: 38px;
  }

  .site-header .edmund-system-switcher__copy strong {
    font-size: 1.02rem;
  }

  .site-header .edmund-system-switcher__copy small {
    max-width: 145px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .shell {
    width: calc(100% - 18px);
    padding-top: 19px;
  }

  .tabs,
  body:has(#panel-task2:not([hidden])) .tabs {
    margin-bottom: 11px;
    padding: 3px;
  }

  .tab,
  .tab.is-active {
    min-height: 58px;
    padding: 7px;
  }

  .tab-index,
  .tab.is-active .tab-index {
    width: 32px;
    height: 32px;
  }

  .panel,
  #panel-task2 {
    padding-bottom: 11px;
  }

  .panel::before,
  .panel::after {
    top: 7px;
    width: 22px;
    height: 22px;
  }

  .panel-heading,
  #panel-task2 .panel-heading {
    min-height: 142px;
    margin-bottom: 11px;
    padding: 21px 17px;
    gap: 11px;
  }

  .panel-heading h2,
  #panel-task2 .panel-heading h2 {
    font-size: clamp(1.85rem, 8vw, 2.55rem);
  }

  .panel-heading p:not(.eyebrow) {
    font-size: .75rem;
  }

  .progress-block,
  #panel-task2 .progress-block {
    width: 112px;
    min-width: 112px;
    padding: 10px;
  }

  .progress-block::before {
    content: "PROGRESS";
    font-size: .55rem;
  }

  .progress-block .count,
  #panel-task2 .progress-block .count {
    font-size: .78rem;
  }

  .study-tools,
  #panel-task1 > .toolbar,
  #panel-task2 .study-tools {
    margin: 0 10px 11px;
    padding: 11px;
  }

  .table-scroll,
  #panel-task2 .table-scroll {
    height: min(72vh, 820px);
    margin: 0 10px;
    padding: 6px 7px 8px;
  }

  #panel-task1 tbody tr {
    display: block;
    border-left: 4px solid var(--hud-gold);
  }

  #panel-task1 tbody td:nth-child(n) {
    display: block;
    width: 100%;
    padding: 15px;
  }

  #panel-task1 tbody td:nth-child(1) {
    border-right: 0;
    border-bottom: 1px solid var(--hud-line);
  }

  #panel-task1 tbody td:nth-child(n+2),
  #panel-task1 tbody tr:nth-child(even) td:nth-child(n+2) {
    border-top: 1px solid rgba(242, 191, 24, .2);
    background: linear-gradient(180deg, rgba(18, 17, 14, .98), rgba(8, 8, 7, .98));
  }

  #panel-task1 .diagram-button {
    padding: 10px;
  }

  #panel-task1 .diagram-button img {
    max-height: 245px;
  }

  #panel-task2:not(.is-admin) tbody td,
  #panel-task2:not(.is-admin) tbody td:first-child,
  #panel-task2:not(.is-admin) tbody td:last-child {
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
