@import url('https://fonts.googleapis.com/css2?family=Geist+Pixel&display=swap');

:root {
  --app-font: 'Geist Pixel';
  --quiz-font-scale: 1;

  --page-bg: #f5f6f8;
  --page-bg-alt: #eef1f5;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-muted: #f7f8fb;
  --surface-hover: #f1f6ff;

  --text-primary: #17191d;
  --text-secondary: #5f6672;
  --text-muted: #858d99;

  --border-subtle: #d9dee7;
  --border-strong: #b8c0cc;
  --accent: #2563eb;
  --accent-soft: #eef5ff;
  --accent-border: #3b82f6;
  --success: #22a66a;
  --warning: #d59a00;
  --danger: #df5967;
  --danger-soft: #fff0f2;
  --focus-ring: rgba(37, 99, 235, 0.22);

  --shadow-card: 0 14px 34px rgba(28, 36, 50, 0.09);
  --shadow-control: 0 5px 14px rgba(28, 36, 50, 0.07);
  --shadow-popover: 0 16px 36px rgba(28, 36, 50, 0.16);
  --shadow-dialog: 0 26px 70px rgba(28, 36, 50, 0.2);
  --control-hover-shadow: rgba(37, 99, 235, 0.12);
  --inner-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --overlay-bg: rgba(245, 247, 250, 0.86);

  /* Legacy variables retained for existing markup and inline styles. */
  --bg-white: var(--text-primary);
  --bg-black: var(--surface);
  --hover-gray: #edf1f6;
}

.dark-mode {
  --page-bg: #08090b;
  --page-bg-alt: #0d0f12;
  --surface: #14161a;
  --surface-elevated: #191c21;
  --surface-muted: #101216;
  --surface-hover: #1d2127;

  --text-primary: #f4f6f8;
  --text-secondary: #b5bbc4;
  --text-muted: #818892;

  --border-subtle: #34383f;
  --border-strong: #555b64;
  --accent: #f7f8fa;
  --accent-soft: #1b1e23;
  --accent-border: #f2f4f7;
  --success: #58c987;
  --warning: #efbd3f;
  --danger: #f1727e;
  --danger-soft: rgba(241, 114, 126, 0.11);
  --focus-ring: rgba(255, 255, 255, 0.18);

  --shadow-card: 0 18px 42px rgba(0, 0, 0, 0.36);
  --shadow-control: 0 7px 18px rgba(0, 0, 0, 0.24);
  --shadow-popover: 0 18px 42px rgba(0, 0, 0, 0.48);
  --shadow-dialog: 0 28px 76px rgba(0, 0, 0, 0.58);
  --control-hover-shadow: rgba(255, 255, 255, 0.08);
  --inner-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.055);
  --overlay-bg: rgba(4, 5, 7, 0.84);

  /* Legacy variables retained for existing markup and inline styles. */
  --bg-white: var(--text-primary);
  --bg-black: var(--surface);
  --hover-gray: #22262c;
}

html,
body,
body *,
body *::before,
body *::after,
button,
input,
select,
textarea,
option,
optgroup,
table,
th,
td,
svg text {
  font-family: var(--app-font) !important;
}

html {
  font-family: var(--app-font) !important;
}

body {
  font-family: var(--app-font) !important;
  background: var(--bg-white) !important;
  color: var(--bg-black) !important;
  padding: 12px;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  box-sizing: border-box;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}


button,
input,
select,
textarea {
  font-family: var(--app-font) !important;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.app-workspace {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 850px;
  width: 100%;
  justify-content: center;
  padding-bottom: 20px;
  align-items: stretch;
}

.dashboard-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  width: 100%;
  margin-top: 10px;
  box-sizing: border-box;
}
.greeting-container {
  min-width: 0;
  margin: 0;
  width: auto;
  text-align: left;
  color: var(--bg-black) !important;
}

.dashboard-header-controls {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  width: auto;
  min-height: 38px;
  box-sizing: border-box;
}
.outside-control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 50%;
  background: var(--bg-white) !important;
  color: var(--bg-black) !important;
  border: 1px solid var(--bg-black) !important;
  font-family: var(--app-font) !important;
  cursor: pointer;
  flex: 0 0 38px;
  transition:
    background 0.2s,
    color 0.2s,
    transform 0.2s;
}
.outside-control-btn:hover {
  background: var(--bg-black) !important;
  color: var(--bg-white) !important;
  transform: translateY(-1px);
}
.outside-control-btn:active {
  transform: translateY(0);
}
.subject-insights-control,
.theme-control {
  width: 38px;
  height: 38px;
  border-radius: 50%;
}
.outside-control-btn svg {
  width: 19px;
  height: 19px;
  display: block;
  flex-shrink: 0;
}

.game-container {
  background: var(--bg-black) !important;
  color: var(--bg-white) !important;
  padding: 18px 22px;
  border-radius: 16px;
  position: relative;
  border: 1px solid var(--bg-black);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.header-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--bg-white);
  padding-bottom: 12px;
  margin-bottom: 16px;
  gap: 10px;
}
.mode-badge {
  color: var(--bg-white) !important;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 55%;
}
.stats-group {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}
.score-box {
  font-weight: 600;
  background: var(--bg-black) !important;
  color: var(--bg-white) !important;
  border: 1px solid var(--bg-white) !important;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  white-space: nowrap;
}
.timer-box {
  font-weight: 600;
  background: var(--bg-black) !important;
  color: var(--bg-white) !important;
  border: 1px solid var(--bg-white) !important;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  min-width: 55px;
  text-align: center;
  white-space: nowrap;
}
.timer-box.study-mode {
  background: var(--bg-black) !important;
  color: var(--bg-white) !important;
  border-color: var(--bg-white) !important;
}
.timer-box.flashcard-mode {
  background: var(--bg-black) !important;
  color: var(--bg-white) !important;
  border-color: var(--bg-white) !important;
}
.timer-box.urgent {
  background: var(--bg-white) !important;
  color: var(--bg-black) !important;
  border-color: var(--bg-black) !important;
  animation: pulse 1s infinite;
}

.question-title {
  font-size: 19px;
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 16px;
  word-break: break-word;
  text-align: justify;
  color: var(--bg-white) !important;
}
.question-title span {
  font-weight: 800;
  color: var(--bg-white) !important;
  margin-right: 8px;
}
.choices-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.choice-btn {
  display: flex;
  align-items: center;
  background: var(--bg-black) !important;
  border: 1px solid var(--bg-white) !important;
  border-radius: 12px;
  padding: 12px 16px;
  text-align: left;
  font-size: 15px;
  color: var(--bg-white) !important;
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s;
  width: 100%;
  box-sizing: border-box;
  word-break: break-word;
  font-family: var(--app-font) !important;
}
.choice-btn:hover:not([disabled]) {
  background: var(--bg-white) !important;
  border-color: var(--bg-white) !important;
  color: var(--bg-black) !important;
}
.choice-btn.correct {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: #10b981 !important;
  color: #34d399 !important;
  font-weight: 600;
}
.choice-btn.wrong {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: #ef4444 !important;
  color: #f87171 !important;
  animation: shake 0.4s linear;
}
.choice-letter {
  font-weight: 700;
  margin-right: 14px;
  color: inherit;
  text-transform: uppercase;
  flex-shrink: 0;
}

.action-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 16px;
  border-top: 1px solid var(--bg-white);
  padding-top: 16px;
  gap: 12px;
}
.next-btn {
  background: var(--bg-white) !important;
  color: var(--bg-black) !important;
  border: 1px solid var(--bg-white) !important;
  padding: 14px 28px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: none;
  text-align: center;
  justify-content: center;
  font-family: var(--app-font) !important;
}
.next-btn:hover {
  background: var(--hover-gray) !important;
}

.subject-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 16px;
}
.subj-card {
  background: var(--bg-black) !important;
  border: 1px solid var(--bg-white) !important;
  padding: 12px 16px;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
  gap: 10px;
  position: relative;
  color: var(--bg-white) !important;
}
.subj-card:hover {
  background: var(--bg-white) !important;
  border-color: var(--bg-white) !important;
  color: var(--bg-black) !important;
}
.subj-card:hover * {
  color: var(--bg-black) !important;
}
.subj-card .card-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 1;
  width: calc(100% - 32px);
  overflow: hidden;
  gap: 10px;
}
.subj-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subj-remove-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-black) !important;
  border: 1px solid var(--bg-white) !important;
  color: var(--bg-white) !important;
  font-size: 18px;
  font-family: var(--app-font) !important;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  line-height: 1;
  z-index: 2;
  padding: 0;
}
.subj-remove-btn::before {
  content: '\00d7';
  transform: translateY(-1px);
}
.subj-remove-btn:hover {
  background: var(--bg-white) !important;
  color: var(--bg-black) !important;
  border-color: var(--bg-white) !important;
  transform: scale(1.08);
}

.ultimate-btn {
  background: var(--bg-white) !important;
  color: var(--bg-black) !important;
  border: 1px solid var(--bg-white) !important;
  padding: 14px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  margin-top: 16px;
  transition: transform 0.2s;
  font-family: var(--app-font) !important;
}
.ultimate-btn:hover {
  background: var(--hover-gray) !important;
}

.file-upload-box {
  border: 2px dashed var(--bg-white) !important;
  min-height: 120px;
  padding: 16px 20px;
  text-align: center;
  border-radius: 14px;
  margin-bottom: 16px;
  cursor: pointer;
  background: var(--bg-black) !important;
  margin-top: 0px;
  transition:
    background 0.2s,
    border-color 0.2s,
    transform 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  color: var(--bg-white) !important;
}
.file-upload-box:hover {
  background: var(--bg-white) !important;
  border-color: var(--bg-white) !important;
  color: var(--bg-black) !important;
}
.file-upload-box:hover * {
  color: var(--bg-black) !important;
}
.upload-icon {
  width: 44px;
  height: 44px;
  color: inherit;
  opacity: 0.9;
  margin-bottom: 8px;
}
.upload-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  stroke: currentColor;
}
.upload-primary {
  margin: 0;
  color: inherit;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
}
.upload-primary strong {
  color: inherit;
  font-weight: 800;
}
.upload-secondary {
  margin: 2px 0 0;
  color: inherit;
  font-size: 15px;
  font-weight: 500;
}

.dashboard-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
  width: 100%;
}
.import-subject-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex-shrink: 0;
  background: var(--bg-black) !important;
  color: var(--bg-white) !important;
  border: 1px solid var(--bg-white) !important;
  border-radius: 9px;
  padding: 8px 11px;
  font-family: var(--app-font) !important;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s;
}
.import-subject-btn:hover {
  background: var(--bg-white) !important;
  color: var(--bg-black) !important;
}
.import-subject-btn svg {
  width: 17px;
  height: 17px;
  display: block;
  stroke: currentColor;
}


.mode-button-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  margin-bottom: 16px;
  position: relative;
}
.mode-btn {
  padding: 12px 8px;
  min-height: 68px;
  font-weight: 700;
  border-radius: 12px;
  border: 2px solid var(--bg-white) !important;
  background: var(--bg-black) !important;
  color: var(--bg-white) !important;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  box-shadow: none !important;
  font-family: var(--app-font) !important;
}
.mode-btn:hover {
  background: var(--bg-white) !important;
  color: var(--bg-black) !important;
  transform: translateY(-1px);
}
.mode-btn:hover * {
  color: var(--bg-black) !important;
}
.mode-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  text-align: center;
  width: 100%;
}
.mode-title {
  font-size: 16px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}
.mode-subtitle {
  color: inherit;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 500;
}

.mode-btn.active-study,
.mode-btn.active-exam,
.mode-btn.active-flashcards {
  background: var(--bg-white) !important;
  border-color: var(--bg-white) !important;
  color: var(--bg-black) !important;
  box-shadow: none !important;
}
.mode-btn.active-study *,
.mode-btn.active-exam *,
.mode-btn.active-flashcards * {
  color: var(--bg-black) !important;
}

