:root { color-scheme: dark; --ink: #f5f5f5; --muted: #b8b8b8; --line: #2d2d2d; --gold: #d7b66f; --anchor-offset: 100px; }
* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body { margin: 0; background: #050505; color: var(--ink); font-family: 'Pretendard', 'Malgun Gothic', sans-serif; line-height: 1.6; letter-spacing: 0; overflow-x: clip; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
button:disabled { cursor: not-allowed; opacity: .45; }
[hidden] { display: none !important; }
main { max-width: 1120px; margin: auto; padding: 40px 24px 64px; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: 36px; line-height: 1.3; margin: 10px 0 14px; }
h2 { font-size: 21px; line-height: 1.4; }
h3 { font-size: 23px; line-height: 1.4; }
.eyebrow { color: var(--gold); font-size: 14px; }
.heading-meta { display: flex; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; color: var(--muted); font-size: 15px; }
.divider { color: #666; margin: 0 8px; }
.works-section { margin-top: 36px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-heading > span { color: var(--muted); font-size: 13px; }
.game-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.game-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #111; }
.game-thumbnail { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; background: #000; border-bottom: 1px solid var(--line); }
.game-card-body { padding: 20px; }
.game-category { color: var(--gold); font-size: 12px; margin-bottom: 6px; }
.creator { color: #dfe7ff; font-size: 15px; margin-top: 5px; }
.game-description { color: var(--muted); font-size: 14px; margin: 10px 0 18px; }
.play-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; padding: 10px 20px; background: #fff; border: 0; color: #080808; border-radius: 4px; font-weight: 700; }
.play-button img { width: 18px; height: 18px; }
.play-button:hover { background: #e8e8e8; }
.game-card.is-playing { border-color: var(--gold); }
.pending-section { border-top: 1px solid var(--line); margin-top: 40px; padding-top: 28px; }
.pending-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px 32px; }
.pending-list li { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.pending-list span { color: var(--muted); }
#player { margin-top: 30px; scroll-margin-top: var(--anchor-offset); }
.player-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 12px; }
.playing-info { min-width: 0; }
.playing-info p { color: #dfe7ff; font-size: 14px; }
.player-controls { display: flex; flex-shrink: 0; gap: 8px; }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 4px; border: 1px solid #4a4a4a; background: #111; }
.icon-button img { width: 20px; height: 20px; filter: invert(1); }
.icon-button:hover { background: #292929; }
.game-stage { position: relative; background: #000; width: min(100%, 800px); aspect-ratio: 4 / 3; margin: auto; }
#frame-mount, #frame-mount iframe { width: 100%; height: 100%; border: 0; display: block; }
.player-message { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 18px; text-align: center; padding: 24px; background: #111; color: var(--muted); }
#retry { padding: 8px 18px; background: #fff; color: #080808; border: 0; border-radius: 4px; }
#player:fullscreen { margin: 0; padding: 12px; display: flex; flex-direction: column; background: #050505; height: 100%; }
#player:fullscreen .game-stage { flex: 0 1 auto; width: min(100%, calc((100dvh - 94px) * 4 / 3)); min-height: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.player-layout { min-height: 0; min-width: 0; width: 100%; }
.player-toolbar { min-width: 0; }
.game-stage { max-width: 100%; }
.game-stage { container-type: inline-size; }
#touch-controls { display: flex; align-items: center; justify-content: space-around; gap: 12px; padding-top: 12px; }
.touch-direction { flex: 0 0 156px; display: grid; grid-template: repeat(3, 48px) / repeat(3, 48px); gap: 6px; }
.touch-direction.horizontal { grid-template: 48px / repeat(2, 48px); flex-basis: 102px; }
.touch-actions { display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 6px; max-width: 324px; min-width: 0; }
.touch-direction:not([hidden]) + .touch-actions { max-width: 156px; flex: 1 1 0; }
.touch-button { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; min-height: 48px; padding: 8px; border: 1px solid #637386; border-radius: 8px; background: #202833; color: #f5f5f5; font-size: 14px; font-weight: 600; line-height: 1.3; touch-action: none; user-select: none; -webkit-user-select: none; }
.touch-button img { width: 24px; height: 24px; pointer-events: none; filter: invert(1); }
.touch-button.is-pressed { background: #247762; border-color: #89e2cb; }
.touch-button[aria-pressed="true"], .icon-button[aria-pressed="true"] { outline: 2px solid #89e2cb; outline-offset: -2px; }
.touch-button:disabled { opacity: .4; cursor: default; }
.color-swatch::before { content: ''; display: block; width: 25px; height: 25px; background: var(--swatch); border-radius: 50%; }
.touch-actions.numeric { display: grid; grid-template-columns: repeat(3, 48px); }
body.player-expanded { overflow: hidden; }
#player.is-expanded, #player:fullscreen { position: fixed; inset: 0; z-index: 2000; margin: 0; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); height: 100dvh; background: #050505; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
#player:is(.is-expanded, :fullscreen) .player-toolbar { flex-wrap: wrap; gap: 8px; padding-bottom: 10px; }
#player:is(.is-expanded, :fullscreen) .playing-info h2 { font-size: 16px; }
#player:is(.is-expanded, :fullscreen) .playing-info p { display: none; }
#player:is(.is-expanded, :fullscreen) .player-layout { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; }
#player:is(.is-expanded, :fullscreen) .game-stage { flex: none; margin: 0; }
#player:is(.is-expanded, :fullscreen) #touch-controls { width: 100%; flex: none; padding: 0; }
@media (orientation: landscape) {
  #player:is(.is-expanded, :fullscreen).has-touch .player-layout { display: grid; grid-template-columns: 156px minmax(0, 1fr) 156px; gap: 12px; align-items: center; justify-items: center; }
  #player:is(.is-expanded, :fullscreen).has-touch #touch-controls { display: contents; }
  #player:is(.is-expanded, :fullscreen).has-touch .game-stage { grid-area: 1 / 2; }
  #player:is(.is-expanded, :fullscreen).has-touch .touch-direction { grid-area: 1 / 1; }
  #player:is(.is-expanded, :fullscreen).has-touch .touch-actions { grid-area: 1 / 3; max-width: 156px; }
  #player:is(.is-expanded, :fullscreen).has-touch:not(.has-movement) .player-layout { grid-template-columns: 0 minmax(0, 1fr) 156px; }
}
@media (orientation: landscape) and (max-height: 340px) {
  #player:is(.is-expanded, :fullscreen).has-touch.has-numeric .player-layout { grid-template-columns: 0 minmax(0, 1fr) 210px; }
  #player:is(.is-expanded, :fullscreen).has-touch .touch-actions.numeric { max-width: 210px; grid-template-columns: repeat(4, 48px); }
}
/* Gameplay controls stay in the canvas corners without blocking its center. */
#player.has-movement .game-stage #touch-controls {
  position: absolute; inset: auto 10px 10px; z-index: 2;
  display: flex; width: auto; padding: 0; align-items: flex-end;
  justify-content: space-between; pointer-events: none;
}
#player.has-movement .game-stage .touch-direction,
#player.has-movement .game-stage .touch-actions { pointer-events: none; }
#player.has-movement .game-stage .touch-button { pointer-events: auto; background: rgb(32 40 51 / .72); }
#player.has-movement .game-stage .touch-button.is-pressed { background: #247762; }
#player.has-movement .game-stage .touch-actions { flex: 0 1 auto; justify-content: flex-end; }
#player:is(.is-expanded, :fullscreen).has-movement .player-layout { display: flex; }
@container (max-width: 420px) {
  #player.has-movement .game-stage #touch-controls { inset: auto 6px 6px; }
  #player.has-movement .game-stage .touch-direction { flex-basis: 140px; grid-template: repeat(3, 44px) / repeat(3, 44px); gap: 4px; }
  #player.has-movement .game-stage .touch-direction.horizontal { flex-basis: 92px; grid-template: 44px / repeat(2, 44px); }
  #player.has-movement .game-stage .touch-button { min-width: 44px; min-height: 44px; padding: 6px; }
}
@media (max-width: 620px) {
  main { padding: 28px 16px 44px; }
  h1 { font-size: 28px; }
  h3 { font-size: 21px; }
  .game-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .pending-list { grid-template-columns: 1fr; }
  .section-heading { flex-wrap: wrap; }
  .player-toolbar { flex-wrap: wrap; }
  .playing-info h2 { font-size: 19px; }
}
