/* ALSpark macOS preview layer
   Visual-only overrides. Existing IDs, classes and application behavior remain unchanged. */
:root {
  --mac-bg: #eef3ff;
  --mac-ink: #172033;
  --mac-muted: #58667c;
  --mac-blue: #3478f6;
  --mac-blue-strong: #1768e5;
  --mac-line: rgba(109, 129, 162, .22);
  --mac-line-strong: rgba(91, 116, 155, .34);
  --mac-shadow: 0 18px 45px rgba(63, 79, 112, .12);
  --mac-shadow-small: 0 7px 18px rgba(63, 79, 112, .10);
  --mac-radius: 26px;
  --mac-ease: cubic-bezier(.22, 1, .36, 1);
}

html { background: var(--mac-bg); }

body {
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  color: var(--mac-ink);
  background:
    radial-gradient(circle at 10% 4%, rgba(194, 220, 255, .88), transparent 35%),
    radial-gradient(circle at 92% 3%, rgba(221, 204, 255, .78), transparent 32%),
    radial-gradient(circle at 76% 94%, rgba(255, 215, 232, .64), transparent 34%),
    linear-gradient(145deg, #f7faff 0%, #edf3ff 42%, #f8f5ff 72%, #f8fbff 100%);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", "PingFang SC", sans-serif;
  letter-spacing: -.008em;
}

body::before { display: none; }

.macos-ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.macos-blob {
  position: absolute;
  display: block;
  border-radius: 50%;
  opacity: .72;
  filter: blur(74px) saturate(118%);
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.macos-blob-blue {
  width: min(56vw, 760px); height: min(56vw, 760px);
  left: -15vw; top: -18vw;
  background: rgba(97, 164, 255, .58);
  animation: macos-drift-blue 32s var(--mac-ease) infinite alternate;
}

.macos-blob-violet {
  width: min(48vw, 680px); height: min(48vw, 680px);
  right: -13vw; top: -9vw;
  background: rgba(174, 132, 255, .50);
  animation: macos-drift-violet 38s var(--mac-ease) infinite alternate;
}

.macos-blob-pink {
  width: min(46vw, 620px); height: min(46vw, 620px);
  right: 5vw; bottom: -22vw;
  background: rgba(255, 150, 197, .40);
  animation: macos-drift-pink 36s var(--mac-ease) infinite alternate;
}

.macos-blob-silver {
  width: min(40vw, 560px); height: min(40vw, 560px);
  left: 30vw; bottom: -20vw;
  background: rgba(219, 232, 246, .78);
  animation: macos-drift-silver 42s var(--mac-ease) infinite alternate;
}

@keyframes macos-drift-blue { to { transform: translate3d(12vw, 10vh, 0) scale(1.08); } }
@keyframes macos-drift-violet { to { transform: translate3d(-13vw, 14vh, 0) scale(.94); } }
@keyframes macos-drift-pink { to { transform: translate3d(-10vw, -13vh, 0) scale(1.10); } }
@keyframes macos-drift-silver { to { transform: translate3d(8vw, -16vh, 0) scale(.92); } }

#ambient-canvas { z-index: 0; opacity: .16; mix-blend-mode: soft-light; }
.login-screen, .app { z-index: 1; }

button {
  min-height: 44px;
  border: 1px solid var(--mac-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .58);
  color: var(--mac-ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .72) inset;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  transition: transform 180ms var(--mac-ease), background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: var(--mac-line-strong);
  background: rgba(255, 255, 255, .76);
  box-shadow: var(--mac-shadow-small);
}

button:active { transform: translateY(0) scale(.985); }
button:disabled { cursor: not-allowed; opacity: .48; transform: none; box-shadow: none; }

button.primary, .primary {
  border-color: rgba(23, 104, 229, .38);
  background: linear-gradient(180deg, #4c8df8 0%, var(--mac-blue-strong) 100%);
  color: #fff;
  box-shadow: 0 8px 18px rgba(36, 109, 225, .22);
}

button.primary:hover, .primary:hover {
  border-color: rgba(23, 104, 229, .48);
  background: linear-gradient(180deg, #5b98ff 0%, #1664d9 100%);
  box-shadow: 0 10px 22px rgba(36, 109, 225, .28);
}

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid rgba(52, 120, 246, .28);
  outline-offset: 3px;
}

input, select, textarea {
  border: 1px solid var(--mac-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .56);
  color: var(--mac-ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .82) inset, 0 1px 2px rgba(59, 75, 105, .04);
  backdrop-filter: blur(16px) saturate(135%);
  -webkit-backdrop-filter: blur(16px) saturate(135%);
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(52, 120, 246, .62);
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 0 0 4px rgba(52, 120, 246, .12);
}

input::placeholder, textarea::placeholder { color: #6d7a8f; }
.muted, .module-card span, .card-row em, .section-head span, .account-mini span { color: var(--mac-muted); }

.login-panel, .auth-card, .sidebar, .hero-panel, .leaderboard, .panel, .test-box, .module-card, .metric, .rank-row, .log-row, .answer-panel, .answer-sheet, .modal-card, .study-timer-widget, .campaign-banner {
  border-color: var(--mac-line);
  background: linear-gradient(145deg, rgba(255, 255, 255, .72), rgba(247, 250, 255, .47));
  box-shadow: var(--mac-shadow);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
}

.login-panel { gap: 18px; padding: 18px; border-radius: 32px; background: rgba(255, 255, 255, .44); }
.summit-hero { border-radius: 24px; box-shadow: 0 18px 42px rgba(34, 50, 80, .16); }
.auth-card { border-radius: 24px; background: rgba(255, 255, 255, .68); }
.auth-heading h2 { color: #111a2d; font-size: 38px; font-weight: 750; letter-spacing: -.035em; }

.auth-tabs, .ladder-tabs {
  border: 1px solid var(--mac-line);
  border-radius: 15px;
  background: rgba(228, 235, 247, .50);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .66) inset;
}
.auth-tab, .ladder-tab, .log-tab { border-radius: 11px; }
.auth-tab.active, .ladder-tab.active, .log-tab.active { background: rgba(255, 255, 255, .86); box-shadow: 0 2px 7px rgba(63, 79, 112, .10); }

.app { grid-template-columns: 270px minmax(0, 1fr); }
.sidebar {
  margin: 12px 0 12px 12px;
  height: calc(100vh - 24px);
  border: 1px solid var(--mac-line);
  border-radius: 24px;
  background: rgba(247, 250, 255, .56);
}
.account-mini { border-bottom-color: rgba(109, 129, 162, .18); }
.avatar { background: linear-gradient(145deg, #5d9bff, #6f7cff 56%, #9c6ff3); box-shadow: 0 8px 18px rgba(72, 103, 200, .24); }
.sidebar-subscription-box {
  display: grid;
  gap: 5px;
  margin: 8px 0 12px;
  padding: 0 2px 12px;
  border-bottom: 1px solid rgba(109, 129, 162, .14);
}
.sidebar-subscription-box button {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, .26);
  background: rgba(255, 247, 237, .86);
  color: #b45309;
  font-size: 12px;
  font-weight: 780;
  box-shadow: none;
}
.sidebar-subscription-box button:hover {
  background: rgba(254, 243, 199, .95);
  transform: translateY(-1px);
}
.sidebar-subscription-box small {
  color: var(--mac-muted);
  font-size: 11px;
  text-align: center;
}
.side-nav { gap: 8px; }
.nav-item { border-color: transparent; background: transparent; }
.nav-item:hover { border-color: rgba(109, 129, 162, .18); background: rgba(255, 255, 255, .48); box-shadow: none; }
.nav-item.active { border-color: rgba(52, 120, 246, .20); background: rgba(52, 120, 246, .12); color: #1559b8; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .68); }

.main { width: min(100%, 1540px); padding: 28px clamp(24px, 3.5vw, 54px) 64px; }
.topbar { padding: 4px 2px; }
.topbar .brand-mark { color: #111a2d; font-weight: 780; letter-spacing: -.035em; }
.avatar-button { background: rgba(255, 255, 255, .54); }
.view { animation-duration: 240ms; animation-timing-function: var(--mac-ease); }

.hero-panel, .leaderboard, .panel, .test-box { border-radius: var(--mac-radius); }
.hero-panel {
  min-height: 250px;
  padding: clamp(28px, 4vw, 52px);
  background: radial-gradient(circle at 86% 4%, rgba(170, 143, 255, .22), transparent 36%), radial-gradient(circle at 2% 100%, rgba(95, 169, 255, .22), transparent 40%), linear-gradient(145deg, rgba(255, 255, 255, .72), rgba(247, 250, 255, .42));
}
.hero-panel h1, .section-head h1 { color: #111a2d; font-weight: 760; letter-spacing: -.04em; }
.hero-panel h1 { max-width: 17ch; }
.hero-panel p { color: var(--mac-muted); }
.hero-actions { align-self: center; }
.hero-actions .primary {
  border-radius: 18px;
  box-shadow: 0 14px 28px rgba(36, 109, 225, .18);
}

/* AI pet assistant, scoped to the macOS workspace answer panel. */
#view-workspace .pet-assistant {
  display: grid;
  gap: 12px;
  margin: 0 !important;
  padding: 14px;
  border: 1px solid rgba(116, 139, 174, .20);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .78), rgba(244, 238, 255, .58));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72), 0 12px 28px rgba(88, 75, 125, .08);
}

#view-workspace .pet-assistant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#view-workspace .pet-avatar-button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #111a2d;
  text-align: left;
  cursor: pointer;
}

#view-workspace .pet-avatar-core {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 16px;
  background: radial-gradient(circle at 32% 24%, #ffffff 0 12%, #8cc8ff 13% 34%, #6f75ff 35% 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -.02em;
  box-shadow: 0 10px 20px rgba(72, 118, 255, .22);
}

#view-workspace .pet-avatar-button strong,
#view-workspace .pet-avatar-button em {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#view-workspace .pet-avatar-button strong {
  font-size: 16px;
  font-weight: 850;
}

#view-workspace .pet-avatar-button em {
  margin-top: 2px;
  color: #65748d;
  font-size: 13px;
  font-style: normal;
  font-weight: 650;
}

#view-workspace .pet-clear-chat {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(94, 116, 151, .18);
  border-radius: 12px;
  background: rgba(255, 255, 255, .66);
  color: #52627a;
  font-size: 13px;
  font-weight: 760;
}

#view-workspace .pet-assistant-body {
  display: grid;
  gap: 10px;
}

#view-workspace .pet-assistant.collapsed .pet-assistant-body {
  display: none;
}

#view-workspace .pet-chat-log {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
  border: 1px solid rgba(116, 139, 174, .16);
  border-radius: 18px;
  background: rgba(255, 255, 255, .48);
}

#view-workspace .pet-message {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 16px;
  color: #172033;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.65;
  white-space: pre-wrap;
}

#view-workspace .pet-message-ai {
  justify-self: start;
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(116, 139, 174, .16);
}

#view-workspace .pet-message-user {
  justify-self: end;
  background: rgba(52, 120, 246, .14);
  border: 1px solid rgba(52, 120, 246, .18);
  color: #145bc0;
}

#view-workspace .pet-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#view-workspace .pet-quick-actions button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(52, 120, 246, .16);
  border-radius: 999px;
  background: rgba(255, 255, 255, .70);
  color: #2e5ea8;
  font-size: 13px;
  font-weight: 760;
}

#view-workspace .pet-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

#view-workspace .pet-chat-form input {
  min-width: 0;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(116, 139, 174, .22);
  border-radius: 15px;
  background: rgba(255, 255, 255, .78);
  color: #111a2d;
  font-weight: 650;
}

#view-workspace .pet-chat-form button {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(180deg, #4e8df7, #2672e8);
  color: #fff;
  font-weight: 850;
  box-shadow: 0 10px 18px rgba(38, 114, 232, .20);
}

@media (max-width: 640px) {
  #view-workspace .pet-chat-form {
    grid-template-columns: 1fr;
  }
}

/* Pet chat dock, opened from the animated pet Talk button. */
.pet-chat-dock {
  position: fixed;
  right: 24px;
  bottom: 188px;
  z-index: 86;
  width: min(420px, calc(100vw - 32px));
  max-height: min(640px, calc(100vh - 220px));
  display: grid;
  grid-template-rows: auto minmax(180px, 1fr) auto auto;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(116, 139, 174, .24);
  border-radius: 24px;
  background: rgba(255, 255, 255, .78);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 22px 48px rgba(61, 70, 105, .18);
}

.pet-chat-dock.hidden {
  display: none;
}

.pet-chat-dock header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pet-chat-dock header strong,
.pet-chat-dock header span {
  display: block;
}

.pet-chat-dock header strong {
  color: #111a2d;
  font-size: 17px;
  font-weight: 860;
}

.pet-chat-dock header span {
  margin-top: 2px;
  color: #64748b;
  font-size: 13px;
  font-weight: 650;
}

#pet-chat-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(94, 116, 151, .18);
  border-radius: 999px;
  background: rgba(255, 255, 255, .70);
  color: #52627a;
  font-size: 22px;
  line-height: 1;
}

.pet-chat-dock .pet-chat-log {
  min-height: 180px;
  max-height: 340px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(116, 139, 174, .16);
  border-radius: 18px;
  background: rgba(247, 250, 255, .62);
}

.pet-chat-dock .pet-message {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 16px;
  color: #172033;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.6;
  white-space: normal;
  overflow-wrap: anywhere;
}

.pet-chat-dock .pet-message p {
  margin: 0 0 8px;
}

.pet-chat-dock .pet-message p:last-child,
.pet-chat-dock .pet-message ul:last-child {
  margin-bottom: 0;
}

.pet-chat-dock .pet-message h4 {
  margin: 10px 0 6px;
  color: #10203a;
  font-size: 15px;
  font-weight: 850;
  letter-spacing: -.01em;
}

.pet-chat-dock .pet-message ul {
  margin: 6px 0 10px;
  padding-left: 18px;
}

.pet-chat-dock .pet-message li {
  margin: 4px 0;
}

.pet-chat-dock .pet-message code,
.pet-chat-dock .pet-math-inline,
.pet-chat-dock .pet-math-block {
  font-family: "SF Mono", "Cascadia Code", "Cambria Math", Consolas, monospace;
}

.pet-chat-dock .pet-message code,
.pet-chat-dock .pet-math-inline {
  padding: 1px 5px;
  border-radius: 7px;
  background: rgba(52, 120, 246, .08);
  color: #145bc0;
  font-weight: 760;
}

.pet-chat-dock .pet-math-block {
  margin: 8px 0;
  padding: 10px 12px;
  border: 1px solid rgba(52, 120, 246, .12);
  border-radius: 13px;
  background: rgba(247, 250, 255, .82);
  color: #10203a;
  font-size: 13px;
  white-space: pre-wrap;
}

.pet-chat-dock .pet-message hr {
  border: 0;
  border-top: 1px solid rgba(116, 139, 174, .18);
  margin: 10px 0;
}

.pet-chat-dock .pet-message-ai {
  justify-self: start;
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(116, 139, 174, .16);
}

.pet-chat-dock .pet-message-user {
  justify-self: end;
  background: rgba(52, 120, 246, .14);
  border: 1px solid rgba(52, 120, 246, .18);
  color: #145bc0;
}

.pet-chat-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pet-chat-hints button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(52, 120, 246, .16);
  border-radius: 999px;
  background: rgba(255, 255, 255, .74);
  color: #2e5ea8;
  font-size: 13px;
  font-weight: 760;
}

.pet-chat-dock .pet-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.pet-chat-dock .pet-chat-form textarea {
  min-width: 0;
  resize: vertical;
  min-height: 48px;
  max-height: 120px;
  padding: 10px 12px;
  border: 1px solid rgba(116, 139, 174, .24);
  border-radius: 16px;
  background: rgba(255, 255, 255, .84);
  color: #111a2d;
  font: inherit;
  font-weight: 650;
  line-height: 1.45;
}

.pet-chat-dock .pet-chat-form button {
  align-self: end;
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #4e8df7, #2672e8);
  color: #fff;
  font-weight: 850;
  box-shadow: 0 10px 18px rgba(38, 114, 232, .20);
}

/* Original pet2 animation integration. Keep it lightweight and below dialogs. */
.pet-main {
  z-index: 90 !important;
  transform: scale(.78);
  transform-origin: right bottom;
}

body:not(.alspark-authenticated) #pet_main,
body:not(.alspark-authenticated) #pet_zhaohuan,
body:not(.alspark-authenticated) .pet-main,
body:not(.alspark-authenticated) .pet-zhaohuan,
body:not(.alspark-authenticated) #pet-chat-dock {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body:not(.alspark-authenticated) .pet-chat {
  display: none !important;
}

.pet-main .pet-chat {
  z-index: 91 !important;
}

body.pet-dock-open .pet-main .pet-chat {
  display: none !important;
}

.pet-main .pet-menu {
  display: none !important;
}

.pet-main .pet-menu-btn {
  position: relative;
  z-index: 93 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 22px;
  padding: 2px 10px !important;
  margin-left: auto !important;
  float: right !important;
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  color: #b8792c !important;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif !important;
  font-weight: 800;
  letter-spacing: -.01em;
  cursor: pointer !important;
  pointer-events: auto !important;
  user-select: none;
}

.pet-main .pet-menu-btn:hover {
  background: rgba(255, 255, 255, .92);
  color: #1f5dbf !important;
}

.pet-main .pet-input {
  z-index: 83 !important;
  width: 18em !important;
}

.pet-main .pet-talk {
  height: 24px !important;
  padding: 0 8px !important;
  border-radius: 8px !important;
}

.pet-main .pet-talkto {
  height: 24px !important;
  line-height: 24px !important;
  border-radius: 8px !important;
}

img.pet-zhaohuan,
a.pet-zhaohuan {
  z-index: 90 !important;
}

@media (max-width: 640px) {
  .pet-chat-dock {
    right: 12px;
    bottom: 130px;
    width: calc(100vw - 24px);
    max-height: min(70vh, 560px);
    border-radius: 20px;
  }

  .pet-chat-dock .pet-chat-form {
    grid-template-columns: 1fr;
  }

  .pet-main {
    transform: scale(.86);
    transform-origin: right bottom;
  }
}
.hero-actions .hero-daily {
  background: linear-gradient(180deg, #5e9aff, #2f75e8);
}
.hero-actions .hero-practice {
  border: 1px solid rgba(52, 120, 246, .24);
  background: rgba(255, 255, 255, .60);
  color: #1559b8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72), 0 10px 22px rgba(63, 79, 112, .10);
}
.module-grid, .practice-cards, .metric-grid, .task-grid { gap: 18px; }
.module-card, .metric, .rank-row, .log-row, .report-grid div { border-radius: 20px; background: rgba(255, 255, 255, .55); }
.module-card { min-height: 148px; padding: 22px; }
.module-card::after { display: none; }
.module-card:hover { background: rgba(255, 255, 255, .76); box-shadow: 0 14px 30px rgba(63, 79, 112, .13); }
.module-card strong, .card-row strong { color: #172033; font-weight: 730; }
.metric strong, .report-grid strong { letter-spacing: -.035em; }

.task-grid .button {
  margin: 8px 8px 8px 0;
  text-decoration: none;
}

.class-selection-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.class-selection-panel h2 {
  margin-bottom: 6px;
}

.class-selection-panel p {
  margin: 0;
}

.class-selection-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.vocab-flashcard-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 16px;
}

.vocab-card-head,
.vocab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.vocab-flashcard {
  width: 100%;
  min-height: 220px;
  border-radius: 28px;
  border: 1px solid rgba(52, 120, 246, .22);
  background: linear-gradient(135deg, rgba(255,255,255,.82), rgba(232,242,255,.68));
  box-shadow: 0 22px 56px rgba(63, 79, 112, .12);
  color: #111a2d;
  font-size: clamp(28px, 5vw, 54px);
  font-weight: 800;
  line-height: 1.25;
  white-space: normal;
}

.vocab-flashcard.flipped {
  font-size: clamp(18px, 2.4vw, 28px);
  text-align: left;
}

.vocab-flashcard span {
  display: grid;
  gap: 12px;
}

.input-mode-panel, .mode-segment, .formula-helper, .feedback-grid div, .part-feedback-list details, .locked-mark { border-color: var(--mac-line); background: rgba(255, 255, 255, .42); }
.mode-segment { border-radius: 16px; }
.mode-segment button.active, .part-tabs button.active, .feedback-tabs button.active, .handwriting-toolbar button.active { border-color: rgba(52, 120, 246, .26); background: rgba(52, 120, 246, .12); color: #1559b8; }
.exam-board-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}
.exam-board-inline {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--mac-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .44);
}
.exam-board-segment {
  min-width: 260px;
}
.exam-board-current {
  grid-column: 1 / -1;
  margin: -6px 0 0;
}
.exam-board-current strong {
  color: #1559b8;
}
.rank-row.top { border-color: rgba(223, 166, 52, .30); background: rgba(255, 248, 218, .60); }

.tear-card, .tear-face, .tear-half { border-radius: 22px; }
.tear-face { border-color: var(--mac-line); background: rgba(255, 255, 255, .63); box-shadow: var(--mac-shadow); }
.tear-card.orange .tear-face { background: rgba(255, 250, 245, .68); }
.icon-tile { border-radius: 16px; background: linear-gradient(145deg, #5d9bff, #7668ef); }
.orange .icon-tile { background: linear-gradient(145deg, #ff9a62, #ff5b6c); }
.cta { border-radius: 14px; background: linear-gradient(180deg, #4c8df8, var(--mac-blue-strong)); box-shadow: 0 8px 18px rgba(36, 109, 225, .18); }

.notice { border: 1px solid rgba(52, 120, 246, .18); border-radius: 16px; background: rgba(226, 237, 255, .60); color: #245eaf; }
.notice.success { border-color: rgba(32, 168, 132, .20); background: rgba(222, 248, 239, .64); color: #16765f; }

.question-image { border-radius: 22px; border-color: var(--mac-line); background: rgba(255, 255, 255, .88); box-shadow: var(--mac-shadow-small); }
.question-image img { border-radius: 14px; }
.answer-panel { top: 18px; border-radius: 24px; background: rgba(255, 255, 255, .68); }
.answer-panel h2 { color: #111a2d; font-weight: 760; letter-spacing: -.035em; }
.choice-grid button { border-radius: 17px; background: rgba(255, 255, 255, .64); }
.choice-grid .selected { border-color: rgba(52, 120, 246, .46); background: rgba(52, 120, 246, .13); color: #1559b8; box-shadow: 0 8px 18px rgba(36, 109, 225, .14); }

.handwriting-canvas-wrap, .subjective-answer textarea, .part-field textarea, .handwriting-final textarea { border-radius: 16px; border-color: var(--mac-line); }
.answer-panel.handwriting-active .handwriting-toolbar {
  gap: 10px;
}
.answer-panel.handwriting-active .handwriting-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
}
.answer-panel.handwriting-active #save-handwriting,
.answer-panel.handwriting-active #expand-answer {
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 0 18px;
  border-style: solid;
  border-color: rgba(52, 120, 246, .24);
  border-radius: 16px;
  background: rgba(255, 255, 255, .62);
  box-shadow: 0 8px 18px rgba(63, 79, 112, .10);
  white-space: nowrap;
}
.answer-panel.handwriting-active #save-handwriting {
  border-color: rgba(52, 120, 246, .30);
  background: linear-gradient(180deg, rgba(255, 255, 255, .82), rgba(238, 246, 255, .68));
}
.answer-panel.handwriting-active #save-handwriting:hover,
.answer-panel.handwriting-active #expand-answer:hover {
  background: rgba(255, 255, 255, .78);
}
.formula-helper { border-radius: 16px; }
.formula-helper summary::before { background: linear-gradient(145deg, #52647f, #2f3d55); }
.formula-open { border-radius: 13px; }

.question-float-tools {
  width: 100%;
  min-width: 0;
}
.question-float-tools button {
  border-color: rgba(94, 116, 151, .20);
  background: rgba(255, 255, 255, .46);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .62);
}
.question-float-tools button:hover {
  background: rgba(255, 255, 255, .68);
}
.answer-sheet { border-radius: 20px; background: rgba(255, 255, 255, .76); }
.answer-sheet-toggle { border-radius: 14px 0 0 14px; background: linear-gradient(180deg, #4c8df8, #6f6de8); }
.study-timer-widget { background: rgba(255, 255, 255, .72); }

.modal-backdrop { background: rgba(33, 43, 64, .24); backdrop-filter: blur(18px) saturate(120%); -webkit-backdrop-filter: blur(18px) saturate(120%); }
.modal-card { border-radius: 26px; background: rgba(255, 255, 255, .82); }
.campaign-banner { color: #5d4817; background: rgba(255, 247, 220, .66); }
.campaign-clock { border-radius: 18px; background: rgba(29, 38, 57, .92); }

.subscription-card {
  display: grid;
  grid-template-columns: minmax(280px, .9fr) minmax(360px, 1.1fr);
  gap: 22px;
  width: min(1040px, calc(100vw - 48px));
  max-width: none;
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
}

.subscription-card p {
  color: #52637c;
  line-height: 1.7;
}

.subscription-price {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 18px 0;
  padding: 18px 20px;
  border: 1px solid rgba(52, 120, 246, .18);
  border-radius: 22px;
  background:
    radial-gradient(circle at 100% 0%, rgba(218, 210, 255, .45), transparent 34%),
    rgba(255, 255, 255, .62);
}

.subscription-price span {
  color: #52637c;
  font-weight: 760;
}

.subscription-price strong {
  color: #0f172a;
  font-size: 42px;
  line-height: 1;
  letter-spacing: -.05em;
}

.subscription-order-box {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 128px;
  padding: 18px;
  border: 1px dashed rgba(52, 120, 246, .28);
  border-radius: 22px;
  background: rgba(248, 251, 255, .66);
  text-align: center;
}

.subscription-order-box > p:first-child {
  max-width: 420px;
  margin: 0 auto;
  font-size: 14px;
  line-height: 1.55;
  text-align: center;
}

.subscription-order-box img {
  width: min(420px, 82vw);
  height: auto;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 16px 32px rgba(63, 79, 112, .14);
}

.subscription-footnote {
  font-size: 12px;
  line-height: 1.5;
}

.subscription-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.subscription-actions button {
  flex: 1 1 140px;
  min-height: 46px;
  border-radius: 16px;
}
.campaign-warning { border-radius: 14px; }

.payment-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
}

.payment-choice figure {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(116, 139, 174, .18);
  border-radius: 18px;
  background: rgba(255, 255, 255, .78);
  text-align: center;
}

.subscription-order-box .payment-choice img {
  width: 100%;
  max-width: 230px;
  justify-self: center;
  border-radius: 14px;
  box-shadow: none;
}

.payment-choice figcaption {
  color: #172033;
  font-weight: 780;
}

.invite-activity-box {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(52, 120, 246, .18);
  border-radius: 16px;
  background: rgba(235, 243, 255, .66);
}

.invite-share-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.invite-share-row label {
  display: grid;
  gap: 6px;
  color: #52637c;
  font-size: 12px;
  font-weight: 760;
}

.invite-share-row input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(123, 151, 194, .34);
  border-radius: 12px;
  background: rgba(255, 255, 255, .72);
  color: #172033;
  font-weight: 800;
}

.invite-share-row button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  white-space: nowrap;
}

.invite-user-list {
  display: grid;
  gap: 6px;
  max-height: 154px;
  overflow: auto;
  padding-top: 4px;
}

.invite-user-list-head,
.invite-user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.invite-user-list-head {
  color: #60708a;
  font-size: 12px;
  font-weight: 800;
}

.invite-user-row {
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid rgba(123, 151, 194, .22);
  border-radius: 12px;
  background: rgba(255, 255, 255, .56);
  color: #172033;
  font-size: 13px;
  font-weight: 760;
}

.invite-user-row .invite-status {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 221, 128, .34);
  color: #8a5a00;
  font-size: 12px;
}

.invite-user-row.effective .invite-status {
  background: rgba(72, 187, 120, .18);
  color: #0f8a4a;
}

.ai-quota-card { max-width: 520px; }
.ai-quota-card ul { margin: 16px 0 22px; padding-left: 20px; line-height: 1.9; }
.pet-quota-line { display: inline-flex !important; gap: 6px; align-items: center; margin-top: 4px; color: #52637c; }
.pet-quota-line button { min-height: 26px; padding: 3px 8px; border-radius: 999px; font-size: 12px; }

.exam-mode-option {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid rgba(226, 80, 98, .18);
  border-radius: 16px;
  background: rgba(255, 239, 243, .62);
}
.exam-mode-option input { width: 20px; height: 20px; }
.exam-mode-option span { display: grid; gap: 3px; }
.exam-mode-option em { color: #7d4b5a; font-style: normal; }

body.exam-mode #pet_main,
body.exam-mode #pet_zhaohuan,
body.exam-mode .pet-main,
body.exam-mode .pet-zhaohuan,
body.exam-mode #pet-chat-dock,
body.exam-mode #pet-assistant,
body.exam-mode .formula-helper {
  display: none !important;
}

@media (max-width: 980px) {
  .subscription-card {
    grid-template-columns: 1fr;
    width: min(680px, calc(100vw - 28px));
  }
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 8px; z-index: 50; height: auto; margin: 8px; border-radius: 20px; background: rgba(247, 250, 255, .76); }
  .main { padding-top: 18px; }
  .login-panel { border-radius: 26px; }
  .summit-hero, .auth-card { border-radius: 20px; }
  .answer-panel { position: static; max-height: none; }
}

@media (max-width: 620px) {
  :root { --mac-radius: 20px; }
  body { letter-spacing: 0; }
  .login-screen { padding: 8px; }
  .login-panel { padding: 8px; border-radius: 22px; }
  .auth-card { padding: 20px; }
  .auth-heading h2 { font-size: 32px; }
  .main { padding: 14px 10px 46px; }
  .sidebar { top: 4px; margin: 4px; padding: 10px; }
  .side-nav { padding-top: 6px; }
  .nav-item { min-width: 88px; }
  .hero-panel, .leaderboard, .panel, .test-box { padding: 18px; }
  .hero-panel { min-height: 0; align-items: stretch; flex-direction: column; }
  .class-selection-panel,
  .class-selection-controls {
    grid-template-columns: 1fr;
  }
  .exam-board-panel {
    grid-template-columns: 1fr;
  }
  .exam-board-segment {
    min-width: 0;
    width: 100%;
  }
  .hero-actions {
    justify-content: flex-start;
    min-width: 0;
    width: 100%;
  }
  .hero-actions .primary {
    flex: 1 1 220px;
  }
  .module-card { min-height: 128px; padding: 18px; }
  .question-float-tools {
    justify-content: flex-start;
  }
  .question-image { min-height: 260px; padding: 12px; border-radius: 18px; }
  .answer-panel { padding: 16px; border-radius: 20px; }
  .answer-panel.handwriting-active .handwriting-toolbar-actions {
    width: 100%;
    margin-left: 0;
    justify-content: stretch;
  }
  .answer-panel.handwriting-active #save-handwriting,
  .answer-panel.handwriting-active #expand-answer {
    width: 100%;
  }
  .answer-sheet { right: 6px; }
  .study-timer-widget { right: 8px; bottom: 10px; }
  .macos-blob { filter: blur(54px) saturate(112%); opacity: .62; }
}

@media (prefers-reduced-motion: reduce) {
  .macos-blob { animation: none !important; }
}

/* Workspace polish: keep the answering surface calm and prevent overlays from covering work. */
#view-workspace {
  position: relative;
}

.workspace-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}

.workspace-top-actions .ghost {
  min-height: 54px;
  padding: 0 20px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .72);
  font-weight: 820;
}

.workspace-top-actions #daily-checkin-settings-btn {
  border-color: rgba(52, 120, 246, .24);
  background: rgba(52, 120, 246, .12);
  color: #1559b8;
}

.workspace-top-actions #daily-checkin-settings-btn.hidden {
  display: none;
}

#view-workspace .workspace {
  grid-template-columns: minmax(0, 720px) minmax(320px, 390px);
  justify-content: center;
  align-items: start;
  gap: 22px;
  width: 100%;
  margin-inline: auto;
}

#view-workspace .question-image {
  width: 100%;
  max-width: 720px;
  margin-inline: auto;
  border-radius: 24px;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
}

#view-workspace .answer-panel {
  border-radius: 24px;
  background: rgba(255, 255, 255, .70);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
}

#view-workspace .choice-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

#view-workspace .choice-grid button {
  min-height: 76px;
  border-radius: 20px;
  border-color: rgba(93, 151, 224, .34);
  background: rgba(255, 255, 255, .66);
  transition: transform 180ms var(--mac-ease), background-color 180ms var(--mac-ease), box-shadow 180ms var(--mac-ease);
}

#view-workspace .choice-grid button:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 12px 24px rgba(63, 79, 112, .12);
}

#view-workspace .choice-grid .selected {
  border-color: rgba(52, 120, 246, .48);
  background: rgba(52, 120, 246, .13);
  color: #1559b8;
}

#view-workspace .question-float-tools {
  gap: 12px;
  margin: 12px 0 16px;
}

#view-workspace .question-float-tools button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 16px;
  font-size: 15px;
  border-color: rgba(94, 116, 151, .22);
  background: rgba(255, 255, 255, .74);
  color: #52627a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72);
}

#view-workspace .question-float-tools button:last-child {
  border-color: rgba(226, 80, 98, .18);
  background: rgba(255, 236, 240, .72);
  color: #c92e4c;
}

#view-workspace .question-float-tools button:hover {
  transform: translateY(-1px);
}

.study-timer-widget {
  top: 14px;
  right: 24px;
  bottom: auto;
  z-index: 70;
  grid-template-columns: 22px auto auto;
  gap: 8px 14px;
  min-width: 238px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow: 0 14px 30px rgba(63, 79, 112, .14);
}

.study-timer-widget .timer-orbit {
  grid-row: 1;
}

.study-timer-widget div {
  min-width: 76px;
}

.answer-sheet {
  width: 280px;
  top: 96px;
  right: 0;
  z-index: 86;
  border-radius: 24px 0 0 24px;
  background: rgba(255, 255, 255, .76);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow: 0 18px 42px rgba(63, 79, 112, .18);
  transition: transform 220ms var(--mac-ease);
}

.answer-sheet.collapsed {
  transform: translateX(calc(100% - 50px));
}

.answer-sheet-toggle {
  left: -50px;
  top: 22px;
  width: 50px;
  min-height: 112px;
  border-radius: 16px 0 0 16px;
}

.answer-sheet-body {
  padding: 18px;
}

.answer-sheet-grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}

.answer-sheet-grid button {
  min-height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .86);
}

.answer-sheet-grid button.current {
  border-color: rgba(52, 120, 246, .60);
  background: rgba(52, 120, 246, .16);
  color: #1559b8;
  box-shadow: 0 0 0 2px rgba(52, 120, 246, .08);
}

.answer-sheet-grid button.draft,
.answer-sheet-grid button.pending,
.answer-sheet-grid button.submitted {
  border-color: rgba(93, 151, 224, .30);
  background: rgba(226, 239, 255, .70);
  color: #2862ad;
}

.daily-checkin-limit-field {
  display: none;
}

body.daily-checkin-setup .daily-checkin-limit-field {
  display: grid;
}

@media (max-width: 980px) {
  #view-workspace .workspace {
    grid-template-columns: minmax(0, 720px);
    width: min(720px, calc(100% - 24px));
  }

  #view-workspace .question-image,
  #view-workspace .answer-panel {
    max-width: 720px;
  }
}

@media (max-width: 640px) {
  #view-workspace .workspace {
    width: calc(100% - 24px);
    gap: 14px;
  }

  #view-workspace .choice-grid {
    grid-template-columns: 1fr;
  }

  #view-workspace .choice-grid button {
    min-height: 68px;
  }

  #view-workspace .question-float-tools {
    display: grid;
    grid-template-columns: 1fr;
  }

  #view-workspace .question-float-tools button {
    width: 100%;
    font-size: 15px;
  }

  .study-timer-widget {
    top: 10px;
    right: 10px;
    grid-template-columns: 20px auto;
    min-width: 150px;
    padding: 8px 10px;
    transform: none;
  }

  .study-timer-widget .timer-orbit {
    grid-row: 1 / span 2;
    width: 20px;
    height: 20px;
  }

  .study-timer-widget div {
    min-width: 0;
  }

  .answer-sheet {
    top: auto;
    right: 12px;
    bottom: 0;
    left: 12px;
    width: auto;
    max-height: min(72vh, 520px);
    border-radius: 24px 24px 0 0;
    transform: translateY(0);
  }

  .answer-sheet.collapsed {
    transform: translateY(calc(100% - 54px));
  }

  .answer-sheet-toggle {
    left: 50%;
    top: -50px;
    width: 148px;
    min-height: 50px;
    transform: translateX(-50%);
    writing-mode: horizontal-tb;
    border-radius: 16px 16px 0 0;
  }

  .answer-sheet-body {
    max-height: calc(72vh - 32px);
    overflow: auto;
  }
}

/* Settings Dashboard */
.settings-dashboard {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.settings-sidebar,
.settings-content,
.settings-pane,
.settings-section,
.settings-card,
.settings-table-card {
  border: 1px solid rgba(116, 139, 174, .22);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .76), rgba(248, 250, 255, .48));
  box-shadow: 0 18px 38px rgba(63, 79, 112, .10);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
}

.settings-sidebar {
  position: sticky;
  top: 22px;
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 24px;
}

.settings-nav-item {
  justify-content: flex-start;
  min-height: 46px;
  padding: 0 14px;
  border-color: transparent;
  border-radius: 16px;
  background: transparent;
  color: #52627a;
  font-size: 15px;
  font-weight: 760;
  box-shadow: none;
}

.settings-nav-item:hover {
  background: rgba(255, 255, 255, .62);
  box-shadow: none;
}

.settings-nav-item.active {
  border-color: rgba(52, 120, 246, .20);
  background: rgba(52, 120, 246, .12);
  color: #1559b8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .68);
}

.settings-content {
  min-height: 620px;
  padding: 18px;
  border-radius: 28px;
}

.settings-pane {
  display: none;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.settings-pane.active {
  display: grid;
  gap: 18px;
}

.settings-pane-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 8px 4px 2px;
}

.settings-pane-head h2 {
  margin: 0 0 6px;
  color: #101a2d;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 820;
  letter-spacing: -.035em;
}

.settings-pane-head p,
.settings-card p,
.settings-save-status {
  margin: 0;
  color: #5c6b82;
  line-height: 1.65;
}

.report-preview-panel {
  display: grid;
  gap: 16px;
}

.report-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.report-preview-head h2 {
  margin: 0;
  color: #101a2d;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 820;
  letter-spacing: -.035em;
}

.report-preview-head span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  background: rgba(52, 120, 246, .12);
  color: #1559b8;
  font-size: 13px;
  font-weight: 780;
  white-space: nowrap;
}

.report-preview-summary {
  display: grid;
  gap: 10px;
}

.report-preview-summary div {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border: 1px solid rgba(116, 139, 174, .18);
  border-radius: 18px;
  background: rgba(255, 255, 255, .58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72);
}

.report-preview-summary span {
  color: #64748b;
  font-size: 14px;
  font-weight: 760;
}

.report-preview-summary strong {
  color: #101a2d;
  font-size: 19px;
  line-height: 1.25;
  font-weight: 820;
}

.report-preview-flow {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px dashed rgba(52, 120, 246, .30);
  border-radius: 18px;
  background: rgba(237, 245, 255, .48);
}

.report-preview-flow p {
  margin: 0;
  color: #42526a;
  line-height: 1.7;
}

.settings-status-pill,
.state-ok {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(52, 120, 246, .12);
  color: #1559b8;
  font-weight: 800;
}

.settings-section {
  padding: 20px;
  border-radius: 24px;
}

.profile-section {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 22px;
}

.avatar-upload {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 12px;
}

.avatar-upload .avatar.large {
  width: 104px;
  height: 104px;
  font-size: 34px;
  border-radius: 50%;
}

.avatar-upload input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.avatar-upload .avatar img,
.avatar-button .avatar img,
.account-mini .avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: inherit;
}

.settings-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.settings-form-grid label,
.settings-card label {
  display: grid;
  gap: 8px;
  color: #253047;
  font-size: 14px;
  font-weight: 780;
}

.settings-form-grid input,
.settings-card input {
  min-height: 50px;
}

.email-bind-row {
  grid-column: 2;
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  margin-top: -6px;
}

.email-bind-row input {
  min-height: 46px;
}

.email-bind-row button {
  min-height: 46px;
  white-space: nowrap;
}

.settings-actions,
.settings-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.settings-actions .primary {
  min-width: 150px;
}

.two-column,
.subscription-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.settings-card {
  display: grid;
  gap: 14px;
  padding: 20px;
  border-radius: 22px;
}

.settings-card h3,
.settings-row-head h3 {
  margin: 0;
  color: #101a2d;
  font-size: 18px;
  font-weight: 820;
}

.danger-soft {
  border-color: rgba(226, 80, 98, .22);
  background: rgba(255, 238, 242, .80);
  color: #c92e4c;
}

.qr-placeholder {
  width: 124px;
  height: 124px;
  border-radius: 18px;
  background:
    linear-gradient(90deg, #111827 10px, transparent 10px) 0 0 / 24px 24px,
    linear-gradient(#111827 10px, transparent 10px) 0 0 / 24px 24px,
    rgba(255, 255, 255, .88);
  box-shadow: inset 0 0 0 12px #fff, 0 10px 24px rgba(63, 79, 112, .10);
}

.device-list,
.login-log-list {
  display: grid;
  gap: 10px;
}

.device-list div,
.login-log-list div,
.privacy-list label {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid rgba(116, 139, 174, .16);
  border-radius: 18px;
  background: rgba(255, 255, 255, .54);
}

.device-list strong,
.login-log-list strong,
.privacy-list strong {
  color: #101a2d;
}

.device-list span,
.login-log-list span,
.privacy-list em {
  color: #63728a;
  font-style: normal;
  line-height: 1.55;
}

.settings-table-card {
  overflow: auto;
  padding: 8px;
  border-radius: 24px;
}

.settings-table {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.settings-table th {
  padding: 10px 14px;
  color: #63728a;
  text-align: left;
  font-size: 13px;
}

.settings-table td {
  padding: 14px;
  background: rgba(255, 255, 255, .62);
  color: #253047;
}

.settings-table td:first-child {
  border-radius: 16px 0 0 16px;
  font-weight: 800;
}

.settings-table td:last-child {
  border-radius: 0 16px 16px 0;
  text-align: right;
}

.plan-card strong,
.settings-big-date {
  color: #101a2d;
  font-size: 32px;
  line-height: 1.1;
  font-weight: 850;
  letter-spacing: -.035em;
}

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

.privacy-list label input {
  width: 22px;
  height: 22px;
  accent-color: #3478f6;
}

@media (max-width: 980px) {
  .settings-dashboard {
    grid-template-columns: 1fr;
  }

  .settings-sidebar {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .profile-section,
  .settings-form-grid,
  .two-column,
  .subscription-grid {
    grid-template-columns: 1fr;
  }

  .email-bind-row {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .settings-content,
  .settings-section,
  .settings-card {
    border-radius: 20px;
  }

  .settings-sidebar {
    grid-template-columns: 1fr 1fr;
  }

  .settings-pane-head,
  .settings-actions,
  .settings-row-head,
  .device-list div,
  .login-log-list div,
  .privacy-list label {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-actions .primary {
    width: 100%;
  }

  .email-bind-row {
    grid-template-columns: 1fr;
  }
}

/* Workspace hardening: override legacy/test styles that can strip the Answer card down to a wireframe. */
#view-workspace .workspace {
  display: grid !important;
  grid-template-columns: minmax(0, 720px) minmax(340px, 420px) !important;
  justify-content: center !important;
  align-items: start !important;
  gap: 24px !important;
  width: 100% !important;
  max-width: 1180px !important;
  margin: 18px auto 0 !important;
}

#view-workspace .answer-panel {
  position: sticky !important;
  top: 88px !important;
  z-index: 20 !important;
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 16px !important;
  width: 100% !important;
  max-height: calc(100vh - 112px) !important;
  overflow: auto !important;
  padding: 28px !important;
  border: 1px solid rgba(116, 139, 174, .24) !important;
  border-radius: 30px !important;
  background:
    radial-gradient(circle at 100% 0%, rgba(225, 212, 255, .38), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 255, .82), rgba(248, 250, 255, .58)) !important;
  box-shadow: 0 24px 54px rgba(63, 79, 112, .16) !important;
  backdrop-filter: blur(26px) saturate(150%) !important;
  -webkit-backdrop-filter: blur(26px) saturate(150%) !important;
}

#view-workspace .answer-panel h2 {
  margin: 0 !important;
  color: #101a2d !important;
  font-size: clamp(32px, 3vw, 44px) !important;
  line-height: 1 !important;
  font-weight: 820 !important;
  letter-spacing: -.045em !important;
}

#view-workspace #question-progress {
  margin: -4px 0 0 !important;
  color: #52637c !important;
  font-size: 17px !important;
  font-weight: 650 !important;
}

#view-workspace .choice-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 14px !important;
  margin: 0 !important;
}

#view-workspace .choice-grid.hidden {
  display: none !important;
}

#view-workspace .choice-grid button {
  min-height: 76px !important;
  padding: 0 18px !important;
  border: 1px solid rgba(93, 151, 224, .34) !important;
  border-radius: 20px !important;
  background: rgba(255, 255, 255, .72) !important;
  color: #101a2d !important;
  font-size: 20px !important;
  font-weight: 820 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .78), 0 8px 18px rgba(63, 79, 112, .08) !important;
}

#view-workspace .choice-grid button:hover {
  transform: translateY(-2px) !important;
  background: rgba(255, 255, 255, .9) !important;
  box-shadow: 0 14px 26px rgba(63, 79, 112, .13) !important;
}

#view-workspace .choice-grid .selected {
  border-color: rgba(52, 120, 246, .54) !important;
  background: rgba(52, 120, 246, .14) !important;
  color: #145bc0 !important;
}

#view-workspace .question-float-tools {
  position: static !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 12px !important;
  width: 100% !important;
  margin: 0 0 4px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#view-workspace .question-float-tools.hidden {
  display: none !important;
}

#view-workspace .question-float-tools .float-grip {
  display: none !important;
}

#view-workspace .question-float-tools button {
  min-height: 44px !important;
  padding: 0 18px !important;
  border: 1px solid rgba(94, 116, 151, .18) !important;
  border-radius: 16px !important;
  background: rgba(255, 255, 255, .78) !important;
  color: #52627a !important;
  font-size: 15px !important;
  font-weight: 760 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72), 0 8px 18px rgba(63, 79, 112, .08) !important;
}

#view-workspace .question-float-tools button:last-child {
  border-color: rgba(226, 80, 98, .20) !important;
  background: rgba(255, 238, 242, .82) !important;
  color: #c92e4c !important;
}

#view-workspace .formula-helper {
  margin: 0 !important;
  border: 1px solid rgba(116, 139, 174, .22) !important;
  border-radius: 18px !important;
  background: rgba(255, 255, 255, .58) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .62) !important;
}

#view-workspace .formula-helper summary {
  min-height: 48px !important;
  padding: 0 16px !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  color: #101a2d !important;
  font-size: 16px !important;
  font-weight: 780 !important;
}

#view-workspace #answer-feedback {
  margin: 0 !important;
  padding: 14px 16px !important;
  border-radius: 18px !important;
  font-size: 15px !important;
  line-height: 1.7 !important;
  font-weight: 730 !important;
}

#view-workspace #submit-answer {
  width: 100% !important;
  min-height: 56px !important;
  border-radius: 18px !important;
  font-size: 17px !important;
  font-weight: 850 !important;
}

#view-workspace .answer-nav {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 12px !important;
}

#view-workspace .answer-nav button {
  min-height: 46px !important;
  border-radius: 16px !important;
  background: rgba(255, 255, 255, .68) !important;
  font-weight: 780 !important;
}

/* Real expanded writing mode. This must beat the sticky Answer-card hardening above. */
#view-workspace .answer-panel.expanded-writing {
  position: fixed !important;
  inset: 22px 22px 22px auto !important;
  width: min(920px, calc(100vw - 44px)) !important;
  max-width: none !important;
  max-height: calc(100vh - 44px) !important;
  z-index: 5000 !important;
  overflow: auto !important;
  padding: 30px !important;
  border-radius: 32px !important;
  background:
    radial-gradient(circle at 96% 2%, rgba(209, 196, 255, .48), transparent 32%),
    linear-gradient(145deg, rgba(255, 255, 255, .94), rgba(246, 250, 255, .84)) !important;
  box-shadow:
    0 34px 90px rgba(31, 41, 73, .24),
    inset 0 1px 0 rgba(255, 255, 255, .86) !important;
}

#view-workspace .answer-panel.expanded-writing #handwriting-canvas {
  height: min(64vh, 720px) !important;
  min-height: 520px !important;
}

#view-workspace .answer-panel.expanded-writing .handwriting-canvas-wrap {
  min-height: 520px !important;
  box-shadow:
    inset 0 0 0 1px rgba(52, 120, 246, .14),
    0 18px 38px rgba(63, 79, 112, .12) !important;
}

#view-workspace .answer-panel.expanded-writing .part-field textarea,
#view-workspace .answer-panel.expanded-writing .subjective-answer textarea {
  min-height: min(60vh, 680px) !important;
  font-size: 18px !important;
  line-height: 1.7 !important;
}

#view-workspace .answer-panel.expanded-writing #expand-answer {
  border-color: rgba(239, 68, 68, .28) !important;
  background: rgba(255, 245, 245, .72) !important;
  color: #9f1239 !important;
}

#answer-sheet.answer-sheet {
  position: fixed !important;
  width: 280px !important;
  top: 104px !important;
  right: 0 !important;
  left: auto !important;
  bottom: auto !important;
  z-index: 90 !important;
  border: 1px solid rgba(116, 139, 174, .24) !important;
  border-right: 0 !important;
  border-radius: 24px 0 0 24px !important;
  background: rgba(255, 255, 255, .78) !important;
  box-shadow: 0 18px 42px rgba(63, 79, 112, .18) !important;
  backdrop-filter: blur(24px) saturate(150%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(150%) !important;
  transform: translateX(0) !important;
}

#answer-sheet.answer-sheet.collapsed {
  transform: translateX(calc(100% - 52px)) !important;
}

#answer-sheet .answer-sheet-toggle {
  position: absolute !important;
  left: -52px !important;
  top: 22px !important;
  width: 52px !important;
  min-height: 116px !important;
  padding: 10px 6px !important;
  border-radius: 16px 0 0 16px !important;
  writing-mode: vertical-rl !important;
  letter-spacing: .12em !important;
  font-size: 16px !important;
  font-weight: 850 !important;
  color: #fff !important;
  background: linear-gradient(180deg, #4c8df8, #6f6de8) !important;
}

@media (max-width: 980px) {
  #view-workspace .workspace {
    grid-template-columns: minmax(0, 720px) !important;
    width: min(720px, calc(100% - 24px)) !important;
  }

  #view-workspace .answer-panel {
    position: relative !important;
    top: auto !important;
    max-height: none !important;
  }
}

@media (max-width: 640px) {
  #view-workspace .workspace {
    width: calc(100% - 24px) !important;
    gap: 14px !important;
  }

  #view-workspace .answer-panel {
    padding: 20px !important;
    border-radius: 24px !important;
  }

  #view-workspace .choice-grid {
    grid-template-columns: 1fr !important;
  }

  #view-workspace .choice-grid button {
    min-height: 68px !important;
  }

  #answer-sheet.answer-sheet {
    top: auto !important;
    right: 12px !important;
    bottom: 0 !important;
    left: 12px !important;
    width: auto !important;
    max-height: min(72vh, 520px) !important;
    border-radius: 24px 24px 0 0 !important;
    transform: translateY(0) !important;
  }

  #answer-sheet.answer-sheet.collapsed {
    transform: translateY(calc(100% - 54px)) !important;
  }

  #answer-sheet .answer-sheet-toggle {
    left: 50% !important;
    top: -50px !important;
    width: 148px !important;
    min-height: 50px !important;
    transform: translateX(-50%) !important;
    writing-mode: horizontal-tb !important;
    letter-spacing: 0 !important;
    border-radius: 16px 16px 0 0 !important;
  }
}
