:root {
  color-scheme: light;
  font-family: 'Pretendard', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  color: #352831;
  background: #f8f1e9;
  --paper: #fffaf5;
  --soft: #f8f1e9;
  --line: #e9ddd3;
  --ink: #352831;
  --muted: #76646a;
  --berry: #a82f52;
  --tint: #f8e2e6;
  --radius: 21px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .6; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #8845ad; outline-offset: 3px; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; fill: none; flex: 0 0 auto; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 220px; background: #381d32; color: #fff0d5; border-right: 1px solid #583548; display: flex; flex-direction: column; padding: 31px 17px 20px; z-index: 2; }
.brand { display: flex; align-items: center; gap: 11px; font-family: var(--wordmark-font); letter-spacing: .01em; font-size: 19px; margin: 0 7px 42px; white-space: nowrap; }
.brand small { display: block; font: 700 8px/1.2 Pretendard, 'Malgun Gothic', sans-serif; letter-spacing: .12em; color: #e5becf; margin-top: 4px; }
.brand-icon { display: grid; width: 41px; height: 41px; place-items: center; background: #eab58f; color: #562440; border-radius: 13px; }
.brand-icon .icon { width: 23px; height: 23px; }
.nav { display: grid; gap: 5px; }
.nav button { width: 100%; display: flex; align-items: center; gap: 11px; padding: 13px 14px; text-align: left; background: transparent; border: 0; border-radius: 12px; font-size: 14px; font-weight: 700; color: #f1d8e2; }
.nav button:hover, .nav button[aria-current] { color: #fff0d5; background: #754057; }
.profile { display: flex; align-items: center; gap: 9px; text-align: left; border: 1px solid #754057; border-radius: 14px; padding: 8px; background: #553146; margin-top: auto; min-width: 0; }
.profile-avatar { width: 39px; height: 39px; border-radius: 10px; background: #f2d8dc; }
.profile span { min-width: 0; }
.nickname { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.profile small { display: block; font-size: 10px; color: #f1d8e2; margin-top: 3px; }
.profile-arrow { margin-left: auto; width: 15px; height: 15px; }
main { margin-left: 220px; padding: 0 36px 44px; }
.topbar, #view { max-width: 1120px; margin-inline: auto; }
.topbar { min-height: 81px; display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.breadcrumb { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.breadcrumb strong { color: var(--ink); font-size: 14px; }
.wallet { display: flex; align-items: center; background: var(--paper); border: 1px solid #eaddce; border-radius: 50px; padding: 7px 13px; gap: 6px; font-size: 13px; color: #74592d; }
.wallet .icon { color: #8b5c25; background: #f7dfa7; border-radius: 50%; width: 20px; height: 20px; }
.wallet strong { color: var(--ink); font-size: 15px; }
.top-account { display: flex; align-items: center; gap: 7px; }
.top-account .logout-button { min-height: 34px; padding: 5px 10px; font-size: 11px; white-space: nowrap; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; background: var(--berry); color: white; font-weight: 800; border-radius: 11px; padding: 10px 15px; min-height: 44px; font-size: 13px; }
.button:hover { filter: brightness(.94); }
.button .icon { width: 17px; height: 17px; }
.button.secondary { background: var(--paper); color: var(--ink); border-color: #ddd0c5; }
.lobby-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(235px, .46fr); gap: 16px; align-items: start; }
.lobby-stage { display: grid; grid-template-rows: minmax(0, 1fr) auto; position: relative; isolation: isolate; min-height: 440px; border-radius: 20px; border: 1px solid #ebc0bf; overflow: hidden; background: radial-gradient(ellipse at 53% 37%, #fff5d6, #f5c9c7 54%, #da95a4); }
.lobby-windows { position: absolute; inset: 18px 16px 40%; z-index: -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; opacity: .6; }
.lobby-windows span { border-radius: 11px 11px 0 0; background: linear-gradient(150deg, #fff1d1aa, #f9e0c799), repeating-linear-gradient(90deg, transparent 0 45%, #d9819840 45% 51%, transparent 51%); border: 1px solid #d28fa783; }
.lobby-floor { position: absolute; z-index: -1; inset: auto 0 0; height: 43%; background: repeating-linear-gradient(0deg, #b9707d13 0 1px, transparent 1px 15px), linear-gradient(180deg, #cc8493, #edaeac); border-top: 2px solid #f8ded0a8; }
.lobby-floor::before { content: ''; position: absolute; inset: 16% 15% 7%; border: 1px solid #fff2d5ae; transform: perspective(110px) rotateX(29deg); }
.lobby-floor::after { content: ''; position: absolute; top: 47%; inset-inline: 0; height: 1px; background: #fff2d5af; }
#lobby-avatar { display: block; align-self: center; width: min(76%, 328px); height: auto; margin: 6px auto 0; filter: drop-shadow(0 10px 12px #64244126); }
.lobby-stage-info { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 8px; padding: 14px 17px 17px; background: linear-gradient(180deg, transparent, #e9a6abbd 38%); }
.lobby-stage-info p { color: #653547; font-size: 12px; font-weight: 750; }
.lobby-stage-info h1 { font-size: clamp(25px, 4.5vw, 34px); letter-spacing: -.065em; overflow-wrap: anywhere; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; min-height: 29px; }
.section-heading h2 { display: flex; align-items: center; gap: 7px; font-size: 21px; letter-spacing: -.07em; font-weight: 900; }
.mode-card { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; width: 100%; text-align: left; padding: 15px 13px 12px; min-height: 149px; background: var(--paper); border: 1px solid var(--line); border-radius: 17px; box-shadow: 0 2px 0 #eddfd6; transition: transform .15s, border-color .15s; }
.mode-card:hover { transform: translateY(-3px); border-color: #cf9fab; }
.mode-card strong { font-size: 15px; letter-spacing: -.045em; }
.mode-description { min-height: 2.8em; color: var(--muted); font-size: 11px; line-height: 1.5; word-break: keep-all; }
.mode-card > .icon { margin: auto 0 0 auto; width: 17px; height: 17px; color: var(--berry); }
.tile-icon { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 10px; background: #e1eee3; color: #386e59; }
.tile-icon.lilac { background: #ece5f7; color: #73539e; }
.quests, .panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.quests .section-heading h2 { font-size: 17px; }
.quests .section-heading .icon { color: var(--berry); width: 18px; height: 18px; }
.quest { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 5px 9px; padding: 8px 0; border-top: 1px solid var(--line); }
.quest b, .quest button { font-size: 11px; }
.quest-count { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.quest small, .quest button { grid-column: 2; }
.quest small { color: #865d32; font-size: 10px; white-space: nowrap; }
.quest button { border: 0; color: var(--berry); background: #f8e2e6; border-radius: 7px; padding: 4px 7px; font-weight: 800; }
.quest progress { width: 100%; height: 6px; border: none; color: #bd5375; grid-column: 1 / -1; background: #f0e1dc; border-radius: 20px; }
progress::-webkit-progress-bar { background: #f0e1dc; border-radius: 20px; }
progress::-webkit-progress-value { background: #bd5375; border-radius: 20px; }
progress::-moz-progress-bar { background: #bd5375; border-radius: 20px; }
.page-heading { font-size: clamp(29px, 5vw, 45px); font-weight: 900; letter-spacing: -.075em; line-height: 1.1; margin: 2px 0 9px; }
.page-lead, .hint { color: var(--muted); font-size: 14px; line-height: 1.6; }
.page-lead { margin-bottom: 21px; }
.stack { display: grid; gap: 14px; }
.panel h2 { font-size: 19px; letter-spacing: -.05em; margin-bottom: 10px; }
.panel p { line-height: 1.6; }
.play-grid, .shop-grid, .split { display: grid; gap: 13px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.play-grid .mode-card { min-height: 125px; }
.shop-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.item { display: grid; align-items: start; gap: 10px; }
.item .tile-icon .item-art { max-width: 42px; max-height: 42px; width: auto; height: auto; object-fit: contain; }
.item .tile-icon { width: 51px; height: 51px; background: color-mix(in srgb, var(--swatch), white 66%); color: #53364b; }
.item p { font-size: 12px; color: var(--muted); }
.item .button { justify-self: start; }
.closet-preview, .club-panel { text-align: center; }
.closet-preview canvas { display: block; background: radial-gradient(ellipse at center, #ffefe4, #f4d6dc); max-width: 100%; width: 240px; margin: 0 auto 12px; border-radius: 18px; }
.equipment { margin: 0; display: grid; gap: 6px; padding: 0; list-style: none; }
.equipment li, .member { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }
.row, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
.form input { display: block; width: 100%; min-height: 44px; padding: 8px 11px; border: 1px solid #dfd0c9; border-radius: 10px; color: var(--ink); background: #fffdfa; }
.form .button { justify-self: start; }
.error { color: #9b284a; font-size: 12px; overflow-wrap: anywhere; }
.error:empty { display: none; }
.invite-code { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 12px; margin: 11px 0; color: #87344d; border-radius: 11px; background: #f8e3e6; }
.invite-code strong { letter-spacing: .16em; font-size: 23px; }
.match-layout { max-width: 960px; margin: 0 auto; }
.match-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.match-head h1 { font-size: 25px; font-weight: 900; letter-spacing: -.05em; }
.match-head strong { font-size: 21px; padding: 5px 12px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); }
.court-wrap { position: relative; background: #396c62; border: 1px solid #2c5b52; border-radius: 19px; overflow: hidden; }
#court { width: 100%; display: block; aspect-ratio: 960 / 552; }
.court-toast { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); max-width: 90%; width: max-content; pointer-events: none; background: #183632e6; color: white; padding: 5px 10px; border-radius: 20px; font-size: 12px; text-align: center; }
.court-toast:empty { display: none; }
.match-tools { display: grid; gap: 8px; margin-top: 12px; }
.match-settings { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.match-settings .button { flex-shrink: 0; }
.match-settings [aria-pressed="true"] { border-color: #e2b9c7; background: var(--tint); color: var(--berry); }
.touch-controls { display: flex; gap: 12px; justify-content: space-between; align-items: center; user-select: none; }
.direction-pad { display: grid; grid-template-columns: repeat(3, 44px); gap: 4px; }
.direction-pad button:first-child { grid-column: 2; }
.direction-pad button:nth-child(2) { grid-column: 1; }
.control { touch-action: none; min-height: 42px; border: 1px solid #e0d1ca; border-radius: 10px; background: var(--paper); padding: 4px 9px; font-weight: 800; font-size: 12px; }
.control.active, .control:active { color: white; background: var(--berry); border-color: var(--berry); }
.shots { justify-content: flex-end; }
#dialog { border: 1px solid var(--line); background: var(--paper); border-radius: 20px; max-width: min(450px, calc(100vw - 30px)); width: 100%; padding: 20px; color: var(--ink); box-shadow: 0 16px 80px #3a1d3049; }
#dialog::backdrop { background: #311d3185; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.dialog-head h2 { font-size: 23px; letter-spacing: -.06em; }
.icon-button { display: grid; place-items: center; min-width: 40px; min-height: 40px; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 8px; }
.icon-button:hover { background: var(--tint); }
.dialog-actions { margin-top: 15px; }
#toast { position: fixed; z-index: 3; left: 50%; bottom: 20px; transform: translateX(-50%); background: #47293b; color: white; padding: 10px 17px; border-radius: 30px; font-size: 13px; text-align: center; width: max-content; max-width: calc(100% - 26px); box-shadow: 0 5px 20px #432a4430; }
#toast:empty { display: none; }

@media (max-width: 1080px) {
  .sidebar { width: 175px; padding-inline: 12px; }
  .brand { font-size: 16px; gap: 7px; margin-inline: 0; }
  .brand-icon { width: 36px; height: 36px; }
  main { margin-left: 175px; padding-inline: 22px; }
  .lobby-layout { grid-template-columns: minmax(0, 1fr) minmax(203px, .52fr); gap: 12px; }
  .mode-card { padding-inline: 10px; }
}
@media (max-width: 850px) {
  .lobby-layout { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
  .sidebar { width: auto; inset: auto 0 0; height: auto; padding: 5px 3px max(5px, env(safe-area-inset-bottom)); border-top: 1px solid #583548; border-right: 0; }
  .brand { display: none; }
  .nav { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; }
  .nav button { display: grid; justify-items: center; justify-content: center; gap: 3px; padding: 5px 1px; font-size: 10px; white-space: nowrap; }
  .nav button .icon { width: 19px; height: 19px; }
  .profile { position: fixed; top: 9px; right: 12px; padding: 0; border: 0; background: none; }
  .profile-avatar { width: 35px; height: 35px; }
  .profile span, .profile-arrow { display: none; }
  main { margin-left: 0; padding: 0 12px 75px; }
  .topbar { min-height: 54px; padding-right: 45px; }
  .breadcrumb { gap: 4px; font-size: 11px; }
  .breadcrumb strong { font-size: 12px; }
  .wallet { padding: 4px 9px; gap: 4px; }
  .lobby-stage { min-height: 278px; border-radius: 16px; }
  #lobby-avatar { width: min(66%, 220px); }
  .lobby-stage-info { padding: 5px 10px 11px; }
  .top-account .logout-button { min-height: 32px; padding-inline: 6px; }
  .mode-card { padding: 10px 7px; min-height: 141px; }
  .mode-card strong { font-size: 13px; }
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .court-wrap { border-radius: 12px; }
  #court { aspect-ratio: 580 / 552; }
  .match-head h1 { font-size: 19px; }
  .match-head strong { font-size: 15px; padding: 5px 7px; }
  .match-settings .hint { font-size: 11px; }
  .match-settings .button { min-height: 36px; padding: 4px 7px; font-size: 11px; }
  .direction-pad { grid-template-columns: repeat(3, 36px); gap: 2px; }
  .control { padding: 4px 5px; }
  .shots { gap: 4px; }
  #toast { bottom: 65px; }
}

/* 캐릭터 만들기, 능력치, 경기 방식 */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.onboarding .nav, .onboarding .wallet { opacity: .45; pointer-events: none; }
.onboarding .logout-button { display: none; }
.create .form fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.create .form legend { color: var(--muted); font-size: 13px; font-weight: 700; margin-bottom: 6px; width: 100%; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; }
.choices legend { margin-bottom: 8px; }
.choice { position: relative; padding: 7px 13px; border-radius: 999px; background: #fff; box-shadow: 0 0 0 1px #d8c7bc; cursor: pointer; font-size: 14px; }
.choice input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.choice:has(input:checked) { box-shadow: 0 0 0 2px var(--berry); color: var(--berry); font-weight: 700; }
.choice:has(input:focus-visible) { outline: 3px solid #8845ad; outline-offset: 3px; }
.swatch { position: relative; width: 36px; height: 36px; border-radius: 50%; background: var(--swatch); border: 2px solid #fff; box-shadow: 0 0 0 1px #d8c7bc; cursor: pointer; }
.swatch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.swatch:has(input:checked) { box-shadow: 0 0 0 3px var(--berry); }
.swatch:has(input:focus-visible) { outline: 3px solid #8845ad; outline-offset: 3px; }
.styles { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.style-card { display: grid !important; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fffdfa; cursor: pointer; color: var(--ink) !important; }
.style-card { position: relative; }
.style-card input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.style-card b { font-size: 14px; }
.style-card span, .style-card small { font-weight: 500; color: var(--muted); font-size: 12px; }
.style-card:has(input:checked) { border-color: var(--berry); background: var(--tint); }
.style-card:has(input:focus-visible) { outline: 3px solid #8845ad; outline-offset: 2px; }
.create .actions { display: flex; gap: 8px; }
.format-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 800; font-size: 14px; }
.chip { border: 1px solid #ddd0c5; background: var(--paper); border-radius: 999px; padding: 8px 14px; min-height: 40px; font-weight: 700; font-size: 13px; }
.chip[aria-pressed="true"] { background: var(--berry); border-color: var(--berry); color: white; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.points b { color: var(--berry); font-size: 18px; }
.stats { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.stat-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 32px 52px; grid-template-areas: "name meter value plus" "detail detail detail detail"; align-items: center; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.stat-row > div { grid-area: name; display: grid; }
.stat-row small { color: var(--muted); font-size: 11.5px; }
.stat-row meter { grid-area: meter; width: 100%; }
.stat-row strong { grid-area: value; text-align: right; font-size: 16px; }
.stat-row .stat-detail { grid-area: detail; }
.stat-plus { grid-area: plus; min-height: 36px; padding: 6px 10px; }
.split .wide { grid-column: 1 / -1; }
.closet-preview progress, .closet-preview .hint { width: 100%; text-align: center; }
.equipment small { color: var(--muted); }
.item .bonus { font-size: 12px; font-weight: 700; color: var(--berry); }
.rare { color: #6c5bd4; }
.level-up { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--tint); font-weight: 800; color: var(--berry); line-height: 1.6; }
.match-head h1 small { font-size: 13px; color: var(--muted); font-weight: 700; }
@media (max-width: 650px) {
  .styles { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: minmax(0, 1fr) 60px 28px 48px; }
}

/* 모바일 조이스틱과 가로 화면 경기 */
.joystick { position: relative; width: 116px; height: 116px; border-radius: 50%; background: radial-gradient(circle, #fffaf5 0 30%, #f3e4dc 31% 100%); border: 1px solid #e0d1ca; touch-action: none; flex: 0 0 auto; }
.joystick .stick { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%; background: var(--berry); box-shadow: 0 3px 8px #5a1d3540; transition: transform .08s; pointer-events: none; }
.joystick.active .stick { transition: none; }
.shots .control { min-width: 64px; min-height: 56px; border-radius: 16px; font-size: 13px; padding-inline: 4px; white-space: nowrap; }
.rotate-hint { display: none; }
@media (pointer: fine) and (min-width: 651px) {
  .joystick { display: none; }
}
@media (max-width: 650px) and (orientation: portrait) {
  .in-match .rotate-hint { display: block; margin: 0 0 8px; padding: 8px 10px; border-radius: 10px; background: var(--tint); color: var(--berry); font-size: 12px; font-weight: 700; text-align: center; }
  .joystick { width: 104px; height: 104px; }
}
@media (orientation: landscape) and (max-height: 540px) {
  body.in-match .sidebar, body.in-match .topbar, body.in-match .match-settings, body.in-match #toast:empty { display: none; }
  body.in-match main { margin: 0; padding: max(6px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left)); }
  body.in-match .match-layout { max-width: none; height: calc(100dvh - 12px); display: grid; grid-template-columns: minmax(130px, 1fr) minmax(0, calc((100dvh - 72px) * 960 / 552)) minmax(130px, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 6px 10px; }
  body.in-match .match-head { grid-column: 1 / -1; margin: 0; }
  body.in-match .match-head h1 { font-size: 16px; }
  body.in-match .match-head strong { font-size: 14px; padding: 3px 8px; }
  body.in-match .match-head .button { min-height: 34px; padding: 4px 10px; }
  body.in-match .court-wrap { grid-column: 2; grid-row: 2; width: 100%; align-self: center; border-radius: 12px; }
  body.in-match .match-tools, body.in-match .touch-controls { display: contents; }
  body.in-match .joystick { display: block; grid-column: 1; grid-row: 2; align-self: end; justify-self: center; margin-bottom: 14px; }
  body.in-match .shots { grid-column: 3; grid-row: 2; align-self: end; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
  body.in-match .shots .control { min-height: 64px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
.look-choices { display: grid; gap: 12px; }
