﻿:root {
  --frame-width: 844;
  --frame-height: 1766;
  --frame-ratio: 0.4779161948;
  --app-height: 100vh;
  --app-width: 100vw;
}

@font-face {
  font-family: "Jalnan2TTF";
  src: url("../assets/font/Jalnan2TTF.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: var(--app-height);
}

body {
  overflow: hidden;
  background: #d8b1b1;
  color: #1f2937;
  font-family: "Jalnan2TTF", "Malgun Gothic", sans-serif;
}

body.capture-mode {
  background: transparent;
}

#app {
  width: 100%;
  height: var(--app-height);
  overflow: hidden;
}

.app-viewport {
  width: 100%;
  height: var(--app-height);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.stage-shell {
  position: relative;
  width: min(calc(var(--app-height) * var(--frame-ratio)), calc(var(--app-width) - 24px));
  height: min(calc((var(--app-width) - 24px) / var(--frame-ratio)), calc(var(--app-height) - 24px));
  max-width: calc(var(--frame-width) * 1px);
  max-height: calc(var(--frame-height) * 1px);
  overflow: hidden;
  border-radius: 36px;
  background: #e2bdba;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.45);
}

body.capture-mode .app-viewport {
  padding: 0;
}

body.capture-mode .stage-shell {
  width: calc(var(--frame-width) * 1px);
  height: calc(var(--frame-height) * 1px);
  max-width: none;
  max-height: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

html:fullscreen body,
html:-webkit-full-screen body {
  background: #d8b1b1;
}

html:fullscreen .app-viewport,
html:-webkit-full-screen .app-viewport {
  height: var(--app-height);
  padding: 0;
}

html:fullscreen .stage-shell,
html:-webkit-full-screen .stage-shell {
  width: var(--app-width);
  height: var(--app-height);
  max-width: none;
  max-height: none;
  border-radius: 0;
  box-shadow: none;
}

.stage-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--frame-width) * 1px);
  height: calc(var(--frame-height) * 1px);
  transform-origin: top left;
  overflow: hidden;
}

.screen-root {
  position: relative;
  width: 844px;
  height: 1766px;
  overflow: hidden;
}

.asset-layer {
  position: absolute;
  pointer-events: none;
  -webkit-user-drag: none;
}

.hit-area {
  position: absolute;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  z-index: 120;
  cursor: pointer;
}

.hit-area:active {
  background: rgba(255, 255, 255, 0.06);
}

.board-interaction {
  position: absolute;
  z-index: 125;
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  grid-template-rows: repeat(15, 1fr);
}

.board-cell {
  position: relative;
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.board-cell:disabled {
  cursor: default;
}

.board-cell:hover::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(142, 95, 60, 0.18);
}

.stone {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 55px;
  height: 55px;
  transform: translate(-50%, -50%);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  filter: drop-shadow(0 6px 8px rgba(96, 52, 35, 0.18));
  pointer-events: none;
}

.stone.black {
  background-image: url("../assets/figma/stone_black.png");
}

.stone.white {
  background-image: url("../assets/figma/stone_white.png");
}

.stone.last::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 0 1px rgba(128, 79, 58, 0.28);
}

.stone.white.last::after {
  background: rgba(0, 0, 0, 0.35);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.stone.win {
  filter: none;
}

.stone.win.last::after {
  display: none;
}

.stone.black.win {
  width: 65px;
  height: 64px;
  background-image: url("../assets/figma/stone_black_win.png");
}

.stone.white.win {
  width: 63px;
  height: 64px;
  background-image: url("../assets/figma/stone_white_win.png");
}

.score-number {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Jalnan2TTF", "Malgun Gothic", sans-serif;
  font-size: 82px;
  line-height: 0.95;
  letter-spacing: 0.01em;
  z-index: 140;
  -webkit-text-stroke: 8px #7a4c23;
  paint-order: stroke fill;
  text-shadow: none;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.score-number.black {
  background-image: none;
  -webkit-text-fill-color: #ffffff;
  color: #ffffff;
  -webkit-text-stroke-color: #be5d6c;
  text-shadow: none;
}

.score-number.white {
  background-image: none;
  -webkit-text-fill-color: #ffffff;
  color: #ffffff;
  -webkit-text-stroke-color: #4c82c1;
  text-shadow: none;
}

.turn-panel.active-black {
  filter: drop-shadow(0 8px 12px rgba(232, 123, 149, 0.42));
}

.turn-panel.active-white {
  filter: drop-shadow(0 8px 12px rgba(128, 184, 238, 0.42));
}

.warning-pill {
  position: absolute;
  left: 50%;
  top: 362px;
  transform: translateX(-50%);
  min-width: 420px;
  max-width: 650px;
  padding: 14px 24px;
  border-radius: 999px;
  background: rgba(244, 86, 86, 0.92);
  color: #fff;
  text-align: center;
  font-size: 28px;
  z-index: 300;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.modal-overlay {
  position: absolute;
  inset: 0;
  z-index: 400;
}

.modal-overlay .hit-area {
  z-index: 410;
}

.modal-draw-title {
  position: absolute;
  left: 50%;
  top: 556px;
  transform: translateX(-50%);
  width: 310px;
  text-align: center;
  color: #7b4a2c;
  font-size: 68px;
  line-height: 1;
  z-index: 420;
}

@media (max-width: 480px) {
  .app-viewport {
    padding: 8px;
  }

  .stage-shell {
    width: min(calc(var(--app-height) * var(--frame-ratio)), calc(var(--app-width) - 16px));
    height: min(calc((var(--app-width) - 16px) / var(--frame-ratio)), calc(var(--app-height) - 16px));
    border-radius: 28px;
  }
}

.replay-ad-overlay {
  position: absolute;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: #071845;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.replay-ad-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

.replay-ad-image {
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.replay-ad-counter {
  position: absolute;
  right: 20px;
  top: 27px;
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: center / contain no-repeat;
}

.replay-ad-count {
  display: block;
  color: #2f3340;
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.58);
  transform: translateY(4px);
}
