.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 40px;
  height: 76px;
  border-bottom: 1px solid transparent;
  margin-bottom: 32px;
}

.app-header::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  background: var(--chrome-material);
  border-bottom: 1px solid var(--material-line);
  box-shadow: inset 0 1px 0 var(--material-rim);
  -webkit-backdrop-filter:blur(28px) saturate(115%);
  backdrop-filter: blur(28px) saturate(115%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -.4px;
  white-space: nowrap;
}

.brand svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.primary-nav {
  display: flex;
  gap: 4px;
  align-items: center;
}

.primary-nav a {
  color: var(--muted);
  font-size: 14px;
  padding: 8px 12px;
  border-radius: var(--control-radius);
}

.primary-nav a:hover {
  color: var(--text);
}

.primary-nav [aria-current="page"] {
  color: var(--text);
  background: var(--overlay);
}

.header-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.connection {
  font-size: 11px;
  color: var(--subtle);
}

.account-trigger {
  min-width: 0;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice {
  max-width: 760px;
  margin: 0 auto 24px;
  padding: 10px 14px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--muted);
}

.notice:not(.error) {
  background: var(--floating-material);
  border-color: var(--material-line);
  -webkit-backdrop-filter:blur(24px);
  backdrop-filter: blur(24px);
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  width: max-content;
  max-width: calc(100% - 40px);
  box-shadow: var(--shadow);
  margin: 0;
  pointer-events: none;
}

.notice:empty {
  display: none;
}

.notice.error {
  color: var(--love);
  border-color: var(--love);
}





.surface-heading,.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.surface-heading h2,.section-heading h2 {
  margin: 0;
}



.inline-field {
  display: flex;
  gap: 8px;
  align-items: start;
}

.inline-field>input,.inline-field>select,.inline-field>.select-picker {
  flex: 1;
  min-width: 0;
}

.inline-field>button {
  flex-shrink: 0;
}

.file-button {
  position: relative;
  overflow: hidden;
  margin: 0;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.file-button.disabled input {
  cursor: not-allowed;
}

details>summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0;
  list-style: none;
}

details>summary::-webkit-details-marker {
  display: none;
}

details>summary::after {
  content: '+';
  float: right;
  color: var(--subtle);
  margin-left: 12px;
}

details[open]>summary::after {
  content: '−';
}

details>summary:hover {
  color: var(--text);
}

details[open]>summary {
  margin-bottom: 8px;
}

code,kbd {
  font: 12px ui-monospace,SFMono-Regular,Consolas,monospace;
}

footer {
  display: none;
}

/* Selects share one accessible, keyboard-operated menu rather than platform popups. */
.select-picker {
  position: relative;
  width: 100%;
}

.select-trigger {
  width: 100%;
  height: var(--control-height);
  padding: 8px 12px;
  font-size: 15px;
  line-height: 24px;
  justify-content: space-between;
  font-weight: 400;
  text-align: left;
}

.select-trigger>span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-trigger svg {
  width: 16px;
  height: 16px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 1.8;
  flex-shrink: 0;
}

.select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  min-width: 200px;
  max-height: 300px;
  overflow: auto;
  padding: 5px;
  background: var(--floating-material);
  border: 1px solid var(--material-line);
  border-radius: 10px;
  box-shadow: var(--material-shadow);
  -webkit-backdrop-filter:blur(32px) saturate(120%);
  backdrop-filter: blur(32px) saturate(120%);
  z-index: 20;
  animation: menu-in 160ms ease-out;
}

.select-option {
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  width: 100%;
  justify-content: space-between;
  text-align: left;
  font-weight: 400;
  background: transparent;
}

.select-option[aria-selected="true"] {
  color: var(--foam);
  background: var(--accent-soft);
}

.select-option:focus {
  outline: 0;
  background: var(--hover);
  box-shadow: inset 0 0 0 1px var(--focus);
}

/* Comfortable proof/document reading. */
.rendered {
  font-size: 16px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.rendered p:first-child {
  margin-top: 0;
}

.rendered p:last-child {
  margin-bottom: 0;
}

.rendered pre {
  background: var(--overlay);
  padding: 16px;
  border-radius: var(--control-radius);
  overflow: auto;
}

.rendered code {
  font-size: .86em;
}

.rendered blockquote {
  margin-left: 0;
  padding-left: 16px;
  border-left: 2px solid var(--line);
  color: var(--muted);
}

.rendered table {
  border-collapse: collapse;
  display: block;
  overflow: auto;
}

.rendered td,.rendered th {
  padding: 8px 12px;
  border: 1px solid var(--line);
}

.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}

.problem-card {
  width:100%;
  margin:0 0 24px;
}

.problem-card .rendered {
  max-width:none;
  font-size: 17px;
}

.problem-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.proof-surface { padding:0; min-width:0; }

.proof-surface .workspace {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 12px;
}

.editor-pane,.preview-pane {
  min-width: 0;
  overflow: hidden;
  border-radius: 10px;
}

.editor-pane {
  background: var(--surface);
  transition: box-shadow 160ms;
}

.editor-pane:focus-within {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--focus) 42%, transparent);
}

.preview-pane { background: var(--surface); }

.editor-toolbar {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  align-items: center;
  min-height: 40px;
  margin-bottom: 8px;
  column-gap: 12px;
}

.editor-toolbar>.workspace-tabs { display: none; }
.wide-editor-title,.wide-preview-title { grid-row: 1; padding: 4px 24px; font-size: 16px; font-weight: 500; }
.wide-editor-title { grid-column: 1; }
.wide-preview-title { grid-column: 2; color: var(--muted); }
.editor-toolbar>.subtle { grid-column: 1; grid-row: 1; justify-self: end; margin-right: 24px; font-size: 12px; }

.workspace-tabs,.review-tabs {
  display: flex;
  gap: 4px;
  align-items: center;
}

.workspace-tabs button,.review-tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  padding: 8px 12px;
  min-height: 36px;
}

.workspace-tabs [aria-pressed="true"],.review-tabs [aria-pressed="true"] {
  background: var(--overlay);
  color: var(--text);
}

.editor-pane textarea {
  border: 0;
  border-radius: 10px;
  min-height: 360px;
  height: 360px;
  padding: 24px;
  resize: none;
  background: transparent;
  font: inherit;
  font-size: 16px;
  line-height: 1.8;
  letter-spacing: normal;
}

.editor-pane textarea:focus { outline: 0; }

.preview {
  padding: 24px;
  min-height: 360px;
  max-height: 600px;
  overflow: auto;
}

.editor-tip {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 24px 0;
}

.attachments { padding: 12px 0 4px; }
.attachments>.file-button { padding-inline: 24px; }
.attachment-icon { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.attachments>.subtle { font-size: 12px; margin-left: 8px; }

.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(160px,1fr));
  gap: 12px;
}

.image-gallery:empty {
  display: none;
}

.image-card {
  margin: 12px 0 0;
  max-width: 280px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--base);
}

.image-card img {
  width: 100%;
  height: 140px;
  object-fit: contain;
  border-radius: 4px;
}

.image-card figcaption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.image-card figcaption>span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-card button {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 11px;
}

.image-card a {
  display: block;
}

/* Shared overlay and account settings. */
dialog {
  width: min(460px,calc(100% - 32px));
  max-height: calc(100dvh - 40px);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--material-line);
  border-radius: var(--radius-dialog);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--material-shadow);
  animation: dialog-in 180ms ease-out;
}

dialog::backdrop {
  background: var(--scrim);
  -webkit-backdrop-filter:blur(5px);
  backdrop-filter: blur(5px);
}

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 20px;
}

.dialog-heading button {
  width: var(--control-height);
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 24px;
}

.dialog-actions {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}

.settings-section {
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.settings-section:last-child {
  padding-bottom: 0;
}

.settings-section h3 {
  margin: 0 0 12px;
}

.theme-options {
  display: flex;
  background: var(--overlay);
  padding: 4px;
  border-radius: 9px;
  gap: 4px;
}

.theme-options button {
  flex: 1;
  padding: 6px 8px;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.theme-options [aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px #0001;
}

.account-status {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 16px;
}

#account-submit {
  width: 100%;
  margin-top: 8px;
}

#switch-auth {
  width: 100%;
  margin-top: 8px;
}

#account-error:empty {
  display: none;
}

.key-connected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#account-key-state {
  font-size: 13px;
  margin: 0;
}

#logout {
  margin-top: 16px;
}

#account-description {
  font-size: 14px;
  margin-bottom: 20px;
}

.back-link {
  display: inline-block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 24px;
}

#practice-work {
  width:100%;
  margin:0;
}

.pane-heading {
  display: flex;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.pane-heading>label {
  margin: 0;
}

.pane-heading>span:last-child {
  color: var(--muted);
  font-size: 12px;
}

#practice-work>.workspace-tabs {
  margin-bottom: 12px;
}

.submit-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-top: 20px;
}

.submit-action {
  display: flex;
  align-items: center;
  gap: 16px;
}

#model {
  display: none;
}

.key-field {
  font-size: 12px;
}

#practice-key-settings {
  font-size: 12px;
}

#status {
  font-size: 13px;
  color: var(--muted);
}

#status.error {
  color: var(--love);
}

.history-section {
  margin-top: 32px;
}

.section-heading {
  margin-bottom: 16px;
}

.section-heading h2 {
  font-size: 15px;
}

/* One document surface; attempt navigation stays a lightweight horizontal timeline. */
.attempt-rail {
  display: flex;
  gap: 4px;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 0 0 12px;
  margin-bottom: 12px;
  scrollbar-width: thin;
}

.attempt-rail>button {
  flex: 0 0 auto;
  gap: 10px;
  min-width: 100px;
  height: 44px;
  padding: 8px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  box-shadow: inset 0 -1px 0 var(--line);
}

.attempt-rail>[aria-selected="true"] {
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--foam);
}

.attempt-rail-number {
  font-size: 12px;
  color: var(--subtle);
}

.attempt-rail-verdict {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.attempt-rail>[data-status="pending"] .attempt-rail-verdict { color: var(--gold); }
.attempt-rail>[data-status="failed"] .attempt-rail-verdict { color: var(--love); }

.review-stage {
  min-width: 0;
  outline-offset: 4px;
}

.review-document-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  min-height: 76px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 104px;
}

.review-document-stamp {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12px;
  color: var(--muted);
}

.review-document-stamp time { white-space: nowrap; }
.attempt-best { color: var(--foam); font-size: 12px; }

.review-document-verdict {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.review-document-verdict strong {
  font-size: 25px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -.6px;
}

.review-document-verdict>span { color: var(--muted); font-size: 12px; }
.review-document-verdict.is-status strong { font-size: 13px; letter-spacing: 0; font-weight: 500; color: var(--muted); }

.review-appeal-trigger { flex-shrink: 0; }

.review-document-content {
  padding: 24px 0;
  max-width: 880px;
  min-height: 140px;
}

.review-block { margin-bottom: 24px; }
.review-block>h3 { color: var(--muted); font-size: 12px; font-weight: 500; margin: 0 0 12px; }
.review-document-content>h3 { border-top: 1px solid var(--line); padding-top: 24px; margin: 24px 0 16px; color: var(--muted); font-size: 13px; font-weight: 500; }
.review-disclosure>summary { color: var(--muted); font-size: 13px; }
.review-disclosure>.rendered { padding: 4px 0 16px; }
.review-document-content .image-gallery:empty { display: none; }

.feedback {
  border-top: 1px solid var(--line);
  padding: 24px;
}

.feedback h3 {
  font-size: 12px;
  color: var(--muted);
  margin: 24px 0 12px;
  letter-spacing: 0;
}

.feedback h3:first-child {
  margin-top: 0;
}

.feedback .meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 16px;
}

.history-owner {
  display: none;
}

.empty-history {
  font-size: 13px;
  color: var(--muted);
}

#score {
  font-size: 12px;
  color: var(--muted);
  position: relative;
}

#score strong {
  color: var(--text);
  font-size: 20px;
  margin-left: 8px;
}

.score-tooltip {
  display: none;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }

}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }

}

@keyframes content-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }

}

.page-enter {
  animation: content-in 200ms ease-out;
}

@media(max-width:1000px) {

  .proof-surface .workspace {
    display: block;
  }

  .editor-pane {
    border-right: 0;
  }

  .editor-toolbar {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    gap: 12px;
  }

  .editor-toolbar>.workspace-tabs {
    display: flex;
  }

  .editor-toolbar>.subtle {
    margin: 0;
    font-size: 11px;
  }

  .wide-editor-title,.wide-preview-title {
    display: none;
  }

  body:not([data-workspace="preview"]) .preview-pane {
    display: none;
  }

  body[data-workspace="preview"] .editor-pane {
    display: none;
  }

  .editor-pane textarea,.preview {
    min-height: 320px;
    height: 320px;
  }

}

@media(max-width:720px) {
  :root {
    --control-height: 44px;
  }


  .app-header {
    height: 72px;
    gap: 16px;
    margin-bottom: 24px;
  }

  .brand span {
    display: none;
  }

  .brand svg {
    width: 24px;
    height: 24px;
  }

  .primary-nav {
    gap: 0;
  }

  .primary-nav a {
    font-size: 13px;
    padding: 8px 10px;
  }

  .header-actions {
    gap: 0;
  }

  .connection {
    display: none;
  }

  .account-trigger {
    font-size: 12px;
    padding: 8px;
    max-width: 120px;
  }

  h1 {
    font-size: 25px;
  }

  button,.file-button,input,select {
    min-height: 44px;
  }

  input,select {
    height: 44px;
  }

  input,textarea,.select-trigger {
    font-size: 16px;
  }

  .inline-field {
    flex-wrap: wrap;
  }

  .inline-field>input,.inline-field>.select-picker {
    min-width: 160px;
  }

  .page-heading {
    margin-bottom: 24px;
  }

  .editor-pane textarea,.preview {
    padding: 20px;
    min-height: 300px;
    font-size: 16px;
  }

  .editor-tip { font-size: 12px; padding: 4px 20px 0; }
  .attachments>.file-button { padding-inline: 20px; }
  .editor-toolbar .workspace-tabs button { padding-inline: 20px; }

  .editor-tip>span:last-child {
    display: none;
  }

  .attachments>.subtle {
    display: block;
    margin: 4px 8px 0;
  }





  .submit-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .submit-action {
    width: 100%;
  }

  .submit-action button {
    width: 100%;
  }

  .feedback {
    padding: 20px;
  }

  .attempt-rail>button { min-width: 88px; padding: 8px 12px; }
  .review-document-toolbar { gap: 12px; padding: 16px 0; min-height: 76px; }
  .review-appeal-trigger { grid-column: 1 / -1; justify-self: end; }
  .review-document-stamp { flex-direction: column; gap: 4px; font-size: 11px; }
  .review-document-verdict strong { font-size: 23px; }
  .review-document-content { padding: 20px 0; }
  .dialog-actions {
    flex-wrap: wrap;
  }

  .theme-options button {
    min-height: 40px;
  }

}

@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after {
    animation: none!important;
    transition: none!important;
    scroll-behavior: auto!important;
  }

}

.model-picker {
  position: relative;
}

.model-options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--material-line);
  border-radius: 10px;
  padding: 5px;
  background: var(--floating-material);
  box-shadow: var(--material-shadow);
  -webkit-backdrop-filter:blur(32px) saturate(120%);
  backdrop-filter: blur(32px) saturate(120%);
  z-index: 30;
}

.model-options>button {
  height: auto;
  white-space: normal;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 6px;
  padding: 10px;
  gap: 2px;
  font-size: 13px;
}

.model-options>button:focus {
  background: var(--overlay);
}

.model-options small {
  font-size: 11px;
  margin: 0;
  overflow-wrap: anywhere;
}

.model-options>.field-help {
  padding: 12px;
  margin: 0;
}

#save-default-model {
  margin-top: 12px;
}

.appearance-trigger {
  flex-shrink: 0;
  inline-size: 44px;
  block-size: 44px;
  min-inline-size: 44px;
  padding: 10px;
}

.appearance-trigger svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.appearance-dialog {
  max-width: 360px;
}

.settings-footer {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 20px;
}

.settings-footer #logout {
  margin: 0;
}

#settings-error:empty,#key-save-status:empty {
  display: none;
}

/* Solid surfaces when blur is unavailable or the user asks for less transparency. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .app-header::before {
    background: var(--base);
  }

  .surface, .panel, dialog {
    background: var(--surface);
  }

  .select-menu, .model-options, .action-menu .action-popover, .notice:not(.error) {
    background: var(--overlay);
  }

}

@media (prefers-reduced-transparency: reduce) {
  body {
    background-image: none;
  }

  .app-header::before {
    background: var(--base);
  }

  .surface, .panel, dialog {
    background: var(--surface);
  }

  .select-menu, .model-options, .action-menu .action-popover, .notice:not(.error) {
    background: var(--overlay);
  }

  .app-header::before, dialog, dialog::backdrop, .select-menu, .model-options, .action-menu .action-popover, .notice:not(.error) {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

}

/* Press feedback never moves keyboard or reduced-motion interactions. */
:root.keyboard-input button:active { transform: none; }
:root.keyboard-input button { transition-duration: 0s; }
@media (prefers-reduced-motion: reduce) { button:active:not(:disabled) { transform: none; } }
.destructive { background: var(--love); color: var(--button-text); }
.closed-room-state { padding: 24px 0; }
.closed-room-state>#closed-history-host { margin-top: 32px; }

/* A finished attempt has a work document and a grader review, never one prose pile. */
.results .review-document-content { max-width: none; padding: 0; container-type: inline-size; }
.attempt-review-layout { display:grid; grid-template-columns:minmax(0,1.15fr) minmax(0,1fr); gap:24px; align-items:start; }
.review-region { min-width: 0; }
.results .review-region { padding:28px 0; }
.results .review-work { padding:24px 28px 24px 0; }
.results .review-grading { padding:24px 28px; background:var(--surface); border-radius:var(--radius-surface); }
.review-region>h3 { margin:0 0 16px; color: var(--text); font-size: 17px; font-weight: 600; letter-spacing: -.4px; }
.review-region .rendered { max-width: 75ch; }
.grade-evidence { margin-top: 24px; }
.grade-evidence>h4 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 10px; }
.grade-original-score { margin: -8px 0 20px; color: var(--muted); font-size: 13px; }
.attempt-appeal-region { padding:24px 28px; margin:24px 0 0; background:var(--surface); border-radius:var(--radius-surface); scroll-margin-top:104px; }
.attempt-appeal-region>h3 { font-size: 20px; margin: 0 0 24px; color: var(--text); }
.appeal-argument { margin-bottom:24px; }
.appeal-argument>h4,.appeal-decision>h4 { color:var(--muted); font-size:14px; margin: 0 0 12px; font-weight: 600; }
.appeal-argument>p { margin: 0; max-width: 75ch; white-space: pre-wrap; overflow-wrap: anywhere; }
.appeal-decision .rendered { max-width: 75ch; }
.appeal-decision>h5 { margin: 24px 0 10px; font-size: 13px; color: var(--muted); }
.appeal-form { max-width: 760px; }
.appeal-form>label { margin-top: 0; }
.appeal-form>textarea { font-size: 16px; }
.appeal-form>.error:empty { display: none; }
.appeal-form>button { margin-top: 16px; }

@media (max-width: 900px) {
  .attempt-review-layout { display:flex; flex-direction:column; gap:24px; }

  .review-region { width: 100%; }
  .results .review-region { padding:24px 0; }
  .results .review-grading { border:0; padding:24px; border-radius:var(--radius-surface); }
  .results .review-work { border-radius:0; }
  .attempt-appeal-region { padding: 20px; margin-bottom: 28px; }
}

@container (max-width: 760px) {
  .attempt-review-layout { display:flex; flex-direction:column; gap:24px; }

  .review-region { width: 100%; }
  .results .review-region { padding:24px 0; }
  .results .review-grading { border:0; padding:24px; border-radius:var(--radius-surface); }
  .results .review-work { border-radius:0; }
}

/* Selected-work identity stays visible when the appeal is collapsed. */
.selected-work-identity { flex-basis:100%; font-size:14px; font-weight:600; color:var(--text); }
.selected-work-status { grid-column:1/-1; display:flex; align-items:center; gap:12px; }
.appeal-state-chip { display:inline-flex; align-items:center; gap:7px; padding:5px 10px; background:var(--overlay); border:1px solid var(--line); border-radius:8px; color:var(--text); font-size:12px; font-weight:600; }
.appeal-state-chip::before { content:''; width:6px; height:6px; border-radius:50%; background:var(--foam); }
.appeal-state-chip[data-status='declined']::before,.appeal-state-chip[data-status='failed']::before { background:var(--love); }
.appeal-state-chip[data-status='pending']::before { background:var(--gold); }
.appeal-score-change { color:var(--text); font-size:13px; font-variant-numeric:tabular-nums; }
.work-snapshot-note,.appeal-context { color:var(--muted); font-size:12px; margin:-8px 0 20px; max-width:75ch; }
.appeal-decision { border-top:1px solid var(--line); padding-top:20px; }
.appeal-decision .appeal-status { font-weight:600; }
@media(max-width:720px) { .selected-work-status { flex-wrap:wrap; gap:8px; } }

.custom-problem-field>label { margin-top:20px; }
.custom-problem-field:first-child>label { margin-top:0; }
.custom-problem-field textarea { min-height:100px; }
.custom-import-tools { display:flex; flex-wrap:wrap; gap:8px; margin-top:16px; }
.custom-import-tools label { margin:0; }
#next-problem-form>.primary,#practice-custom-form>.primary { margin-top:24px; inline-size:auto; }
#custom-problem-dialog { width:min(720px,calc(100% - 32px)); }
#duel-problem-fields { display:grid; grid-template-columns:minmax(0,1.15fr) minmax(0,1fr); gap:16px 24px; }
#duel-problem-fields>.custom-problem-field { display:flex; flex-direction:column; min-width:0; }
#duel-problem-fields>.custom-problem-field>label { margin:0 0 8px; }
#duel-problem-fields>.custom-problem-field>textarea { flex:1; }
#duel-problem-fields>.custom-problem-field:first-child { grid-column:1/-1; }
#duel-problem-fields>.custom-problem-field:nth-child(2) { grid-column:1; grid-row:2/4; }
#duel-problem-fields>.custom-problem-field:nth-child(2)>textarea { min-height:280px; }
#duel-problem-fields>.custom-import-tools,#duel-problem-fields>.field-help,#duel-problem-fields>.error { grid-column:1/-1; margin-top:0; }
#duel-problem-fields>.error:empty { display:none; }
@media(max-width:720px) { #duel-problem-fields { display:flex; flex-direction:column; gap:20px; } #duel-problem-fields>.custom-problem-field:nth-child(2)>textarea { min-height:140px; } }
