* {
  box-sizing: border-box;
}

body {
  --app-text-size: 16px;
  --app-control-size: 15px;
  --app-question-size: 16px;
  margin: 0;
  background: #f6f7fb;
  color: #222;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: var(--app-text-size);
  line-height: 1.7;
}

body[data-font-size="small"] {
  --app-text-size: 15px;
  --app-control-size: 14px;
  --app-question-size: 15px;
}

body[data-font-size="large"] {
  --app-text-size: 18px;
  --app-control-size: 16px;
  --app-question-size: 19px;
}

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 12px 12px calc(140px + env(safe-area-inset-bottom));
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(246, 247, 251, 0.96);
  border-bottom: 1px solid #ddd;
  padding: 12px 0;
  backdrop-filter: blur(8px);
}

.header-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  flex-shrink: 0;
}

.menu-wrap,
.service-switcher-wrap {
  position: relative;
  flex-shrink: 0;
}

h1 {
  margin: 0;
  font-size: 20px;
}

.home-button {
  margin: 0;
  padding: 0;
  border-radius: 4px;
  background: transparent;
  color: #222;
  font: inherit;
  text-align: left;
}

.home-button:not(:disabled):hover {
  color: #255ec7;
  background: transparent;
  box-shadow: none;
}

h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

h3 {
  margin: 18px 0 8px;
  font-size: 15px;
}

hr {
  border: none;
  border-top: 1px solid #e6e8ed;
  margin: 18px 0;
}

input,
select {
  width: 100%;
  padding: 12px;
  margin: 8px 0;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 16px;
  background: #fff;
}

button {
  border: none;
  border-radius: 8px;
  padding: 11px 14px;
  margin: 4px;
  font-weight: 700;
  cursor: pointer;
  font-size: var(--app-control-size);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease, opacity 0.15s ease;
}

button:not(:disabled):active {
  transform: translateY(1px);
}

button:focus-visible {
  outline: 3px solid rgba(37, 94, 199, 0.24);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  box-shadow: none;
}

.card {
  background: white;
  border: 1px solid #ddd;
  border-radius: 14px;
  padding: 16px;
  margin: 12px 0;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

#searchView > .card,
#practiceListView > .card {
  padding-bottom: calc(112px + env(safe-area-inset-bottom));
}

.primary {
  background: #255ec7;
  color: white;
}

.primary:not(:disabled):hover {
  background: #1f51ad;
  box-shadow: 0 6px 14px rgba(37, 94, 199, 0.18);
}

.secondary {
  background: #edf2ff;
  color: #255ec7;
}

.secondary:not(:disabled):hover {
  background: #dfe8ff;
}

.danger {
  background: #fff0f0;
  color: #d63333;
}

.hidden {
  display: none !important;
}

.auth-status,
.message {
  color: #666;
  font-size: 13px;
}

.auth-status-purchase-link {
  color: #255ec7;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-loading-view {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-loading-view h2 {
  margin-bottom: 4px;
}

.auth-loading-view .message {
  margin: 0;
}

.auth-start-guide,
.auth-password-guide,
.auth-account-note {
  color: #555;
  font-size: 14px;
  line-height: 1.6;
}

.auth-start-guide {
  margin: 12px 0 8px;
}

.auth-password-guide,
.auth-account-note {
  margin: 8px 0;
}

.auth-agreement {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 0 10px;
  color: #555;
  font-size: 14px;
  line-height: 1.6;
}

.auth-agreement input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
}

.auth-agreement a {
  color: #255ec7;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-purchase-content {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #eef0f3;
}

.auth-purchase-heading {
  margin: 0 0 10px;
  font-size: 18px;
}

.main-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 12px 0;
}

.main-tabs button {
  background: white;
  border: 1px solid #ddd;
  color: #333;
}

.main-tabs button.active {
  background: #255ec7;
  color: white;
  border-color: #255ec7;
}

.menu-button {
  width: 44px;
  height: 44px;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 0;
  background: #255ec7;
  color: white;
  border-radius: 12px;
}

.menu-button span {
  width: 21px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  display: block;
}

.service-switch-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: #255ec7;
  color: #ffffff;
}

.service-switch-button:not(:disabled):hover {
  background: #1f51ad;
}

.service-switch-icon {
  color: currentColor;
  font-size: 18px;
  line-height: 1;
}

.service-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(246, 247, 251, 0.76);
  backdrop-filter: blur(2px);
}

.service-loading-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  padding: 14px 16px;
  border: 1px solid #d8dee8;
  border-radius: 12px;
  background: #ffffff;
  color: #344160;
  font-weight: 700;
  box-shadow: 0 12px 36px rgba(0,0,0,0.16);
}

.service-switcher {
  position: absolute;
  top: 48px;
  right: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 150px;
  padding: 8px;
  border: 1px solid #d8dee8;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.service-switcher button {
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid transparent;
  background: transparent;
  color: #44546a;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
}

.service-switcher button.active {
  border-color: #255ec7;
  background: #255ec7;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(37, 94, 199, 0.16);
}

.service-switcher button:not(.active):not(:disabled):hover {
  background: #f3f6fb;
}

.header-menu {
  position: absolute;
  top: 48px;
  right: 0;
  width: 300px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 8px;
}

.header-menu button,
.header-menu-link {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  padding: 11px 14px;
  border-radius: 8px;
  text-align: left;
  margin: 0;
  background: white;
  color: #333;
  font-family: inherit;
  font-size: var(--app-control-size);
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
}

.header-menu button:hover,
.header-menu-link:hover {
  background: #f3f6fb;
}

.menu-font-size {
  padding: 4px 4px 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid #eef0f3;
}

.menu-font-size-label {
  margin: 0 2px 6px;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.menu-font-size-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.menu-font-size-options button {
  min-height: 36px;
  padding: 8px 6px;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  text-align: center;
}

.menu-font-size-options button.active {
  border-color: #255ec7;
  background: #255ec7;
  color: #ffffff;
}

.account-access-status {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #eef0f3;
}

.account-access-status h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.account-access-status-list {
  display: grid;
  gap: 6px;
  color: #333;
  font-size: 13px;
  line-height: 1.45;
}

.account-access-status-item {
  padding: 9px 10px;
  border: 1px solid #e4e8ef;
  border-radius: 8px;
  background: #fafbfe;
}

.account-access-status-service {
  font-weight: 700;
}

.account-access-status-state {
  margin-top: 2px;
  color: #255ec7;
  font-weight: 700;
}

.account-access-status-date {
  margin-top: 1px;
  color: #667085;
}

.account-access-status-purchase-link {
  display: inline-block;
  margin-top: 4px;
  color: #667085;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.account-access-status-purchase-link:hover {
  color: #255ec7;
}

.app-version-info {
  margin-top: 8px;
  padding: 8px 6px 2px;
  border-top: 1px solid #eef0f3;
  color: #667085;
  font-size: 11px;
  line-height: 1.4;
  text-align: right;
}

.section {
  margin-bottom: 10px;
}

.resume-actions {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 8px;
}

.resume-button {
  background: #fff3e8;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.resume-button:not(:disabled):hover {
  background: #ffead5;
  border-color: #fdba74;
}

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

.recommend-button {
  background: #369bde;
  color: white;
}

.reset-button {
  background: #ff8787;
  color: white;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#categoryButtons .all-button,
#yearButtons .all-button {
  flex-basis: 100%;
  width: fit-content;
}

.category-group-list {
  flex-basis: 100%;
  display: grid;
  gap: 10px;
}

.category-filter-group {
  padding: 10px;
  border: 1px solid #d8dee8;
  border-radius: 10px;
  background: #fbfcff;
}

.category-group-toggle {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #44546a;
  font-size: 13px;
  text-align: left;
}

.category-group-toggle:not(:disabled):hover {
  background: #eef4ff;
  border-color: #d8e5ff;
}

.category-group-toggle-icon {
  flex: 0 0 auto;
  color: #255ec7;
  font-size: 16px;
  line-height: 1;
  transition: transform 0.15s ease;
}

.category-group-toggle[aria-expanded="false"] {
  margin-bottom: 0;
}

.category-group-toggle[aria-expanded="false"] .category-group-toggle-icon {
  transform: rotate(180deg);
}

.category-group-panel {
  margin-top: 8px;
}

.full-width-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}

#difficultyButtons,
#favoriteButtons,
#statusButtons {
  display: flex;
  flex-wrap: wrap;
}

#difficultyButtons .toggle,
#favoriteButtons .toggle,
#statusButtons .toggle {
  flex: 0 0 84px;
  width: 84px;
  min-width: 0;
  margin: 0;
  padding-inline: 8px;
}

#favoriteButtons .toggle {
  flex-basis: 128px;
  width: 128px;
}

.toggle {
  background: #f0f0f0;
  color: #333;
}

.toggle.active {
  background: #3498db;
  color: white;
}

.toggle.all-button {
  background: #eef2f7;
  color: #333;
}

.toggle.all-button.active {
  background: #255ec7;
  color: white;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.action-column {
  display: grid;
  gap: 8px;
}

.sync-description {
  margin: 0 0 14px;
  color: #44546a;
  font-size: 14px;
  line-height: 1.7;
}

.list-header,
.view-title-row,
.exercise-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.preset-section {
  margin-top: 20px;
}

.preset-section h3 {
  margin-top: 0;
}

.preset-list {
  display: grid;
  gap: 12px;
}

.preset-card {
  width: 100%;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 14px;
  background: #ffffff;
  color: #333;
  text-align: left;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.preset-card:active {
  transform: scale(0.995);
}

.preset-card.active {
  border-color: #3498db;
  box-shadow: 0 6px 18px rgba(52,152,219,0.18);
}

.preset-main {
  padding: 14px 14px 10px;
}

.preset-title {
  display: block;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  color: #222;
}

.preset-footer {
  border-top: 1px solid #eef0f3;
  background: #fbfcfe;
}

.progress-bar-list {
  width: 100%;
  height: 14px;
  display: flex;
  overflow: hidden;
  background: #e5e7eb;
}

.seg-correct {
  background: #5bbf73;
}

.seg-incorrect {
  background: #e56b6f;
}

.seg-unanswered {
  background: #b8bcc4;
}

.progress-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 10px 14px 12px;
  font-size: 12px;
  color: #555;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 9999px;
  display: inline-block;
  flex-shrink: 0;
}

.dot-correct {
  background: #5bbf73;
}

.dot-incorrect {
  background: #e56b6f;
}

.dot-unanswered {
  background: #b8bcc4;
}

.score-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.score-toolbar h3 {
  margin: 0;
}

.score-difficulty-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(40px, 1fr));
  gap: 6px;
  min-width: min(100%, 220px);
}

.score-difficulty-button {
  min-height: 40px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #d7dce5;
  background: #ffffff;
  color: #333;
}

.score-difficulty-button.active {
  border-color: #255ec7;
  background: #255ec7;
  color: #ffffff;
}

.score-summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0 14px;
  color: #667085;
  font-size: 12px;
}

.score-summary-strip span {
  display: inline-flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid #e1e5ec;
  border-radius: 8px;
  background: #fbfcfe;
  white-space: nowrap;
}

.score-summary-strip b {
  color: #1f2937;
  font-size: 14px;
  line-height: 1;
}

.score-section {
  margin-top: 20px;
}

.score-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.score-section-heading h3 {
  margin: 0;
}

.score-section-heading .message {
  margin: 0;
}

.score-table-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.score-table-tools .message {
  margin: 0;
}

.score-table-view-buttons {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 3px;
  border: 1px solid #d7dce5;
  border-radius: 8px;
  background: #f6f8fb;
  flex-shrink: 0;
}

.score-table-view-button {
  min-height: 32px;
  margin: 0;
  padding: 6px 9px;
  border-radius: 6px;
  background: transparent;
  color: #44546a;
  font-size: 12px;
}

.score-table-view-button.active {
  background: #255ec7;
  color: #ffffff;
}

.score-chart-list {
  display: grid;
  gap: 14px;
}

.score-chart-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.score-chart-category {
  font-weight: 700;
}

.score-chart-rate {
  color: #667085;
  font-size: 13px;
}

.score-stacked-bar {
  display: flex;
  width: 100%;
  height: 18px;
  overflow: hidden;
  border: 1px solid #dfe3ea;
  border-radius: 6px;
  background: #e5e7eb;
}

.score-bar-correct {
  background: #5bbf73;
}

.score-bar-incorrect {
  background: #e56b6f;
}

.score-bar-unanswered {
  background: #b8bcc4;
}

.score-chart-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 6px;
  color: #555;
  font-size: 12px;
}

.score-chart-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.score-table-wrap {
  overflow-x: auto;
  border: 1px solid #e1e5ec;
  border-radius: 8px;
}

.score-table-wrap.wide .score-heat-table {
  min-width: 560px;
}

.score-heat-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.score-heat-table th,
.score-heat-table td {
  border: 1px solid #e1e5ec;
  padding: 9px 8px;
  text-align: center;
}

.score-heat-table th {
  background: #f6f8fb;
  color: #384252;
}

.score-heat-table th:first-child {
  width: 92px;
}

.score-heat-empty {
  color: #98a2b3;
  background: #fafafa;
}

.score-heat-rate {
  color: #222;
  font-weight: 800;
  line-height: 1.2;
}

.sticky-action {
  position: fixed;
  right: max(16px, calc((100vw - 960px) / 2 + 16px));
  bottom: max(16px, calc(env(safe-area-inset-bottom) + 16px));
  justify-content: flex-end;
  align-items: center;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  pointer-events: none;
  z-index: 30;
}

.sticky-action .primary {
  min-width: auto;
  min-height: 52px;
  margin: 0;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: #f97316;
  color: #ffffff;
  font-size: 17px;
  pointer-events: auto;
  box-shadow: 0 14px 28px rgba(194, 65, 12, 0.36);
}

.sticky-action .primary:not(:disabled):hover {
  background: #ea580c;
  box-shadow: 0 16px 32px rgba(194, 65, 12, 0.42);
}

.sticky-action .primary:not(:disabled):active {
  transform: translateY(2px);
  box-shadow: 0 8px 16px rgba(194, 65, 12, 0.34);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(20, 27, 38, 0.42);
}

.modal-panel {
  width: min(100%, 440px);
  padding: 16px;
  border: 1px solid #d8dee8;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(0,0,0,0.22);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.modal-head h2 {
  margin: 0;
}

.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #dde3ed;
  border-radius: 999px;
  background: #ffffff;
  color: #44546a;
  font-size: 22px;
  line-height: 1;
}

.icon-button:not(:disabled):hover {
  background: #f3f6fb;
}

.modal-message {
  margin: 0 0 14px;
  color: #44546a;
  font-weight: 700;
}

.notice-panel {
  width: min(100%, 360px);
}

.site-notice-backdrop {
  z-index: 60;
}

.site-notice-panel {
  width: min(100%, 420px);
}

.site-notice-content {
  margin: 0 0 14px;
  color: #26364d;
  font-size: var(--app-text-size);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.site-notice-content > :first-child {
  margin-top: 0;
}

.site-notice-content > :last-child {
  margin-bottom: 0;
}

.site-notice-content img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 60vh;
  object-fit: contain;
  border-radius: 8px;
}

.site-notice-content a {
  color: #255ec7;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.exercise-result-panel {
  width: min(100%, 380px);
}

.exercise-result-summary {
  display: grid;
  gap: 14px;
  margin: 6px 0 16px;
}

.exercise-result-score {
  display: grid;
  place-items: center;
  min-height: 104px;
  border: 1px solid #c9d7f0;
  border-radius: 12px;
  background: #f6f8ff;
  color: #1f51ad;
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
}

.exercise-result-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.exercise-result-stats div {
  min-width: 0;
  padding: 10px 8px;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  background: #ffffff;
  text-align: center;
}

.exercise-result-stats dt {
  margin: 0 0 4px;
  color: #66758a;
  font-size: 12px;
  font-weight: 700;
}

.exercise-result-stats dd {
  margin: 0;
  color: #26364d;
  font-size: 16px;
  font-weight: 800;
}

.notice-actions {
  justify-content: flex-end;
}

.count-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.count-option {
  min-height: 48px;
  margin: 0;
  border: 1px solid #d8dee8;
  background: #ffffff;
  color: #26364d;
}

.count-option:not(:disabled):hover {
  border-color: #255ec7;
  background: #f6f8ff;
}

.count-option.primary {
  border-color: #255ec7;
  background: #255ec7;
  color: #ffffff;
}

.count-option.primary:not(:disabled):hover {
  background: #1f51ad;
}

.star {
  background: transparent;
  color: #f08c00;
  font-size: 28px;
  padding: 4px 8px;
}

.progress {
  height: 10px;
  background: #e9ecef;
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0;
}

#progressBar {
  height: 100%;
  width: 0%;
  background: #255ec7;
}

.question-html {
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 16px;
  min-height: 180px;
  background: #ffffff;
  font-size: var(--app-question-size);
  overflow-wrap: anywhere;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.question-html.loading {
  display: grid;
  align-items: center;
  border-color: #d8deea;
  background: #fbfcff;
}

.question-loading {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 14px;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #d9e2f2;
  border-top-color: #255ec7;
  border-radius: 999px;
  animation: spin 0.85s linear infinite;
}

.loading-copy {
  display: grid;
  gap: 9px;
}

.loading-title {
  color: #344160;
  font-weight: 700;
  font-size: 14px;
}

.loading-line {
  height: 10px;
  width: 72%;
  border-radius: 999px;
  background: linear-gradient(90deg, #e8edf5, #f8fafc, #e8edf5);
  background-size: 180% 100%;
  animation: shimmer 1.15s ease-in-out infinite;
}

.loading-line-wide {
  width: 94%;
}

.loading-line-short {
  width: 46%;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0 6px;
}

.choices.choice-count-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choices.choice-count-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.choices.choice-count-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.choices button {
  display: grid;
  place-items: center;
  background: white;
  border: 2px solid #d0d7de;
  min-height: 76px;
  margin: 0;
  font-size: 30px;
  line-height: 1.05;
  box-shadow: 0 1px 0 rgba(0,0,0,0.03);
}

.choices button:not(:disabled):hover {
  border-color: #8ca3c7;
  background: #fbfdff;
}

.choices button.selected {
  border-color: #255ec7;
  background: #e7f0ff;
  color: #173b7a;
  box-shadow: inset 0 0 0 2px #255ec7, 0 0 0 4px rgba(37, 94, 199, 0.18), 0 8px 18px rgba(37, 94, 199, 0.18);
  transform: translateY(-1px);
}

.choices button.correct {
  border-color: #2f9e44;
  background: #ebfbee;
  color: #1f7a35;
  box-shadow: 0 0 0 3px rgba(47, 158, 68, 0.14);
}

.choices button.incorrect {
  border-color: #e03131;
  background: #fff5f5;
  color: #c92a2a;
  box-shadow: 0 0 0 3px rgba(224, 49, 49, 0.12);
}

.choices button:disabled {
  opacity: 1;
}

.result {
  font-weight: 700;
  min-height: 0;
  margin: 4px 0 0;
  padding: 0;
  color: #666;
}

.result:not(:empty) {
  display: inline-flex;
  align-items: center;
  min-height: 0;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 14px;
}

.result.is-correct {
  background: #eaf7ee;
  color: #1f7a35;
  border: 1px solid #b8e2c3;
}

.result.is-incorrect {
  background: #fff0f0;
  color: #c92a2a;
  border: 1px solid #ffc9c9;
}

.result.is-muted {
  background: #f1f4f8;
  color: #44546a;
  border: 1px solid #d8dee8;
}

.action-row {
  display: grid;
  gap: 10px;
}

.action-row button,
.exercise-utility-panel button {
  width: 100%;
  min-height: 50px;
  margin: 0;
}

.primary-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 8px;
}

.primary-actions button {
  position: relative;
  border: 1px solid transparent;
}

#answerButton:not(:disabled),
#nextButton:not(:disabled) {
  background: #255ec7;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(37, 94, 199, 0.2);
}

#answerButton:disabled,
#nextButton:disabled {
  background: #eef1f5;
  color: #8a96a8;
  border-color: #d8dee8;
  opacity: 1;
}

.exercise-utility-panel {
  display: grid;
  gap: 10px;
  margin: 10px 0 12px;
  padding: 12px;
  border: 1px solid #d8dee8;
  border-radius: 12px;
  background: #f8fafd;
}

.exercise-utility-panel button {
  background: #ffffff;
  border: 1px solid #d8dee8;
  color: #44546a;
}

.exercise-utility-panel button:not(:disabled):hover {
  background: #f1f5fb;
  border-color: #b9c5d8;
}

.permission-error {
  border: 2px solid #ffb3b3;
  background: #fff5f5;
  border-radius: 12px;
  padding: 18px;
  color: #c92a2a;
}

.permission-error h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.permission-error p {
  line-height: 1.7;
}

.permission-error ul {
  margin: 10px 0;
  padding-left: 20px;
  color: #7a2323;
  line-height: 1.7;
}

.permission-error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.permission-error-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #255ec7;
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
}

.permission-error-actions a:last-child {
  border: 1px solid #255ec7;
  background: #ffffff;
  color: #255ec7;
}

.box28 {
  position: relative;
  margin: 0;
  padding: 1.5em 0.5em 0.5em;
  border: solid 2px #ffa500;
  background: #ffffff;
}

.box28 .box-title {
  position: absolute;
  top: -2px;
  left: -2px;
  padding: 0 9px;
  background: #ffa500;
  color: #ffffff;
  font-weight: bold;
}

.box26 {
  margin: 0.75em 0;
  padding: 0.5em;
  border: solid 3px #0059ff;
  border-radius: 8px;
}

.box8 {
  padding: 0.5em;
  margin: 0.5em 0;
  background: #f5f5f5;
  border-left: solid 15px #a9a9a9;
}

table,
th,
td {
  border: 1px solid #ccc;
  border-collapse: collapse;
}

table {
  width: 100%;
}

th,
td {
  padding: 6px;
}

@media (max-width: 640px) {
  .app {
    padding: 8px;
  }

  .header-main {
    align-items: center;
  }

  h1 {
    font-size: 17px;
  }

  .header-main {
    gap: 8px;
  }

  .service-switcher button {
    min-height: 38px;
    font-size: 12px;
  }

  .service-switch-button {
    width: 44px;
    height: 44px;
    font-size: 12px;
  }

  .choices,
  .primary-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .choices.choice-count-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .choices.choice-count-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .choices.choice-count-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .choices button {
    min-height: 70px;
    font-size: 28px;
  }

  .choices.choice-count-5 button {
    min-height: 58px;
    font-size: 22px;
  }

  .full-width-group {
    grid-template-columns: repeat(2, 1fr);
  }

  .list-header,
  .view-title-row,
  .exercise-head {
    align-items: flex-start;
  }

  .score-toolbar,
  .score-section-heading,
  .score-chart-head,
  .score-table-tools {
    display: grid;
  }

  .score-table-wrap {
    overflow-x: visible;
  }

  .score-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .score-table-wrap.wide {
    overflow-x: auto;
  }

  .score-table-wrap.wide .score-heat-table {
    min-width: 560px;
  }

  .score-heat-table {
    min-width: 0;
    font-size: 12px;
  }

  .score-heat-table th,
  .score-heat-table td {
    padding: 6px 3px;
  }

  .score-heat-table th:first-child {
    width: 58px;
  }

  .score-heat-rate {
    font-size: 12px;
  }

}

.latest-exercise-box {
  margin: 16px 0 8px;
  padding: 10px 12px;
  border: 1px solid #cfd8ea;
  background: #f6f8ff;
  border-radius: 10px;
  font-size: 13px;
}

.latest-exercise-title {
  font-weight: 700;
  margin-bottom: 6px;
  color: #1f2d5c;
}

.latest-exercise-row {
  line-height: 1.5;
  margin: 2px 0;
  color: #1f2d5c;
}

.report-link-box {
  text-align: center;
  margin: 12px 0 18px;
  font-size: 12px;
}

.exercise-finish-box {
  border: 1px solid #d8e2ef;
  background: #f8fbff;
  border-radius: 12px;
  padding: 16px;
}

.exercise-finish-box h3 {
  margin-top: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }

  100% {
    background-position: -100% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  button,
  .question-html {
    transition: none;
  }

  .button-spinner,
  .loading-spinner,
  .loading-line {
    animation: none;
  }
}

.secondary-link {
  display: inline-block;
  background: #edf2ff;
  color: #255ec7;
  text-decoration: none;
  border-radius: 8px;
  padding: 11px 14px;
  font-weight: 700;
}

.secondary-link {
  display: inline-block;
  background: #edf2ff;
  color: #255ec7;
  text-decoration: none;
  border-radius: 8px;
  padding: 11px 14px;
  font-weight: 700;
  text-align: center;
}

.purchase-box {
  margin-top: 16px;
}

.purchase-guide {
  margin: 14px 0 18px;
  padding: 14px;
  border: 1px solid #d8e2ef;
  border-radius: 8px;
  background: #fbfcff;
}

.purchase-guide h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.purchase-guide ol {
  margin: 0;
  padding-left: 20px;
  color: #344160;
  line-height: 1.7;
}

.purchase-guide p {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid #e4e8ef;
  color: #665f1f;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.7;
}

.purchase-link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 18px;
}

.purchase-link-card {
  display: grid;
  gap: 6px;
  min-height: 88px;
  padding: 14px;
  border: 1px solid #d8e2ef;
  border-radius: 8px;
  background: #fbfcff;
  color: #1f2d5c;
  text-decoration: none;
}

.purchase-link-card:first-child {
  grid-column: 1 / -1;
}

.purchase-link-card:hover {
  border-color: #255ec7;
  box-shadow: 0 6px 14px rgba(37, 94, 199, 0.12);
}

.purchase-link-card span {
  font-weight: 700;
}

.purchase-link-card strong {
  color: #255ec7;
  font-size: 14px;
}

.purchase-confirm-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.button-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #ffffff;
  border-radius: 999px;
  animation: spin 0.85s linear infinite;
}

.purchase-loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 12px 4px 0;
  color: #344160;
  font-size: 14px;
  font-weight: 700;
}

.purchase-loading .loading-spinner {
  width: 20px;
  height: 20px;
  border-width: 2px;
  flex: 0 0 auto;
}

@media (max-width: 640px) {
  .purchase-link-grid {
    grid-template-columns: 1fr;
  }
}
