/*
 * Broadcast Game Land quality layer
 * Keeps the existing game logic intact while providing one final,
 * consistent visual and interaction pass across the hub and games.
 */
:root {
  --quality-ink: #18264a;
  --quality-muted: #68789b;
  --quality-line: rgba(91, 115, 169, .2);
  --quality-blue: #4f73f1;
  --quality-violet: #7558df;
  --quality-focus: #ffd84d;
  --quality-shadow: 0 18px 48px rgba(32, 52, 111, .14);
}

html {
  scroll-behavior: smooth;
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button,
a,
input,
select,
[tabindex] {
  outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 4px solid var(--quality-focus) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 7px rgba(55, 78, 146, .28) !important;
}

button:not(:disabled),
a[href] {
  touch-action: manipulation;
}

img {
  max-width: 100%;
}

/* Home: one coherent card system instead of accumulated local overrides. */
body[data-view="hub"] .app-shell {
  background:
    radial-gradient(circle at 8% 5%, rgba(110, 224, 255, .22), transparent 24rem),
    radial-gradient(circle at 92% 18%, rgba(255, 150, 211, .17), transparent 25rem),
    linear-gradient(180deg, #f8fbff 0%, #f4f6ff 48%, #fbf8ff 100%) !important;
}

#hubScreen.arcade-home {
  width: min(1480px, 100%) !important;
  margin-inline: auto !important;
}

.arcade-topbar {
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
}

.lobby-hero,
.random-recommend-section,
.home-game-tabs,
.home-section,
.recommend-app-ad {
  border-color: rgba(255, 255, 255, .92) !important;
  box-shadow: var(--quality-shadow) !important;
}

.lobby-stage {
  isolation: isolate;
}

.lobby-copy {
  text-wrap: balance;
}

.arcade-home .home-game-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 226px), 1fr)) !important;
  gap: clamp(14px, 1.45vw, 22px) !important;
  align-items: stretch !important;
}

.arcade-home .game-tile {
  min-width: 0 !important;
  min-height: 230px !important;
  grid-template-columns: 1fr !important;
  grid-template-rows: minmax(124px, 1fr) auto !important;
  align-content: stretch !important;
  gap: 13px !important;
  padding: 12px !important;
  border: 1px solid rgba(107, 128, 178, .18) !important;
  border-radius: 24px !important;
  background: rgba(255, 255, 255, .94) !important;
  box-shadow: 0 12px 30px rgba(45, 67, 124, .09) !important;
  transform: translateZ(0);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease !important;
}

.arcade-home .game-tile:hover {
  transform: translateY(-6px) !important;
  border-color: rgba(79, 115, 241, .38) !important;
  box-shadow: 0 20px 40px rgba(45, 67, 124, .16) !important;
}

.arcade-home .game-tile:active {
  transform: translateY(-1px) scale(.992) !important;
}

.arcade-home .game-tile > .tile-visual:first-of-type {
  width: 100% !important;
  min-height: 124px !important;
  height: 100% !important;
  border-radius: 17px !important;
  overflow: hidden !important;
  background: #eaf0ff !important;
  box-shadow: inset 0 0 0 1px rgba(40, 60, 110, .08) !important;
}

.arcade-home .tile-photo {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 124px !important;
  object-fit: cover !important;
  object-position: center !important;
  transition: transform .32s ease, filter .32s ease !important;
}

.arcade-home .game-tile:hover .tile-photo {
  transform: scale(1.045);
  filter: saturate(1.08) contrast(1.02);
}

.arcade-home .tile-copy {
  min-width: 0 !important;
  display: grid !important;
  gap: 5px !important;
  padding: 0 3px 4px !important;
  text-align: left !important;
}

.arcade-home .tile-copy strong {
  color: var(--quality-ink) !important;
  font-size: clamp(18px, 1.25vw, 22px) !important;
  line-height: 1.15 !important;
  letter-spacing: -.035em !important;
}

.arcade-home .tile-copy small {
  color: var(--quality-muted) !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
  font-weight: 750 !important;
  word-break: keep-all;
}

.arcade-home .tile-badge {
  z-index: 5 !important;
  top: 20px !important;
  left: 20px !important;
  min-height: 27px !important;
  display: inline-flex !important;
  align-items: center !important;
  padding: 0 10px !important;
  border: 2px solid rgba(255, 255, 255, .85) !important;
  box-shadow: 0 5px 14px rgba(27, 39, 78, .18) !important;
}

/* The photo is authoritative; hide legacy duplicate SVG art layers. */
.draw-tile-art,
.rps-hands,
.yut-home-art,
.gomoku-visual,
.word-cubes,
.hammer-visual {
  display: none !important;
}

.home-game-tab,
.recent-game-quick,
.theme-switch,
.recommend-controls button {
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease !important;
}

.home-game-tab[aria-selected="true"] {
  box-shadow: 0 10px 24px rgba(74, 98, 180, .16) !important;
}

/* Shared game chrome and status feedback. */
.online-topbar,
.luck-topbar,
.fish-game-titlebar,
.game-titlebar,
.result-titlebar {
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
}

.online-room-card,
.luck-rule-card,
.luck-score-card,
.wizard-card,
.modal-card,
.yut-side-panel {
  border-color: var(--quality-line) !important;
  box-shadow: 0 14px 34px rgba(40, 61, 115, .1) !important;
}

.online-toast,
.result-banner,
.result-toast {
  border-radius: 14px !important;
  box-shadow: 0 12px 28px rgba(28, 42, 89, .18) !important;
}

/* Yut: the selected character is the actual piece, not a default disc. */
.yut-piece.char-piece {
  overflow: visible !important;
  border: 3px solid #fff !important;
  background: transparent !important;
  box-shadow: 0 6px 13px rgba(31, 43, 82, .26) !important;
  isolation: isolate;
}

.yut-piece.char-piece.host {
  outline: 3px solid #ff6681 !important;
  outline-offset: -1px !important;
}

.yut-piece.char-piece.guest {
  outline: 3px solid #4d88f4 !important;
  outline-offset: -1px !important;
}

.yut-piece.char-piece::before,
.yut-piece.char-piece::after {
  display: none !important;
  content: none !important;
}

.cute-yut-token {
  position: absolute !important;
  inset: -13% !important;
  display: grid !important;
  place-items: center !important;
  width: auto !important;
  height: auto !important;
  border-radius: 50% !important;
  overflow: visible !important;
  background: #fff !important;
  filter: drop-shadow(0 3px 3px rgba(33, 47, 87, .22));
  pointer-events: none;
  z-index: 2;
}

.cute-yut-token svg {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  overflow: visible !important;
}

.yut-bench .yut-piece.char-piece {
  flex: 0 0 auto !important;
}

.yut-bench .cute-yut-token {
  inset: -9% !important;
}

.yut-piece.char-piece.selectable {
  cursor: pointer !important;
  animation: qualityYutPulse .9s ease-in-out infinite !important;
}

.yut-piece.char-piece.chosen {
  animation: none !important;
  transform: scale(1.17) !important;
  box-shadow: 0 0 0 5px #ffe36c, 0 0 28px rgba(255, 107, 101, .72) !important;
}

.yut-stack-count {
  top: -18px !important;
  z-index: 12 !important;
  background: #172449 !important;
  color: #fff !important;
  border: 2px solid #fff !important;
}

@keyframes qualityYutPulse {
  0%, 100% { transform: translateY(0) scale(1); filter: brightness(1); }
  50% { transform: translateY(-3px) scale(1.08); filter: brightness(1.07); }
}

.ready-yut-avatar {
  padding: 5px !important;
  overflow: hidden !important;
  background: #fff !important;
}

.ready-yut-avatar svg {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}

.ready-yut-picker-wrap {
  width: 100%;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(92, 111, 157, .16);
}

.ready-yut-picker-title {
  margin-bottom: 8px;
  color: #4e608c;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .04em;
}

.ready-yut-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.ready-yut-choice {
  min-width: 0;
  min-height: 64px;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 5px;
  border: 2px solid #e3e9f6;
  border-radius: 14px;
  background: #fff;
  color: #43547c;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.ready-yut-choice svg {
  width: 42px;
  height: 42px;
  display: block;
}

.ready-yut-choice small {
  font-size: 9px;
  font-weight: 900;
}

.ready-yut-choice:not(:disabled):hover {
  transform: translateY(-2px);
  border-color: #8ca5f5;
}

.ready-yut-choice.selected {
  border-color: #5f77e8 !important;
  background: #edf1ff !important;
  box-shadow: 0 0 0 3px rgba(95, 119, 232, .14) !important;
}

.ready-yut-choice.locked {
  filter: grayscale(.75);
  opacity: .38;
}

.site-version-footer {
  width: 100%;
  position: relative !important;
  right: auto !important;
  bottom: auto !important;
  z-index: 2 !important;
  display: flex;
  justify-content: center;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: transparent !important;
  border: 0 !important;
  color: #77839f !important;
  font: 800 11px/1.3 Pretendard, sans-serif !important;
  letter-spacing: .09em !important;
  opacity: 1 !important;
}

@media (max-width: 900px) {
  .arcade-home .home-game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 11px !important;
  }

  .arcade-home .game-tile {
    min-height: 190px !important;
    grid-template-rows: 102px auto !important;
    padding: 9px !important;
    border-radius: 19px !important;
  }

  .arcade-home .game-tile > .tile-visual:first-of-type,
  .arcade-home .tile-photo {
    min-height: 102px !important;
    border-radius: 13px !important;
  }

  .arcade-home .tile-copy strong { font-size: clamp(16px, 4.7vw, 19px) !important; }
  .arcade-home .tile-copy small { font-size: 10.5px !important; line-height: 1.38 !important; }
  .arcade-home .tile-badge { top: 14px !important; left: 14px !important; }
  .ready-yut-picker-grid { grid-template-columns: repeat(3, minmax(48px, 1fr)); }
}

@media (max-width: 460px) {
  .arcade-home .home-game-grid { gap: 9px !important; }
  .arcade-home .game-tile { min-height: 174px !important; grid-template-rows: 88px auto !important; }
  .arcade-home .game-tile > .tile-visual:first-of-type,
  .arcade-home .tile-photo { min-height: 88px !important; }
  .arcade-home .tile-copy { gap: 3px !important; }
  .arcade-home .tile-copy small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .ready-yut-choice { min-height: 56px; }
  .ready-yut-choice svg { width: 36px; height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Version is visible on the main hub only. */
body:not([data-view="hub"]) #site-version-fixed{display:none!important;}
body[data-view="hub"] #site-version-fixed{display:flex!important;}
