@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Unbounded:wght@600;700;800&display=swap');

:root {
  color-scheme: light;
  --sky: #e7f1ff;
  --ink: #10284d;
  --muted: #4c6382;
  --line: #cfe0f6;
  --blue: #165dcc;
  --blue-deep: #104498;
  --blue-tint: #e1eeff;
  --lime: #e7fa99;
  --white: #fff;
  font-family: Manrope, system-ui, sans-serif;
  color: var(--ink);
  background: var(--sky);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; }
button, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 3px solid #438bf5; outline-offset: 3px; }
.shell { width: min(1080px, calc(100% - 48px)); margin-inline: auto; }
.topbar { background: var(--white); border-bottom: 1px solid var(--line); border-top: 3px solid var(--blue); }
.topline { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; width: 184px; min-height: 44px; flex: 0 0 auto; }
.brand img { display: block; width: 100%; height: auto; }
nav { display: flex; gap: 4px; }
nav a { padding: 9px 13px; border-radius: 10px; text-decoration: none; font-size: 14px; font-weight: 800; }
nav a:hover, nav a[aria-current] { color: var(--blue-deep); background: var(--blue-tint); }
.hero { display: flex; position: relative; align-items: center; justify-content: space-between; gap: 36px; padding: 45px 0 34px; }
.subject { display: inline-flex; align-items: center; gap: 9px; margin: 0 0 20px; padding: 7px 13px; color: var(--blue-deep); background: #cfe4ff; border-radius: 8px; font-size: 13px; font-weight: 800; }
.subject span { width: 4px; height: 4px; background: currentColor; border-radius: 50%; }
h1 { margin: 0; font: 800 clamp(29px, 5.15vw, 57px)/1.1 Unbounded, system-ui, sans-serif; letter-spacing: -.035em; }
h1:focus { outline: none; }
.intro { color: var(--muted); margin: 15px 0 0; font-size: 16px; line-height: 1.55; }
.hero-paper { width: 190px; height: 148px; margin-right: 48px; flex: 0 0 auto; display: grid; place-items: center; position: relative; transform: rotate(-9deg); border-radius: 16px; border: 1px solid #9fc5fc; color: var(--blue-deep); background: repeating-linear-gradient(0deg, #cde2ff, #cde2ff 25px, #aacdfd 25px, #aacdfd 26px); }
.hero-paper::before { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; border: 1px solid #b7d2fa; background: var(--white); transform: rotate(15deg); }
.hero-paper::after { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: inherit; }
.hero-paper > span { font: 700 66px/1 Unbounded, system-ui, sans-serif; white-space: nowrap; letter-spacing: -.105em; }
.paper-dot { color: var(--blue-deep); display: inline-block; text-align: center; width: 31px; border-radius: 8px; background: var(--lime); }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(285px, .53fr); gap: 20px; align-items: start; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 19px; }
.editor, .rubric { padding: 24px; }
h2 { margin: 0 0 18px; font-size: 22px; font-weight: 800; letter-spacing: -.025em; }
label { font-weight: 800; font-size: 14px; }
textarea { display: block; width: 100%; resize: vertical; min-height: 90px; border: 1px solid #bed2ed; border-radius: 11px; padding: 12px 14px; color: var(--ink); background: #f4f9ff; line-height: 1.6; }
textarea::placeholder { color: #526b8b; }
#source { margin-top: 7px; }
.essay-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 0 7px; }
.field-hint { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.essay-label .field-hint { margin: 0; }
.actions { margin-top: 18px; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 44px; border-radius: 11px; padding: 10px 16px; text-decoration: none; font-size: 14px; font-weight: 800; }
.primary { color: var(--white); background: var(--blue); border: 1px solid transparent; }
.primary:hover { background: var(--blue-deep); }
.secondary { border: 1px solid #bed2ed; background: var(--white); color: var(--blue); }
.secondary:hover { background: #edf5ff; }
.rubric-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.rubric-heading h2 { margin: 0; }
.text-button { background: none; border: 0; padding: 5px 0; color: var(--blue-deep); font-size: 12px; font-weight: 800; }
.text-button:hover { text-decoration: underline; }
.criterion { display: grid; grid-template-columns: 16px 34px 1fr auto; gap: 8px; align-items: center; min-height: 37px; border-bottom: 1px solid #e4eefb; padding-block: 5px; cursor: pointer; font-size: 12px; font-weight: 700; }
.criterion input { width: 15px; height: 15px; margin: 0; accent-color: var(--blue); }
.code { padding: 3px 5px; border-radius: 5px; background: var(--blue-tint); color: var(--blue-deep); text-align: center; font-weight: 800; }
.points { color: var(--muted); font-variant-numeric: tabular-nums; }
.rubric-total { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 16px 0 0; font-weight: 800; font-size: 13px; }
.rubric-total strong { padding: 4px 12px; border-radius: 8px; background: var(--lime); color: #34450f; font-size: 16px; }
.error { color: #9b2942; margin-bottom: 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 54px 0 24px; flex-wrap: wrap; }
.section-head h1 { font-size: clamp(26px, 4vw, 45px); }
.state-note { padding: 24px; margin: 0; color: var(--muted); }
.back { display: inline-block; color: var(--blue-deep); font-weight: 800; margin-bottom: 12px; }
#history-list { list-style: none; margin: 0; padding: 0; }
#history-list li + li { border-top: 1px solid var(--line); }
.history-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 24px; text-decoration: none; }
.history-row:hover { background: #f0f7ff; }
.history-row:first-child { border-radius: 12px; }
.preview { min-width: 0; display: grid; gap: 5px; }
.preview strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview time { color: var(--muted); font-size: 12px; }
.status { flex-shrink: 0; border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 800; background: var(--blue-tint); color: var(--blue-deep); }
.status.completed { background: var(--lime); color: #34450f; }
.status.failed { background: #ffe4e9; color: #962841; }
.more { margin: 14px 24px 20px; }
.result-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(245px, .55fr); align-items: start; gap: 20px; }
.result-panel, .text-panel { padding: 24px; }
.result-total { margin: 0 0 14px; color: var(--blue-deep); font: 700 40px Unbounded, system-ui, sans-serif; }
.result-total small { font: 800 16px Manrope, system-ui, sans-serif; color: var(--muted); }
.result-panel details { border-top: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 800; padding: 13px 0; }
.result-panel summary { list-style: none; display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: baseline; font-size: 14px; }
.result-panel summary::after { content: '+'; color: var(--blue); }
.result-panel details[open] summary::after { content: '−'; }
.result-panel summary::-webkit-details-marker { display: none; }
.result-panel p, .result-panel blockquote, .result-panel li { overflow-wrap: anywhere; line-height: 1.55; }
.feedback-title { font-weight: 800; }
.result-panel blockquote { margin: 6px 0 12px; border-left: 3px solid #bed7ff; padding-left: 10px; color: var(--muted); }
.result-panel ul { margin: 8px 0 15px; padding-left: 23px; }
.saved-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; margin: 0 0 12px; max-height: 420px; overflow: auto; }
#result-message { margin-bottom: 16px; }
footer { padding: 30px 0 24px; font-size: 12px; font-weight: 700; color: var(--muted); }
@media (max-width: 740px) {
  .shell { width: calc(100% - 28px); }
  .topline { min-height: 60px; gap: 8px; }
  nav a { padding-inline: 8px; }
  .brand { width: clamp(118px, 38vw, 150px); }
  .hero { padding-top: 31px; gap: 12px; }
  .hero-paper { width: 86px; height: 80px; margin-right: 5px; border-radius: 10px; }
  .hero-paper > span { font-size: 34px; }
  .paper-dot { width: 15px; }
  .editor-layout, .result-layout { grid-template-columns: minmax(0, 1fr); }
  .editor, .rubric, .text-panel, .result-panel { padding: 16px; }
}
@media (max-width: 370px) { .hero-paper { display: none; } }
