:root {
  --bg: #070b14;
  --panel: #0f1626;
  --panel-2: #151e33;
  --line: #24304a;
  --text: #e6ebf5;
  --muted: #8a96ad;
  --gold: #c8a24a;
  --gold-2: #f0d58a;
  --accent: #3aa0ff;
  --danger: #e2575c;
  --footer-h: 34px;
  --f-title: "Cinzel", serif;
  --f-ui: "Rajdhani", "Noto Sans KR", sans-serif;
  --f-body: "Noto Sans KR", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }   /* iPad 사파리 글자 자동 확대 끔 (카드 · 표가 넘치던 문제) */
/* 한글은 낱말 단위로 줄바꿈 (플레이오 / 프 처럼 낱말 중간에서 끊기지 않게). 띄어쓰기 없는 긴 영문 · 숫자는 넘치지 않게 끊는다 */
body { word-break: keep-all; overflow-wrap: break-word; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 14px;
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- 공통 화면 ---------- */
.screen {
  position: fixed;
  inset: 0 0 var(--footer-h) 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity .7s ease, visibility 0s linear .7s;
  overflow: hidden;
}
.screen.active {
  opacity: 1;
  visibility: visible;
  transition: opacity .7s ease, visibility 0s;
}

.legal {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--footer-h);
  display: flex; align-items: center; justify-content: center;
  padding: 0 16px;
  font-size: 11px;
  color: var(--muted);
  background: #04070d;
  border-top: 1px solid #141b2b;
  text-align: center;
  z-index: 100;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.panel-title {
  margin: 0 0 12px;
  font-family: var(--f-ui);
  font-size: 13px;
  letter-spacing: .14em;
  color: var(--gold);
  text-transform: uppercase;
}

.btn-primary, .btn-ghost {
  border-radius: 6px;
  padding: 10px 18px;
  font-weight: 700;
  transition: background .2s, border-color .2s, opacity .2s;
}
.btn-primary {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #1a1407;
  border: 0;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; filter: none; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--gold); }

.screen-head {
  display: flex; align-items: center; gap: 20px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 20, .9);
}
.step-dots { display: flex; gap: 8px; font-family: var(--f-ui); font-weight: 600; }
.step-dots span {
  padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
}
.step-dots span.on { border-color: var(--gold); color: var(--gold-2); }
.step-dots span.done { color: var(--text); }

/* ---------- 인트로 ---------- */
#screen-intro {
  display: flex; align-items: center; justify-content: center;
  background: #000;
  cursor: pointer;
  padding: 16px;
}
.intro-box { max-width: 680px; }
.intro-badge {
  display: inline-block;
  font-family: var(--f-ui); font-weight: 700; letter-spacing: .3em;
  font-size: 12px; color: var(--gold);
  border: 1px solid var(--gold); padding: 3px 10px; border-radius: 3px;
}
.intro-head { font-size: 26px; margin: 14px 0 20px; }
.intro-lines { list-style: none; padding: 0; margin: 0 0 22px; }
.intro-lines li {
  position: relative;
  padding: 0 0 14px 18px;
  line-height: 1.7;
  color: #c9d1e0;
}
.intro-lines li::before {
  content: ""; position: absolute; left: 0; top: .7em;
  width: 6px; height: 6px; background: var(--gold); transform: rotate(45deg);
}
.intro-lines b { color: #fff; }
.intro-en { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 0 0 28px; }
.intro-prompt {
  font-family: var(--f-ui); letter-spacing: .1em; color: var(--muted); font-size: 13px;
  animation: blink 1.6s ease-in-out infinite;
}
/* 순차 등장 */
.intro-box > *, .intro-lines li { opacity: 0; transform: translateY(8px); }
#screen-intro.play .intro-box > *, #screen-intro.play .intro-lines li {
  animation: rise .8s ease forwards;
}
#screen-intro.play .intro-badge { animation-delay: .2s; }
#screen-intro.play .intro-head { animation-delay: .5s; }
#screen-intro.play .intro-lines { animation-delay: .7s; }
#screen-intro.play .intro-lines li:nth-child(1) { animation-delay: 1.0s; }
#screen-intro.play .intro-lines li:nth-child(2) { animation-delay: 1.8s; }
#screen-intro.play .intro-lines li:nth-child(3) { animation-delay: 2.6s; }
#screen-intro.play .intro-lines li:nth-child(4) { animation-delay: 3.4s; }
#screen-intro.play .intro-en { animation-delay: 4.2s; }
#screen-intro.play .intro-prompt { animation: rise .8s ease 5s forwards, blink 1.6s ease-in-out 5.8s infinite; }

@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- 메인 타이틀 ---------- */
#screen-title { background: #000; }
.title-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 62% 42%, #1b2a4d 0%, #0b1224 45%, #04060c 80%);
}
.rays {
  position: absolute; left: 62%; top: 42%;
  width: 1600px; height: 1600px; margin: -800px 0 0 -800px;
  background: repeating-conic-gradient(from 0deg, rgba(240, 213, 138, .06) 0deg 6deg, transparent 6deg 18deg);
  mask-image: radial-gradient(circle, #000 0%, transparent 55%);
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 55%);
  animation: spin 90s linear infinite;
}
.vignette { position: absolute; inset: 0; box-shadow: inset 0 0 220px 60px #000; }
@keyframes spin { to { transform: rotate(360deg); } }

.title-layout {
  position: absolute; inset: 0 0 150px 0;
  display: grid; grid-template-columns: minmax(320px, 440px) 1fr;
  align-items: center;
  padding: 0 6vw;
}
.logo-main {
  font-family: var(--f-title); font-weight: 800;
  font-size: clamp(54px, 7vw, 92px); line-height: 1;
  letter-spacing: .04em;
  background: linear-gradient(180deg, #fff 0%, #d9dee8 45%, #8f98a8 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.logo-main span {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  -webkit-background-clip: text; background-clip: text;
}
.logo-sub {
  margin-top: 8px;
  font-family: var(--f-ui); font-weight: 600; font-size: 16px;
  letter-spacing: .28em; text-transform: uppercase; color: var(--gold);
}
.main-menu { display: flex; flex-direction: column; gap: 6px; margin-top: 44px; }
.main-menu button {
  display: flex; flex-direction: column; align-items: flex-start;
  text-align: left;
  background: linear-gradient(90deg, rgba(255, 255, 255, .04), transparent);
  border: 0; border-left: 3px solid transparent;
  padding: 12px 18px;
  transition: border-color .2s, background .2s, padding .2s;
}
.main-menu button b { font-size: 20px; font-weight: 700; }
.main-menu button span { font-size: 12px; color: var(--muted); margin-top: 2px; }
.main-menu button:hover, .main-menu button:focus-visible {
  outline: none;
  border-left-color: var(--gold);
  background: linear-gradient(90deg, rgba(200, 162, 74, .18), transparent);
  padding-left: 24px;
}
.version { margin-top: 28px; font-size: 11px; color: #56617a; font-family: var(--f-ui); letter-spacing: .08em; }

.title-center { display: flex; justify-content: center; }
.trophy-wrap { position: relative; width: min(34vw, 46vh, 380px); }
.trophy { width: 100%; display: block; animation: float 6s ease-in-out infinite; filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .6)); }
#trophy-3d { display: none; width: 100%; aspect-ratio: 300 / 420; animation: float 6s ease-in-out infinite; }
.three-ready #trophy-3d { display: block; }
.three-ready .trophy { display: none; }
.trophy-shadow {
  width: 60%; height: 18px; margin: -6px auto 0;
  background: radial-gradient(ellipse, rgba(0, 0, 0, .7), transparent 70%);
  animation: shadow 6s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes shadow { 0%, 100% { transform: scaleX(1); opacity: 1; } 50% { transform: scaleX(.88); opacity: .7; } }

.winners-strip {
  position: absolute; left: 0; right: 0; bottom: 0; height: 150px;
  border-top: 1px solid rgba(200, 162, 74, .25);
  background: linear-gradient(180deg, rgba(4, 6, 12, .3), rgba(4, 6, 12, .95));
}
.winners-label {
  position: absolute; top: 10px; left: 6vw;
  font-family: var(--f-ui); font-size: 11px; letter-spacing: .3em; color: var(--gold);
}
.winners-viewport {
  position: absolute; inset: 32px 0 14px 0; overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.winners-track { display: flex; gap: 14px; width: max-content; height: 100%; animation: marquee 60s linear infinite; }
.winners-viewport:hover .winners-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
.win-card {
  position: relative;
  width: 210px; height: 100%;
  border-radius: 8px; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .08);
  background:
    linear-gradient(135deg, var(--c, #334) 0%, rgba(10, 14, 24, .95) 70%);
  padding: 12px 14px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.win-card::after { /* 사진 대신 들어가는 패턴 영역 */
  content: ""; position: absolute; right: -20px; top: -20px; width: 110px; height: 110px;
  border-radius: 50%; border: 14px solid rgba(255, 255, 255, .06);
}
.win-year { font-family: var(--f-title); font-size: 26px; font-weight: 800; color: var(--gold-2); line-height: 1; }
.win-team { font-weight: 700; font-size: 15px; }
.win-meta { font-size: 11px; color: #b7c0d2; font-family: var(--f-ui); letter-spacing: .06em; }

/* 타이틀 등장 연출 */
#screen-title .title-bg, #screen-title .logo-block, #screen-title .main-menu button,
#screen-title .version, #screen-title .trophy-wrap, #screen-title .winners-strip { opacity: 0; }
#screen-title.play .title-bg { animation: fade 2.4s ease forwards; }
#screen-title.play .trophy-wrap { animation: trophyIn 2.2s ease .6s forwards; }
#screen-title.play .logo-block { animation: rise 1.2s ease 1.6s forwards; }
#screen-title.play .main-menu button { animation: rise .6s ease forwards; }
#screen-title.play .main-menu button:nth-child(1) { animation-delay: 2.3s; }
#screen-title.play .main-menu button:nth-child(2) { animation-delay: 2.42s; }
#screen-title.play .main-menu button:nth-child(3) { animation-delay: 2.54s; }
#screen-title.play .main-menu button:nth-child(4) { animation-delay: 2.66s; }
#screen-title.play .version { animation: fade 1s ease 2.9s forwards; }
#screen-title.play .winners-strip { animation: fade 1.4s ease 2.6s forwards; }
/* 두 번째 진입부터는 등장 연출 없이 바로 표시 (반복 애니메이션은 건드리지 않는다) */
#screen-title.instant .title-bg, #screen-title.instant .logo-block, #screen-title.instant .main-menu button,
#screen-title.instant .version, #screen-title.instant .trophy-wrap, #screen-title.instant .winners-strip {
  animation: none; opacity: 1;
}
@keyframes fade { to { opacity: 1; } }
@keyframes trophyIn { from { opacity: 0; transform: translateY(30px) scale(.94); filter: brightness(.3); } to { opacity: 1; transform: none; filter: none; } }

/* ---------- 모달 ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, .65);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fade .2s ease forwards; opacity: 0;
}
.modal {
  width: min(520px, 100%);
  max-height: calc(100vh - 80px); overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 17px; }
.modal-body { padding: 18px 20px; color: #c9d1e0; line-height: 1.6; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid #1b2438; }
.set-row:last-child { border-bottom: 0; }
.set-row small { display: block; color: var(--muted); font-size: 12px; }
.set-row select, .set-row input[type=range] { min-width: 140px; }
.save-slot { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; margin-bottom: 8px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); }

input, select {
  background: #0a101d; border: 1px solid var(--line); border-radius: 6px; padding: 9px 11px;
}
input:focus, select:focus { outline: none; border-color: var(--gold); }

/* ---------- 감독 프로필 ---------- */
#screen-profile, #screen-team, #screen-game {
  background: radial-gradient(ellipse at 20% 0%, #121c33, var(--bg) 60%);
  display: flex; flex-direction: column;
}
.profile-layout {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 340px 1fr; gap: 20px;
  padding: 20px 24px;
  max-width: 1200px; width: 100%; margin: 0 auto;
}
.avatar-panel { display: flex; flex-direction: column; align-items: center; padding: 22px; gap: 16px; }
.avatar-stage {
  width: 100%; aspect-ratio: 200 / 220;
  border-radius: 10px; overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #2a3a60, #0d1424 75%);
  border: 1px solid var(--line);
}
.avatar-stage svg { width: 100%; height: 100%; display: block; }
.avatar-namecard { text-align: center; }
.nc-name { font-size: 20px; font-weight: 700; }
.nc-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }

.profile-form { padding: 22px 24px; overflow: auto; display: flex; flex-direction: column; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 24px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; color: var(--muted); }
.field em { color: var(--gold); font-style: normal; }

.avatar-options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.opt-group > .opt-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.opt-row { display: flex; flex-wrap: wrap; gap: 6px; }
.opt-btn {
  padding: 6px 11px; border-radius: 5px; font-size: 13px;
  background: #0a101d; border: 1px solid var(--line);
}
.opt-btn.on { border-color: var(--gold); color: var(--gold-2); background: rgba(200, 162, 74, .1); }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #0a101d; outline: 1px solid var(--line); padding: 0; }
.swatch.on { outline: 2px solid var(--gold); }

.form-foot { margin-top: auto; padding-top: 22px; display: flex; justify-content: flex-end; align-items: center; gap: 14px; }
.hint { color: var(--danger); font-size: 13px; }

/* ---------- 리그 / 팀 선택 ---------- */
.mgr-chip { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.mgr-chip .mini-av { width: 38px; height: 38px; border-radius: 50%; overflow: hidden; background: #1c2843; border: 1px solid var(--line); }
.mgr-chip .mini-av svg { width: 100%; height: 100%; display: block; }
.mgr-chip b { display: block; font-size: 14px; }
.mgr-chip small { color: var(--muted); font-size: 12px; }

.league-tabs { display: flex; gap: 4px; padding: 16px 24px 0; }
.league-tab {
  min-width: 120px; padding: 12px 18px;
  background: transparent; border: 1px solid var(--line); border-bottom: 0;
  border-radius: 8px 8px 0 0;
  font-family: var(--f-ui); font-weight: 700; font-size: 20px; letter-spacing: .08em;
  color: var(--muted); text-align: left;
}
.league-tab small { display: block; font-family: var(--f-body); font-size: 11px; letter-spacing: 0; font-weight: 400; }
.league-tab.on { background: var(--panel); color: var(--gold-2); border-color: var(--gold); }

.league-info {
  margin: 0 24px; padding: 12px 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 0 8px 8px 8px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px;
  font-size: 13px;
}
.league-info .li-k { color: var(--muted); margin-right: 6px; }
.league-info .mock-tag { margin-left: auto; font-size: 11px; color: #e0a24a; border: 1px solid #6b4d1e; border-radius: 4px; padding: 2px 8px; }

.team-layout {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 1fr 420px; gap: 16px;
  padding: 16px 24px 20px;
}
.team-list {
  overflow: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px;
  align-content: start; padding-right: 4px;
}
.team-card {
  position: relative; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 14px 12px 18px;
  transition: border-color .15s, transform .15s;
}
.team-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; border-radius: 8px 0 0 8px; background: var(--c); }
.team-card:hover { border-color: #3a4a6c; transform: translateY(-1px); }
.team-card.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.tc-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tc-mono {
  width: 40px; height: 40px; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-ui); font-weight: 700; font-size: 13px;
  background: color-mix(in srgb, var(--c) 30%, #0a101d); border: 1px solid color-mix(in srgb, var(--c) 60%, transparent);
}
.tc-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.tc-city { font-size: 12px; color: var(--muted); }
.tc-stats { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 12px; align-items: center; }
.tc-stats .k { color: var(--muted); }
.stars { color: var(--gold); letter-spacing: 1px; }
.stars i { color: #39445c; font-style: normal; }
.bar { height: 6px; border-radius: 3px; background: #1c2438; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, #2f7fd0, var(--accent)); }

.team-detail { overflow: auto; display: flex; flex-direction: column; }
.tc-logo { width: 40px; height: 40px; object-fit: contain; flex: none; }
.td-photo { aspect-ratio: 16 / 7; overflow: hidden; background: #0a101d; flex: none; }
.td-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.td-logo { float: right; width: 52px; height: 52px; object-fit: contain; }
.staff { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 13px; }
.pl-cell { display: flex; align-items: center; gap: 9px; }
.pl-cell small { color: var(--muted); }
.pl-real { display: block; font-size: 11px; }
.pl-ph { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; object-position: top; background: #1c2843; flex: none; }
.pl-ph-empty { display: flex; align-items: center; justify-content: center; font-family: var(--f-ui); font-weight: 700; color: var(--muted); }
.win-logo { position: absolute; right: 10px; top: 10px; width: 64px; height: 64px; object-fit: contain; opacity: .9; }
.td-empty { margin: auto; color: var(--muted); text-align: center; padding: 30px; }
.td-head { padding: 18px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, color-mix(in srgb, var(--c) 25%, transparent), transparent); }
.td-name { font-size: 22px; font-weight: 700; }
.td-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.td-sec { padding: 14px 20px; border-bottom: 1px solid #1b2438; }
.td-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.td-stat { background: var(--panel-2); border-radius: 6px; padding: 10px 12px; }
.td-stat .k { font-size: 11px; color: var(--muted); }
.td-stat .v { font-family: var(--f-ui); font-weight: 700; font-size: 20px; margin-top: 2px; }
.td-goal { font-weight: 700; color: var(--gold-2); }
.roster { width: 100%; border-collapse: collapse; font-size: 13px; }
.roster th { white-space: nowrap; text-align: left; font-weight: 500; color: var(--muted); font-size: 11px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.roster td { padding: 7px 6px; border-bottom: 1px solid #172036; }
.roster tr.sub td { color: var(--muted); }
.roster .pos { font-family: var(--f-ui); font-weight: 700; color: var(--gold); width: 42px; }
.roster .ovr { font-family: var(--f-ui); font-weight: 700; text-align: right; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.td-foot { margin-top: auto; padding: 16px 20px; display: flex; justify-content: flex-end; }


/* ---------- 반응형 ---------- */
@media (max-width: 900px) {
  body { overflow: auto; }
  .title-layout { grid-template-columns: 1fr; padding: 24px 16px; align-content: center; }
  .title-center { display: none; }
  .profile-layout, .team-layout { grid-template-columns: 1fr; overflow: auto; padding: 16px; }
  .avatar-options, .form-grid { grid-template-columns: 1fr; }
  .league-tabs { padding: 12px 16px 0; overflow-x: auto; }
  .league-tab { min-width: 90px; font-size: 16px; }
  .league-info { margin: 0 16px; }
  .screen-head { padding: 12px 16px; flex-wrap: wrap; }
  .legal { font-size: 9px; }
}

/* 역대 우승팀 단체사진 카드 */
.winners-strip.has-photos { height: 196px; }
.win-card.photo { width: 300px; padding: 10px 12px; justify-content: flex-end; }
.win-card.photo::after { display: none; }
.win-card .win-photo {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%;
  transition: transform .6s ease;
}
.win-card.photo::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(4, 6, 12, 0) 35%, rgba(4, 6, 12, .92) 100%),
              linear-gradient(90deg, color-mix(in srgb, var(--c, #334) 35%, transparent), transparent 60%);
}
.win-card.photo > *:not(.win-photo) { position: relative; z-index: 2; }
.win-card.photo .win-logo { position: absolute; right: 8px; top: 8px; width: 40px; height: 40px; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .8)); }
.win-card.photo .win-year { font-size: 24px; text-shadow: 0 2px 6px rgba(0, 0, 0, .8); }
.win-card.photo .win-team { text-shadow: 0 1px 4px rgba(0, 0, 0, .9); }
.win-card.photo .win-head { display: flex; align-items: baseline; gap: 10px; }
.winners-viewport:hover .win-card.photo:hover .win-photo { transform: scale(1.06); }
@media (max-width: 767px) {
  .winners-strip.has-photos { height: 150px; }
  .win-card.photo { width: 210px; }
}

/* 트로피 뒤 우승 세레머니 사진 (천천히 교차 전환 + 줌) */
.ceremony {
  position: absolute; inset: 0; overflow: hidden;
  mask-image: linear-gradient(90deg, transparent 18%, rgba(0, 0, 0, .55) 42%, #000 62%);
  -webkit-mask-image: linear-gradient(90deg, transparent 18%, rgba(0, 0, 0, .55) 42%, #000 62%);
}
.cer-slide {
  position: absolute; inset: 0; opacity: 0;
  background-size: cover; background-position: center 30%;
  transform: scale(1.04);
  transition: opacity 2.2s ease;
  filter: saturate(.85) brightness(.55);
}
.cer-slide.on { opacity: 1; animation: kenburns 9s ease-out forwards; }
@keyframes kenburns { from { transform: scale(1.04); } to { transform: scale(1.14) translateX(-1.5%); } }
.ceremony::after { /* 트로피 쪽 빛 + 아래쪽 어둡게 */
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 62% 42%, rgba(11, 18, 36, .15) 0%, rgba(4, 6, 12, .55) 70%),
    linear-gradient(180deg, rgba(4, 6, 12, .4) 0%, transparent 30%, rgba(4, 6, 12, .85) 100%);
}
.ceremony-cap {
  position: absolute; right: 4vw; bottom: 214px; z-index: 2;
  font-family: var(--f-ui); font-size: 12px; letter-spacing: .25em; color: rgba(240, 213, 138, .75);
  text-align: right; transition: opacity .8s ease; pointer-events: none;
}
.ceremony-cap b { display: block; font-family: var(--f-title); font-size: 22px; letter-spacing: .06em; color: rgba(255, 255, 255, .85); }
.ceremony-cap.hide { opacity: 0; }
@media (max-width: 767px) {
  .ceremony { mask-image: none; -webkit-mask-image: none; }
  .cer-slide { filter: saturate(.8) brightness(.32); }
  .ceremony-cap { display: none; }
}
@media (prefers-reduced-motion: reduce) { .cer-slide.on { animation: none; } }

/* 토스트 알림 */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--footer-h) + 70px); transform: translate(-50%, 12px); opacity: 0;
  background: var(--panel-2); border: 1px solid var(--gold); color: var(--gold-2); padding: 9px 18px; border-radius: 8px;
  font-size: 13px; z-index: 200; transition: opacity .25s, transform .25s; pointer-events: none;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 감독 생성 (섹션형) ---------- */
.pf-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.pf-tabs button { background: none; border: 0; padding: 10px 14px; color: var(--muted); font-weight: 700; font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
.pf-tabs button.on { color: var(--gold-2); border-bottom-color: var(--gold); }
.pf-sec { display: none; flex-direction: column; gap: 16px; }
.pf-sec.on { display: flex; }
.pf-sec .form-grid { margin-bottom: 0; }
.field > span small { color: #5f6b84; margin-left: 4px; }
.field input, .field select { background: #0a101d; border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; font-size: 14px; }
.field input:focus, .field select:focus { outline: none; border-color: var(--gold); }
.bg-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.bg-card { text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 8px; background: #0a101d; border: 1px solid var(--line); }
.bg-card b { font-size: 14px; }
.bg-card span { font-size: 12px; color: #b3bccd; line-height: 1.45; }
.bg-card small { font-size: 11px; color: var(--gold); margin-top: 2px; }
.bg-card.on { border-color: var(--gold); background: rgba(200, 162, 74, .1); }
.style-grid { display: grid; gap: 16px; }
.pf-pool { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.pf-pool b { font-family: var(--f-ui); font-size: 22px; color: var(--gold-2); }
.pf-pool small { font-size: 11px; color: #5f6b84; }
.pf-pool button { margin-left: auto; padding: 5px 12px; font-size: 12px; }
.attr-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; }
.attr-row { display: grid; grid-template-columns: minmax(0, 1fr) 28px 34px 28px; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid #172036; }
.attr-row b { display: block; font-size: 13px; }
.attr-row small { font-size: 11px; color: #5f6b84; }
.attr-btn { width: 28px; height: 28px; border-radius: 6px; background: #0a101d; border: 1px solid var(--line); font-size: 16px; line-height: 1; }
.attr-btn:disabled { opacity: .3; cursor: default; }
.attr-row .attr-v { text-align: center; font-size: 16px; }
.pf-summary { width: 100%; display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.pfs-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.pfs-row span { color: var(--muted); width: 64px; flex: none; }
.pfs-row b { font-weight: 500; }
.pfs-row .stars { margin-left: auto; }
.nc-meta .flag { vertical-align: -2px; }
#pf-prev { margin-left: auto; }
@media (max-width: 900px) {
  .attr-edit { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .profile-layout { display: flex; flex-direction: column; gap: 12px; }
  .avatar-panel { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 14px; gap: 12px; }
  .avatar-stage { width: 96px; flex: none; }
  .avatar-namecard { text-align: left; flex: 1; min-width: 0; }
  .profile-form { overflow: visible; padding: 16px; }
  .form-foot { flex-wrap: wrap; }
}

/* ── 휴대폰: 넓은 표는 카드 안에서 옆으로 넘긴다 (화면 전체가 밀리지 않게) ── */
@media (max-width: 767px) {
  .card:has(> .rs-table), .card:has(> table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cr-grid > *, .cr-page > * { min-width: 0; }
}
/* 아이폰은 16px보다 작은 입력칸을 누르면 화면을 확대한다: 휴대폰에서는 입력칸 글자를 16px로 */
@media (max-width: 767px) {
  input, select, textarea { font-size: 16px !important; }
}

/* ── 모든 기기: 감독 만들기 · 팀 선택은 칸이 화면 높이에 맞춰 줄고 그 안에서 스크롤. '다음' · '시작' 버튼은 늘 아래에 붙어 보인다 ──
   (낮은 가로 화면 — 갤럭시탭 가로 · 노트북 — 에서 칸이 내용만큼 늘어나 버튼이 화면 밖으로 잘리던 문제) */
.profile-layout, .team-layout { grid-template-rows: minmax(0, 1fr); }
.profile-form, .avatar-panel, .team-list, .team-detail { min-height: 0; }
.avatar-panel { overflow: auto; }
.form-foot { position: sticky; bottom: -22px; margin-bottom: -22px; padding-bottom: 14px; background: linear-gradient(to top, var(--panel) 75%, transparent); z-index: 2; }
.td-foot { position: sticky; bottom: 0; background: linear-gradient(to top, var(--panel) 75%, transparent); z-index: 2; }
/* 아주 낮은 화면: 머리말 · 여백을 줄인다 */
@media (max-height: 620px) {
  .screen-head { padding-top: 8px; padding-bottom: 8px; }
  .profile-layout { padding-top: 10px; padding-bottom: 10px; gap: 12px; }
  .avatar-panel { padding: 12px; gap: 10px; }
  .profile-form { padding-top: 14px; }
  .team-layout { padding-top: 10px; padding-bottom: 10px; }
}

/* ── 처음 화면: 메뉴가 아래 역대 우승팀 띠에 가리지 않게 (띠 높이만큼 비우고, 낮은 화면에서는 띠를 줄이거나 숨긴다) ── */
#screen-title:has(.winners-strip.has-photos) .title-layout { bottom: 196px; }
@media (max-height: 820px) {
  .winners-strip, .winners-strip.has-photos { height: 124px; }
  .win-card.photo { width: 220px; }
  #screen-title .title-layout, #screen-title:has(.winners-strip.has-photos) .title-layout { bottom: 124px; }
  .logo-main { font-size: clamp(44px, 6vw, 72px); }
  .main-menu { margin-top: 20px; }
}
@media (max-height: 640px) {
  #screen-title .winners-strip { display: none; }
  #screen-title .title-layout, #screen-title:has(.winners-strip.has-photos) .title-layout { bottom: 0; }
  .main-menu { margin-top: 12px; gap: 4px; }
}

/* ── 당겨서 새로고침 막기: 칸 맨 위에서 아래로 쓸어도 페이지가 새로고침되지 않게 (안드로이드 크롬 · 삼성 인터넷 · iPad 사파리 16+) ── */
html, body { overscroll-behavior: none; }
.game-body, .lv-wrap, .lv-comm, .team-list, .team-detail, .profile-form, .avatar-panel, .dr-grid, .mu-tracks, .modal, .pp, .ng, #modal-root * { overscroll-behavior: contain; }

/* 업데이트 노트 */
.modal.upd-modal { width: min(720px, 100%); }
.upd-cur { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 6px; }
.upd-wrap { display: grid; gap: 18px; }
.upd header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 8px; }
.upd header b { font-family: var(--f-ui); color: var(--gold-2); font-size: 16px; }
.upd header span { font-size: 12px; color: var(--muted); }
.upd header h3 { width: 100%; margin: 2px 0 0; font-size: 16px; color: var(--text); }
.upd-intro { margin: 0 0 6px; color: #c9d1e0; font-size: 13px; }
.upd h4 { margin: 12px 0 4px; font-size: 14px; color: var(--text); }
.upd ul { margin: 0; padding-left: 18px; }
.upd li { font-size: 13px; line-height: 1.6; color: #b7c0d3; margin: 2px 0; }
.upd li b { color: var(--text); }
.upd.old { opacity: .7; }
.upd-bug { font-style: normal; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px; background: rgba(226, 87, 92, .18); color: #ff8a8e; margin-right: 2px; }
.upd-new { font-style: normal; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--gold); color: #1a1205; vertical-align: middle; }
#screen-title .version { cursor: pointer; }
#screen-title .version:hover { color: var(--gold-2); }

/* 단축키 */
.hk-toggle { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; font-size: 13px; }
.hk-toggle small { color: var(--muted); }
.hk-h { margin: 12px 0 4px; font-size: 13px; color: var(--gold-2); }
.hk-t { width: 100%; font-size: 13px; border-collapse: collapse; }
.hk-t td { padding: 3px 4px; border-bottom: 1px solid #1b2438; }
.hk-t td:first-child { width: 42%; }
kbd { font-family: var(--f-ui); font-size: 12px; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: #121a2e; color: var(--text); }
.hk-q { width: 100%; margin-bottom: 8px; }
.hk-res { display: grid; gap: 3px; max-height: 50vh; overflow-y: auto; }
.hk-row { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 6px; background: transparent; border: 1px solid transparent; color: var(--text); text-align: left; cursor: pointer; font-size: 13px; }
.hk-row:hover, .hk-row:first-child { border-color: var(--line); background: #141d33; }
.hk-row small { margin-left: auto; color: var(--muted); }

.md-due { display: block; margin: 0 0 6px; font-size: 12px; color: var(--gold-2); }

.mt-mv { margin-left: 4px; font-size: 10px; } .mt-mv.up { color: #3fbf7f; } .mt-mv.dn { color: #e2575c; }

.cs-users { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-2, #9aa6bd); }
.cs-users span { cursor: pointer; white-space: nowrap; } .cs-users b { color: var(--text, #e7ecf6); font-weight: 600; }
.cs-pool { display: flex; flex-wrap: wrap; gap: 6px; }
.cs-pool span { display: inline-flex; align-items: center; gap: 3px; } .cs-pool small { font-size: 11px; color: var(--text-2, #9aa6bd); white-space: nowrap; }
.cs-team { padding: 10px 12px 0; }
.cs-h { cursor: pointer; } .cs-h.on { color: var(--gold, #c8a24a); }
.save-grp { margin: 10px 0 6px; font-size: 13px; opacity: .75; letter-spacing: .04em; } .save-grp:first-child { margin-top: 0; }

/* 세이브 백업 */
.bk-p { margin: 0 0 12px; line-height: 1.55; font-size: 13.5px; }
.bk-sec { border-top: 1px solid var(--line, rgba(255,255,255,.1)); padding: 12px 0 4px; }
.bk-sec h4 { margin: 0 0 8px; font-size: 14px; }
.bk-sec h4 small { font-weight: 400; opacity: .6; margin-left: 6px; }
.bk-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.bk-dim { display: block; opacity: .6; font-size: 12px; line-height: 1.5; }
.bk-ta { background: #0b1120; color: inherit; border: 1px solid #24304a; border-radius: 8px; padding: 8px; width: 100%; min-height: 64px; margin: 6px 0 8px; box-sizing: border-box; font: 12px/1.4 monospace; resize: vertical; }
.bk-list { margin: 0 0 12px; padding-left: 18px; font-size: 13px; line-height: 1.7; }
.bk-list small { opacity: .6; }
.bk-list em { font-style: normal; color: #f0a04b; font-size: 12px; margin-left: 4px; }
