main.page.submit-page {
  --submit-gutter: clamp(32px, 4vw, 72px);
  max-width: none;
  padding: 160px var(--submit-gutter) 24px;   /* 오른쪽 위 Sign out과 붙어 보이지 않게 위 여백을 넉넉히 */
  /* 오른쪽 글자 영역 높이. 파일 박스는 여기에 점수 줄(92px)까지 더해 오른쪽 전체와 높이를 맞춘다.
     위 여백을 늘린 만큼(24px) 줄여 하단 바가 스크롤 없이 보이게 한다 */
  --stage-h: max(240px, calc(100svh - 224px - 92px - 16px - 24px));
  --outcome-h: 92px;
}
/* 로그인 여부를 알기 전에는 본문을 감춰 둔다. 로그인 화면(구분선·오른쪽 영역)이 먼저 그려졌다가
   로그인 안내로 바뀌며 화면이 튀지 않게, 상태가 정해지면 submit.js가 is-pending을 떼고 한 번에 나타낸다 */
.submit-divider, .submit-layout { transition: opacity 320ms ease-out; }
.submit-page.is-pending .submit-divider, .submit-page.is-pending .submit-layout { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .submit-divider, .submit-layout { transition: none; } }
/* 구분선: 화면 끝에서 끝까지 가는 점선 한 줄(작은 체크 무늬는 깨진 글자처럼 보여 바꿨다) */
.submit-divider {
  display: block;
  height: 1px;
  margin: 0 calc(-1 * var(--submit-gutter));
}
.submit-layout {
  max-width: 1536px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 22fr) minmax(0, 78fr);   /* 파일 상자를 조금 좁게 */
  gap: clamp(48px, 5vw, 80px);
  align-items: start;
}
.submit-controls, .submit-sequence { min-width: 0; }
.submit-page .card-head h2 { white-space: normal; }
.submit-page .file-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
  width: 100%;
  height: calc(var(--stage-h) + var(--outcome-h));
  padding: 32px;
  border: 1.5px dashed #d9d5cc;
  border-radius: var(--radius-card);
  background: #f5f3ee;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  color: var(--ink-2);
  font-family: var(--sub), var(--sans);
  font-size: 18px;   /* 글자는 보조: 아이콘보다 작고 옅게 */
  font-weight: 400;
  text-align: center;
}
.submit-page .file-box:hover { background: #f0ede6; border-color: #c9c4b8; }
.submit-page .file-box.dragging { background: #eef1fb; border-color: var(--accent); }   /* 파일을 끌고 올라왔을 때 */
/* 첨부 뒤에는 박스 자체는 누를 수 없다: 손가락 커서와 호버 색을 끈다 */
.submit-page .file-box.has-file, .submit-page .file-box.scoring { cursor: default; }
.submit-page .file-box.has-file:hover, .submit-page .file-box.scoring:hover { background: #f5f3ee; border-color: #d9d5cc; }
.submit-page .file-box.scoring { cursor: progress; }
.submit-page .file-box:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
/* 아이콘이 주인공: 크게, 가는 선으로 */
.file-box-icon { margin-bottom: 24px; width: 96px; height: 104px; stroke: var(--accent); stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
.file-box-icon .back { opacity: 0.4; }
/* 첨부 뒤(채점 중 포함): 아이콘이 가운데 세로축을 중심으로 천천히 돈다 */
.file-box.has-file .file-box-icon, .file-box.scoring .file-box-icon { animation: file-icon-spin 4s linear infinite; }
@keyframes file-icon-spin { from { transform: perspective(500px) rotateY(0deg); } to { transform: perspective(500px) rotateY(360deg); } }
@media (prefers-reduced-motion: reduce) { .file-box .file-box-icon { animation: none !important; } }
.submit-page .file-box { position: relative; }
/* 상자 아래쪽 가운데의 남은 제출 횟수 한 줄 */
.file-box-quota {
  position: absolute; left: 16px; right: 16px; bottom: 20px;
  font-family: var(--mono); font-size: 12px; line-height: 1.4; color: var(--ink-2);
}
.file-box-text {
  position: absolute; left: 32px; right: 32px; top: calc(50% - 12px + 52px + 22px);   /* 아이콘을 12px 올린 만큼 + 아이콘 절반(52) + 간격 */
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
/* 파일 이름은 아이콘 위에 따로 띄운다(아이콘 위치는 그대로). 긴 이름은 한 줄로 자르고 … 로 줄인다 */
.file-box-name {
  position: absolute; left: 32px; right: 32px; bottom: calc(50% + 12px + 52px + 18px);   /* 아이콘을 올린 12 + 아이콘 절반(52) + 간격 */
  display: block; text-align: center; font-family: var(--mono); font-size: 13px; line-height: 1.4; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 첨부 뒤 박스 안의 두 버튼: Submit(채점 시작)과 그 아래 change file(다시 고르기). 글자만 있고 Sign out과 같은 호버 */
.file-box-action, .change-file {
  margin: 0 auto; padding: 0; height: auto;
  border: 0; border-bottom: 1px solid transparent; border-radius: 0; background: none; cursor: pointer;
  font-family: var(--nav); font-size: 18px; font-weight: 400; letter-spacing: 0.035em; color: var(--ink-2);
  transition: color 160ms var(--ease), border-color 160ms var(--ease);
}
/* Sign out과 같은 호버: 글자가 진해지고 밑줄이 생긴다 */
.change-file:hover { color: var(--ink); background: none; border-bottom-color: var(--line); }
.file-box-action { color: var(--accent); }
.file-box-action:hover { color: #2749c7; background: none; border-bottom-color: rgba(47, 85, 224, 0.3); }   /* 밑줄은 글자보다 연하게 */
.file-box-action:focus-visible, .change-file:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.submit-page .file-box #fileBoxLabel { color: var(--muted); letter-spacing: 0.02em; }
.submit-page .result { margin-top: 24px; animation: none; }
.submit-page .result:empty { margin: 0; }
.submit-sequence { min-height: 420px; color: var(--accent); }
.sequence-idle { font-family: var(--mono); font-size: 13px; line-height: 1.1; }
.sequence-wait { margin: 0; color: var(--muted); }
.sequence-wait .sequence-caret { color: var(--accent); }
.sequence-notice { margin: 0; color: #b42318; white-space: pre-wrap; line-height: 1.5; }
.sequence-caret { animation: sequence-caret-blink 1s steps(1, end) infinite; }
@keyframes sequence-caret-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.sequence-label {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.4;
  color: var(--muted);
  margin: 0 0 10px;
}
.sequence-viewport {
  height: var(--stage-h);
  overflow: hidden;
  overflow-anchor: none;
}
.sequence-viewport pre {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  white-space: pre-wrap;
  word-break: break-all;
  text-align: justify;
  margin: 0;
}
/* 점수: 위 글자 영역과 가는 점선으로 나눠 결과임을 드러낸다 */
.sequence-outcome {
  margin-top: 20px; padding-top: 18px;
  background: radial-gradient(circle, var(--muted) 0.6px, transparent 0.9px) top left / 6px 1px repeat-x;
}
.sequence-score {
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
  margin: 0;
}
/* 점수 줄 오른쪽 끝의 리더보드 링크(글자만, Sign out과 같은 호버) */
.sequence-result-row { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; }
.leaderboard-link {
  flex: none;
  font-family: var(--nav); font-size: 18px; letter-spacing: 0.035em; color: var(--ink-2);
  border-bottom: 1px solid transparent; text-decoration: none;
  transition: color 160ms var(--ease), border-color 160ms var(--ease);
}
.leaderboard-arrow { width: 14px; height: 10px; margin-left: 8px; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; vertical-align: 0.05em; }
.leaderboard-link:hover { color: var(--ink); border-bottom-color: var(--line); text-decoration: none; }
.leaderboard-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.submit-announcement {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
/* 로그인 전: 오른쪽 영역은 숨기고 로그인 안내를 가운데에 */
.submit-layout:has(#needLogin:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
.submit-layout:has(#needLogin:not([hidden])) .submit-sequence { display: none; }
.submit-page .signin-prompt {
  margin: 120px auto 0; text-align: center;
  font-family: var(--sub); font-size: 36px; letter-spacing: 0.01em; color: var(--ink-2);
}
/* 로그인 전에는 위쪽 점선 구분선을 없애고, 오른쪽 위 Sign in 왼쪽에 좌우로 흔들리는 화살표를 붙인다 */
.submit-page:has(#needLogin:not([hidden])) .submit-divider { display: none; }
/* 문장 끝에서 오른쪽 위 Sign in까지 이어지는 손그림 같은 점선 화살표(submit.js가 위치를 계산해 그린다).
   점선이 Sign in 쪽으로 천천히 흘러간다 */
.signin-arrow { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 19; overflow: visible; }
.signin-arrow .line, .signin-arrow .head { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.signin-arrow .line { stroke-dasharray: 2 7; }
.signin-arrow .head { stroke-dasharray: 2 4.5; }
.signin-arrow .reveal { fill: none; stroke: #fff; stroke-width: 8; }

@media (max-width: 760px) {
  main.page.submit-page { --submit-gutter: 24px; padding: 132px var(--submit-gutter) 48px; }
  .submit-divider { margin-bottom: 28px; }
  .submit-layout { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .submit-page .file-box { width: 90%; margin-inline: auto; height: clamp(320px, 48svh, 440px); }
  .submit-sequence { min-height: 0; }
  .sequence-viewport { height: clamp(220px, 36vh, 360px); }
  .sequence-viewport pre { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .sequence-caret { animation: none; }
}
