:root {
  --ink: #24221d;
  --muted: #736d61;
  --paper: #ece6d8;
  --paper-light: #f6f1e7;
  --rule: #b8af9c;
  --red: #a33931;
  --dark-red: #76241f;
}

* { box-sizing: border-box; }

html { background: #1f211f; }

body {
  margin: 0;
  color: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(255,255,255,.08), transparent 32rem),
    repeating-linear-gradient(100deg, rgba(255,255,255,.018) 0 1px, transparent 1px 7px),
    #20221f;
}

button, input { font: inherit; }
button { color: inherit; }

main {
  min-height: 100vh;
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  background:
    linear-gradient(rgba(72,57,30,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(72,57,30,.018) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  box-shadow: 0 0 70px rgba(0,0,0,.4);
}

.hero {
  min-height: 390px;
  padding: 62px clamp(24px, 6vw, 96px) 42px;
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: clamp(22px, 4vw, 62px);
  align-items: stretch;
  color: var(--paper-light);
  background:
    linear-gradient(105deg, rgba(15,17,16,.95), rgba(30,34,31,.93)),
    repeating-linear-gradient(0deg, transparent 0 14px, rgba(255,255,255,.05) 14px 15px);
  border-bottom: 7px solid var(--red);
}

.hero-rule { background: var(--red); width: 5px; }
.eyebrow { margin: 0 0 25px; color: #b6b0a4; letter-spacing: .2em; font-size: 12px; font-weight: 800; }
.title-line { display: flex; align-items: center; gap: 34px; }
.title-line h1 { margin: 0; font-family: Georgia, "Noto Serif KR", serif; font-size: clamp(50px, 7vw, 95px); line-height: .92; letter-spacing: -.07em; font-weight: 400; }
.title-line strong { color: #d7cdb9; font-weight: 700; }
.archive-stamp { width: 76px; height: 76px; border: 3px double #c2574d; color: #c2574d; border-radius: 4px; display: grid; place-content: center; text-align: center; font-weight: 900; line-height: 1.05; transform: rotate(-8deg); }
.hero-note { margin: 26px 0 0; color: #aaa69c; font-size: 14px; }
.class-meta { align-self: end; display: grid; min-width: 250px; border-top: 1px solid #5d625d; }
.class-meta span { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 11px 0; border-bottom: 1px solid #5d625d; color: #c8c3b9; font-size: 13px; }
.class-meta b { color: #867e70; font-weight: 700; }

.toolbar {
  padding: 30px clamp(20px, 5vw, 72px);
  display: flex;
  align-items: end;
  gap: 24px;
  border-bottom: 1px solid var(--rule);
  background: rgba(246,241,231,.72);
}

.search-box { display: grid; gap: 6px; flex: 1; max-width: 420px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.search-box input { width: 100%; border: 0; border-bottom: 2px solid #625e55; background: transparent; padding: 10px 2px; outline: none; color: var(--ink); font-size: 15px; }
.search-box input:focus { border-color: var(--red); }
.filters { display: flex; gap: 4px; }
.filters button { border: 1px solid var(--rule); background: transparent; padding: 9px 18px; cursor: pointer; font-size: 13px; }
.filters button:hover, .filters button.active { color: var(--paper-light); border-color: var(--ink); background: var(--ink); }
.result-count { margin: 0 0 8px auto; color: var(--muted); font-family: Georgia, serif; }
.result-count b { color: var(--red); font-size: 23px; }

.roster {
  padding: 42px clamp(20px, 5vw, 72px) 76px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px;
}

.student-card {
  position: relative;
  min-width: 0;
  padding: 0;
  text-align: left;
  border: 1px solid #a9a08e;
  background: var(--paper-light);
  cursor: pointer;
  box-shadow: 3px 4px 0 rgba(70,62,47,.11);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  overflow: hidden;
}
.student-card:hover, .student-card:focus-visible { transform: translateY(-5px); border-color: var(--red); box-shadow: 6px 9px 0 rgba(70,62,47,.15); outline: none; }
.student-card.player-card { border-color: #6f2924; }
.card-topline { height: 36px; display: flex; justify-content: space-between; align-items: center; padding: 0 12px; background: #292b28; color: #d8d0c1; font-size: 10px; letter-spacing: .14em; }
.card-topline b { color: #fff; font-size: 18px; font-family: Georgia, serif; }

.portrait { aspect-ratio: 4 / 5; background: #d7d0c2; overflow: hidden; border-bottom: 1px solid var(--rule); }
.portrait img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: top center; filter: saturate(.82) contrast(1.03); }
.portrait-placeholder { width: 100%; height: 100%; position: relative; display: grid; place-content: center; gap: 7px; text-align: center; color: #817a6d; background: repeating-linear-gradient(135deg, rgba(53,50,43,.035) 0 7px, transparent 7px 14px); }
.placeholder-no { position: absolute; top: 9px; left: 12px; font-family: Georgia, serif; font-size: 13px; opacity: .6; }
.placeholder-icon { font-size: 35px; font-weight: 200; line-height: 1; }
.placeholder-copy { font: 700 9px/1 sans-serif; letter-spacing: .18em; }

.card-copy { min-height: 118px; padding: 16px 14px 20px; }
.roman { display: block; color: var(--red); font-size: 8px; font-weight: 900; letter-spacing: .12em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-copy h2 { margin: 6px 0 7px; font-size: 18px; letter-spacing: -.04em; }
.card-copy p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.attendance { position: absolute; right: 9px; bottom: 10px; padding: 3px 5px; border: 1px solid rgba(163,57,49,.55); color: rgba(163,57,49,.7); font-size: 10px; font-weight: 900; transform: rotate(-7deg); }

.empty-state { padding: 90px 20px; text-align: center; color: var(--muted); }
footer { padding: 22px clamp(20px, 5vw, 72px); display: flex; justify-content: space-between; gap: 20px; color: #aaa69d; background: #292b28; font-size: 11px; letter-spacing: .08em; }
footer p { margin: 0; }
footer code { color: #d1c6b3; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; padding: 24px; display: grid; place-items: center; background: rgba(9,10,9,.78); backdrop-filter: blur(7px); }
.student-modal { position: relative; width: min(850px, 100%); max-height: calc(100vh - 48px); overflow: auto; display: grid; grid-template-columns: minmax(270px, 40%) 1fr; background: var(--paper-light); box-shadow: 0 30px 100px rgba(0,0,0,.5); border-top: 7px solid var(--red); }
.modal-close { position: absolute; z-index: 2; top: 10px; right: 13px; width: 35px; height: 35px; border: 0; border-radius: 50%; background: #252724; color: white; font-size: 25px; cursor: pointer; }
.modal-photo { min-height: 520px; padding: 28px; display: flex; background: #292b28; }
.portrait-large { width: 100%; margin: auto; box-shadow: 0 0 0 7px #ece6d8, 0 0 0 8px #777064; }
.modal-content { padding: 55px clamp(28px, 5vw, 58px) 42px; }
.modal-kicker { margin: 0 0 14px; color: var(--red); font-size: 10px; font-weight: 900; letter-spacing: .16em; }
.modal-content h2 { margin: 0; font-family: Georgia, "Noto Serif KR", serif; font-size: clamp(38px, 5vw, 58px); letter-spacing: -.07em; }
.modal-roman { margin: 6px 0 34px; color: var(--muted); font-size: 11px; letter-spacing: .16em; }
.modal-content dl { margin: 0; border-top: 1px solid var(--rule); }
.modal-content dl div { display: grid; grid-template-columns: 90px 1fr; gap: 15px; padding: 15px 0; border-bottom: 1px solid var(--rule); }
.modal-content dt { color: var(--muted); font-size: 11px; font-weight: 800; }
.modal-content dd { margin: 0; font-size: 14px; line-height: 1.5; }
.secret-strip { margin-top: 30px; padding: 11px; color: #eee6d7; text-align: center; background: repeating-linear-gradient(135deg, #7c2924 0 8px, #8d3029 8px 16px); font-size: 11px; font-weight: 900; letter-spacing: .16em; }

@media (max-width: 1180px) { .roster { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 800px) {
  main { width: 100%; }
  .hero { min-height: auto; grid-template-columns: 6px 1fr; padding: 42px 24px 32px; }
  .class-meta { grid-column: 2; width: 100%; margin-top: 10px; }
  .toolbar { align-items: stretch; flex-wrap: wrap; gap: 15px; }
  .search-box { max-width: none; flex-basis: 100%; }
  .result-count { margin-left: auto; }
  .roster { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .card-copy { min-height: 108px; padding: 13px 10px 18px; }
  .card-copy h2 { font-size: 15px; }
  .student-modal { grid-template-columns: 1fr; }
  .modal-photo { min-height: 0; padding: 28px 28px 12px; }
  .portrait-large { max-width: 260px; }
  footer { flex-direction: column; }
}

@media (max-width: 520px) {
  .title-line h1 { font-size: 48px; }
  .archive-stamp { display: none; }
  .filters button { padding: 8px 13px; }
  .roster { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-inline: 12px; }
  .hero-note { line-height: 1.6; }
  .modal-backdrop { padding: 10px; }
  .student-modal { max-height: calc(100vh - 20px); }
  .modal-content { padding: 35px 24px; }
}

@media (prefers-reduced-motion: reduce) { .student-card { transition: none; } }

[hidden] { display: none !important; }
.student-card { appearance: none; font-family: inherit; }
.modal-backdrop { animation: fadeIn .18s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
