:root {
  color-scheme: light;
  --paper: #eef2ea;
  --paper-warm: #f8f5ea;
  --surface: #fffdf6;
  --surface-2: #f5f8ef;
  --ink: #17211f;
  --ink-2: #2d3936;
  --muted: #65716c;
  --line: #d5ddd4;
  --line-strong: #a8b7ad;
  --green: #2f6f61;
  --green-2: #dbece5;
  --brick: #b84e38;
  --brick-2: #f3ddd7;
  --blue: #365fa7;
  --blue-2: #dfe8f7;
  --amber: #d99d22;
  --amber-2: #fff1c7;
  --shadow: 0 22px 50px rgba(26, 42, 37, 0.13);
  --code: #121c19;
  --radius: 8px;
  --font-sans:
    "Pretendard Variable",
    "Apple SD Gothic Neo",
    "Noto Sans KR",
    "Segoe UI",
    system-ui,
    sans-serif;
  --font-mono:
    "JetBrains Mono",
    "Cascadia Code",
    "SFMono-Regular",
    "Liberation Mono",
    monospace;
}

* {
  box-sizing: border-box;
}

html {
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(90deg, rgba(47, 111, 97, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(184, 78, 56, 0.05) 1px, transparent 1px),
    var(--paper);
  background-size:
    48px 48px,
    48px 48px,
    auto;
  color: var(--ink);
  font-family: var(--font-sans);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
input,
select,
textarea,
a {
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(54, 95, 167, 0.28);
  outline-offset: 2px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.app-shell {
  width: min(1840px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(16px, 2.4vw, 34px);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(420px, 0.9fr);
  gap: clamp(18px, 3vw, 42px);
  align-items: end;
  padding-bottom: 18px;
}

.brand-block {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.73rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 3.2rem;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1;
}

.top-copy {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--ink-2);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.55;
}

.topbar-aside {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.judge-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 253, 246, 0.88);
  padding: 10px 12px;
  box-shadow: 0 10px 26px rgba(26, 42, 37, 0.08);
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(47, 111, 97, 0.13);
}

.judge-status strong,
.judge-status span {
  display: block;
}

.judge-status strong {
  font-size: 0.86rem;
  font-weight: 950;
}

.judge-status span {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 800;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(88px, 1fr));
  gap: 8px;
  width: min(680px, 100%);
}

.stat-pill {
  min-height: 62px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--green);
  border-radius: var(--radius);
  background: rgba(255, 253, 246, 0.9);
  padding: 8px 11px;
}

.stat-pill:nth-child(2) {
  border-top-color: var(--blue);
}

.stat-pill:nth-child(3) {
  border-top-color: var(--brick);
}

.stat-pill:nth-child(4) {
  border-top-color: var(--amber);
}

.stat-pill:nth-child(5) {
  border-top-color: var(--blue);
}

.stat-pill span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.stat-pill strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 1.14rem;
  font-weight: 950;
  line-height: 1.1;
}

.search-band {
  display: grid;
  grid-template-columns: 220px minmax(280px, 1fr) auto;
  gap: 12px 14px;
  align-items: end;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(47, 111, 97, 0.08), transparent 26%),
    var(--surface);
  box-shadow: var(--shadow);
  padding: clamp(14px, 2vw, 22px);
}

.command-head {
  align-self: center;
}

.command-head span {
  display: block;
  color: var(--brick);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.command-head strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.35;
}

.search-form {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.search-label,
.sort-row label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.search-form input,
.tag-search,
.sort-row select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
}

.search-form input {
  min-height: 46px;
  border-color: var(--line-strong);
  font-size: 1.08rem;
  font-weight: 750;
}

.search-form input:focus,
.tag-search:focus,
.sort-row select:focus,
.submit-console textarea:focus,
.submit-console select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 111, 97, 0.15);
  outline: none;
}

.search-form button,
.pager button,
.filter-heading button,
.detail-actions a,
.detail-actions button,
.console-actions button,
.ledger-head button {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
  font-weight: 950;
}

.search-form button {
  min-height: 46px;
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

.search-form button:hover,
.console-actions button:hover {
  transform: translateY(-1px);
}

.pager button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.sort-row {
  display: grid;
  grid-template-columns: auto minmax(140px, 190px) auto minmax(118px, 150px);
  gap: 8px;
  align-items: center;
}

.active-filter-row {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 30px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.filter-empty {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.active-filter {
  min-height: 28px;
  border: 1px solid #c9d7cf;
  border-radius: 999px;
  background: #edf5ef;
  color: #1d4a40;
  padding: 4px 9px;
  font-size: 0.78rem;
  font-weight: 900;
}

.active-filter span {
  margin-left: 7px;
  color: var(--brick);
}

.workspace {
  display: grid;
  grid-template-columns: 282px minmax(400px, 1fr) minmax(430px, 560px);
  gap: 14px;
  align-items: start;
  margin-top: 14px;
}

.filter-panel,
.results-panel,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 246, 0.94);
}

.filter-panel {
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: 15px;
}

.filter-heading,
.results-meta,
.detail-head,
.console-head,
.console-actions,
.ledger-head,
.inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.filter-heading h2,
.filter-group h3,
.console-head h3,
.ledger-head h3,
.inspector-head h3 {
  margin-bottom: 0;
}

.filter-heading h2 {
  font-size: 1rem;
}

.filter-group {
  margin-top: 20px;
}

.filter-group h3 {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.chip-grid,
.tag-list,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.tag-list {
  max-height: 430px;
  overflow: auto;
  padding-right: 4px;
}

.tag-search {
  margin-top: 10px;
}

.chip,
.tag-token {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  padding: 5px 9px;
  font-size: 0.8rem;
  font-weight: 850;
}

.chip:hover,
.tag-token:hover {
  border-color: var(--green);
}

.chip[data-active="true"] {
  border-color: var(--green);
  background: var(--green-2);
  color: #163c34;
}

.chip .count {
  color: var(--muted);
  font-weight: 750;
  margin-left: 4px;
}

.results-panel {
  min-height: 620px;
  padding: 13px;
}

.results-meta {
  min-height: 48px;
  border-bottom: 1px solid var(--line);
  margin: -1px 0 12px;
  padding-bottom: 12px;
}

.results-meta p {
  margin-bottom: 2px;
  color: var(--ink);
  font-weight: 950;
}

.results-meta span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pager span {
  min-width: 36px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 950;
}

.results-list {
  display: grid;
  gap: 9px;
}

.result-card {
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  border-radius: var(--radius);
  background: var(--surface);
  padding: 13px;
}

.result-card:hover,
.result-card[data-active="true"] {
  border-color: var(--line-strong);
  border-left-color: var(--green);
  background: var(--paper-warm);
  box-shadow: 0 10px 24px rgba(47, 111, 97, 0.1);
}

.result-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

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

.result-title {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
}

.problem-id {
  color: var(--brick);
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  white-space: nowrap;
}

.result-title strong {
  overflow-wrap: anywhere;
  font-size: 1.02rem;
  line-height: 1.34;
}

.acceptance-badge {
  flex-shrink: 0;
  min-width: 54px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 7px;
  text-align: center;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}

.acceptance-badge[data-tone="ok"] {
  border-color: #b9d8c7;
  background: #e6f3e9;
  color: #246038;
}

.acceptance-badge[data-tone="warn"] {
  border-color: #ecd28f;
  background: var(--amber-2);
  color: #775515;
}

.acceptance-badge[data-tone="danger"] {
  border-color: #e4b5aa;
  background: var(--brick-2);
  color: #7c2e1e;
}

.snippet {
  margin: 8px 0 0;
  color: #3e4a47;
  font-size: 0.9rem;
  line-height: 1.52;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 4px 7px;
  font-size: 0.74rem;
  font-weight: 900;
}

.metric strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.tag-token {
  min-height: 25px;
  border-color: #cbd8d1;
  background: #edf4ef;
  color: #244b43;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 850;
}

.flag-token {
  border-color: #e7d191;
  background: #fff5d4;
  color: #775515;
}

.detail-panel {
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: 17px;
}

.detail-empty {
  min-height: 360px;
  display: grid;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.detail-empty span {
  color: var(--brick);
  font-size: 0.72rem;
  font-weight: 950;
}

.detail-empty strong {
  max-width: 340px;
  margin: 0 auto;
  color: var(--ink-2);
  line-height: 1.45;
}

.detail-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 13px;
  margin-bottom: 13px;
}

.detail-title-block {
  min-width: 0;
}

.detail-head h2 {
  margin-bottom: 3px;
  font-size: 1.6rem;
  line-height: 1.16;
  overflow-wrap: anywhere;
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.detail-actions a {
  text-decoration: none;
}

.detail-actions a:hover,
.detail-actions button:hover,
.filter-heading button:hover,
.pager button:not(:disabled):hover,
.ledger-head button:hover {
  border-color: var(--green);
  background: var(--green-2);
}

.detail-summary {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 14px;
}

.detail-section {
  margin-top: 18px;
}

.detail-section h3 {
  margin-bottom: 8px;
  color: var(--green);
  font-size: 0.96rem;
  font-weight: 950;
}

.detail-section p {
  color: #2f3b38;
  line-height: 1.66;
  white-space: pre-wrap;
}

pre {
  overflow: auto;
  border: 1px solid #354540;
  border-radius: var(--radius);
  background: var(--code);
  color: #f5f7ec;
  padding: 12px;
  line-height: 1.52;
  font-family: var(--font-mono);
  font-size: 0.86rem;
}

.sample-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sample-cell {
  min-width: 0;
}

.sample-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 950;
  margin-bottom: 6px;
}

.copy-button {
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--blue);
  padding: 0 8px;
  font-size: 0.72rem;
  font-weight: 950;
}

.copy-button:hover {
  border-color: var(--blue);
  background: var(--blue-2);
}

.clipboard-scratch {
  position: fixed;
  inset: auto auto 0 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.similar-list {
  display: grid;
  gap: 7px;
}

.similar-list button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--blue);
  padding: 8px 10px;
  text-align: left;
  font-weight: 900;
}

.similar-list button:hover {
  border-color: var(--blue);
  background: var(--blue-2);
}

.judge-block {
  display: grid;
  gap: 11px;
  margin-top: 15px;
}

.submit-console {
  border: 1px solid #315147;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(217, 157, 34, 0.12), transparent 34%),
    #24312d;
  color: #f4f7eb;
  padding: 14px;
}

.submit-console .eyebrow {
  color: #a8d7c3;
}

.submit-console select {
  min-height: 38px;
  border: 1px solid #4d615b;
  border-radius: 6px;
  background: #f4f7eb;
  color: #17211f;
  padding: 0 10px;
  font-weight: 900;
}

.submit-console textarea {
  width: 100%;
  min-height: 210px;
  resize: vertical;
  margin-top: 12px;
  border: 1px solid #556a63;
  border-radius: 6px;
  background: #16201d;
  color: #f6f4df;
  padding: 12px;
  line-height: 1.5;
  font-family: var(--font-mono);
  font-size: 0.86rem;
}

.console-actions {
  margin-top: 10px;
}

.console-actions button {
  border-color: #dfe6dd;
  background: #f4f7eb;
  color: #17211f;
}

.console-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.submit-status {
  min-width: 0;
  color: #d3ded5;
  font-size: 0.84rem;
  font-weight: 850;
}

.submission-ledger,
.submission-inspector {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f9faf4;
  padding: 12px;
}

.submission-list,
.case-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.submission-row {
  display: grid;
  grid-template-columns: 58px 70px minmax(74px, 1fr) 52px 58px;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 6px 8px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 850;
}

.submission-row:hover {
  border-color: var(--green);
  background: #f1f7f0;
}

.submission-id {
  color: var(--brick);
}

.verdict {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  min-width: 42px;
  min-height: 23px;
  border-radius: 5px;
  background: #dfe5df;
  color: #27312e;
  padding: 2px 6px;
  font-size: 0.72rem;
  font-weight: 950;
}

.verdict-AC {
  background: #cce9d4;
  color: #174b2a;
}

.verdict-WA,
.verdict-RE,
.verdict-CE,
.verdict-TLE,
.verdict-OLE {
  background: #f4d5cf;
  color: #7c2e1e;
}

.verdict-JUDGING,
.verdict-PENDING {
  background: #fff0bf;
  color: #775515;
}

.verdict-IE {
  background: #dbe2ee;
  color: #344e7e;
}

.inspector-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.inspector-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.case-row {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) 58px 64px;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 6px 8px;
  font-size: 0.8rem;
  font-weight: 850;
}

.stderr-block {
  margin-bottom: 0;
  border-color: #7c3a2f;
  background: #211310;
  color: #ffd9cf;
}

.muted {
  color: var(--muted);
  font-weight: 850;
}

.notice {
  border: 1px solid #e6d39f;
  border-radius: var(--radius);
  background: #fff7dc;
  color: #66501c;
  padding: 14px;
  font-weight: 900;
}

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

@media (max-width: 1320px) {
  .workspace {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .detail-panel {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
  }
}

@media (max-width: 920px) {
  .topbar,
  .search-band {
    grid-template-columns: 1fr;
  }

  .topbar-aside {
    justify-items: stretch;
  }

  .stat-strip {
    width: 100%;
  }

  .command-head {
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
  }
}

@media (max-width: 780px) {
  .app-shell {
    padding: 13px;
  }

  h1 {
    font-size: 2.25rem;
  }

  .search-form,
  .sort-row,
  .workspace,
  .sample-grid {
    grid-template-columns: 1fr;
  }

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

  .filter-panel {
    position: static;
    max-height: none;
  }

  .results-meta,
  .detail-head,
  .console-head,
  .console-actions,
  .ledger-head,
  .inspector-head {
    align-items: stretch;
    flex-direction: column;
  }

  .pager {
    width: 100%;
    justify-content: space-between;
  }

  .result-main {
    display: grid;
  }

  .acceptance-badge {
    width: max-content;
  }

  .submission-row {
    grid-template-columns: 56px 64px 1fr;
  }

  .submission-row span:nth-child(4),
  .submission-row span:nth-child(5) {
    grid-column: auto;
  }

  .detail-panel {
    order: -1;
  }
}
