:root {
  --dtp-bg: #151223;
  --dtp-panel: rgba(255,255,255,.10);
  --dtp-panel-strong: rgba(255,255,255,.16);
  --dtp-text: #ffffff;
  --dtp-muted: rgba(255,255,255,.70);
  --dtp-line: rgba(255,255,255,.16);
  --dtp-accent: #ffcf4a;
  --dtp-danger: #ff5d7a;
  --dtp-good: #74f2bd;
  --dtp-shadow: 0 18px 50px rgba(0,0,0,.35);
  --dtp-radius: 24px;
  --dtp-grid-gap: clamp(4px, 1.1vw, 8px);
  --dtp-safe-top: env(safe-area-inset-top, 0px);
  --dtp-safe-bottom: env(safe-area-inset-bottom, 0px);
}

html.dtp-lock-scroll,
html.dtp-lock-scroll body,
body.dtp-standalone-body {
  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: none;
}

body.dtp-standalone-body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 20% 15%, rgba(255,207,74,.20), transparent 26%),
    radial-gradient(circle at 80% 85%, rgba(116,242,189,.16), transparent 30%),
    linear-gradient(135deg, #0f0d1a 0%, #211734 54%, #111827 100%);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
}

.dtp-shortcode-wrap,
.dtp-standalone-wrap {
  width: 100%;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 15% 18%, rgba(255,207,74,.20), transparent 25%),
    radial-gradient(circle at 84% 82%, rgba(116,242,189,.16), transparent 30%),
    linear-gradient(135deg, #0f0d1a 0%, #211734 54%, #111827 100%);
}

.dtp-shortcode-wrap.dtp-fullscreen-wrap {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
}

.dtp-app,
.dtp-app * {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.dtp-app {
  position: relative;
  width: min(100vw, calc(100dvh * 9 / 16));
  height: min(100dvh, calc(100vw * 16 / 9));
  aspect-ratio: 9 / 16;
  max-width: 520px;
  max-height: 925px;
  color: var(--dtp-text);
  border-radius: clamp(0px, 3dvh, 28px);
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,.14), transparent 38%),
    linear-gradient(180deg, #23203a 0%, #171326 64%, #0c0b14 100%);
  box-shadow: var(--dtp-shadow);
  touch-action: none;
  isolation: isolate;
}

.dtp-app::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: .55;
  pointer-events: none;
}

.dtp-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(16px + var(--dtp-safe-top)) clamp(14px, 4vw, 24px) calc(16px + var(--dtp-safe-bottom));
  z-index: 2;
}

.dtp-game-screen {
  gap: clamp(10px, 2dvh, 16px);
}

.dtp-topbar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  min-height: 64px;
}

.dtp-stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--dtp-line);
  border-radius: 18px;
  background: var(--dtp-panel);
  backdrop-filter: blur(12px);
  line-height: 1.1;
}

.dtp-stat-label {
  font-size: clamp(10px, 2.4vw, 12px);
  color: var(--dtp-muted);
  letter-spacing: -.02em;
}

.dtp-stat-value {
  margin-top: 4px;
  font-weight: 900;
  font-size: clamp(18px, 5.6vw, 28px);
  letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
}

.dtp-time.danger .dtp-stat-value {
  color: var(--dtp-danger);
  animation: dtpPulse .8s infinite;
}

.dtp-board-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 10px;
  border: 1px solid var(--dtp-line);
  border-radius: var(--dtp-radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,.13), rgba(255,255,255,.055)),
    rgba(255,255,255,.08);
  backdrop-filter: blur(12px);
}

.dtp-board {
  width: min(100%, calc((100dvh - 170px) * .58));
  max-width: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: var(--dtp-grid-gap);
  padding: var(--dtp-grid-gap);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,.10), transparent 40%),
    rgba(0,0,0,.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.10), inset 0 -14px 30px rgba(0,0,0,.16);
}

.dtp-tile {
  position: relative;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: clamp(12px, 3vw, 18px);
  background: transparent;
  cursor: pointer;
  touch-action: none;
  transform: translateZ(0);
  transition: transform .12s ease, filter .12s ease, opacity .14s ease;
  padding: 0;
}

.dtp-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.30), rgba(255,255,255,.06));
  box-shadow: 0 7px 0 rgba(0,0,0,.22), 0 14px 22px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.38);
}

.dtp-tile.dtp-selected {
  transform: translateY(-4px) scale(1.06);
  filter: drop-shadow(0 0 14px rgba(255,207,74,.55));
  z-index: 3;
}

.dtp-tile.dtp-pop {
  animation: dtpPop .28s ease both;
}

.dtp-tile.dtp-bad {
  animation: dtpBad .22s ease both;
}

.dtp-face {
  position: relative;
  width: 76%;
  height: 76%;
  border-radius: 42% 42% 48% 48%;
  box-shadow: inset 0 8px 0 rgba(255,255,255,.22), inset 0 -8px 0 rgba(0,0,0,.10);
  z-index: 1;
}

.dtp-face::before,
.dtp-face::after {
  content: "";
  position: absolute;
  top: 34%;
  width: 13%;
  height: 17%;
  border-radius: 999px;
  background: rgba(24,20,35,.86);
  box-shadow: 0 1px 0 rgba(255,255,255,.25);
}

.dtp-face::before { left: 30%; }
.dtp-face::after { right: 30%; }

.dtp-mouth {
  position: absolute;
  left: 50%;
  top: 57%;
  width: 26%;
  height: 13%;
  transform: translateX(-50%);
  border-bottom: 3px solid rgba(30,20,28,.75);
  border-radius: 0 0 999px 999px;
}

.dtp-ear {
  position: absolute;
  top: -11%;
  width: 28%;
  height: 28%;
  border-radius: 999px;
  background: inherit;
  box-shadow: inset 0 4px 0 rgba(255,255,255,.18);
}

.dtp-ear.left { left: 8%; }
.dtp-ear.right { right: 8%; }

.dtp-nose {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 16%;
  height: 12%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(44,31,42,.72);
}

.dtp-type-0 .dtp-face { background: linear-gradient(180deg, #d8b48a, #a77755); }
.dtp-type-1 .dtp-face { background: linear-gradient(180deg, #8be36c, #3ca958); }
.dtp-type-2 .dtp-face { background: linear-gradient(180deg, #9fd8ff, #4f8edb); }
.dtp-type-3 .dtp-face { background: linear-gradient(180deg, #ff9bc9, #d94c91); }
.dtp-type-4 .dtp-face { background: linear-gradient(180deg, #ffb45e, #e06a2f); }

.dtp-type-0::before { background: linear-gradient(180deg, rgba(255,243,214,.90), rgba(213,151,94,.90)); }
.dtp-type-1::before { background: linear-gradient(180deg, rgba(211,255,179,.90), rgba(64,176,83,.90)); }
.dtp-type-2::before { background: linear-gradient(180deg, rgba(209,242,255,.90), rgba(75,132,222,.90)); }
.dtp-type-3::before { background: linear-gradient(180deg, rgba(255,221,238,.94), rgba(221,82,151,.90)); }
.dtp-type-4::before { background: linear-gradient(180deg, rgba(255,220,155,.92), rgba(225,100,45,.90)); }

.dtp-type-1 .dtp-face { border-radius: 46% 46% 42% 42%; }
.dtp-type-1 .dtp-mouth { border-bottom: 0; border-top: 3px solid rgba(30,20,28,.65); border-radius: 999px 999px 0 0; top: 62%; }
.dtp-type-2 .dtp-face { border-radius: 48% 48% 40% 40%; }
.dtp-type-3 .dtp-face { border-radius: 52% 52% 45% 45%; }
.dtp-type-4 .dtp-face { border-radius: 40% 40% 52% 52%; }

.dtp-combo-pop {
  position: absolute;
  left: 50%;
  top: 14%;
  transform: translateX(-50%);
  min-width: 118px;
  text-align: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,207,74,.96);
  color: #201500;
  font-weight: 950;
  letter-spacing: -.04em;
  z-index: 5;
  animation: dtpFloat .7s ease both;
  pointer-events: none;
}

.dtp-bottom-guide {
  min-height: 46px;
  display: grid;
  place-items: center;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid var(--dtp-line);
  background: rgba(0,0,0,.18);
  color: var(--dtp-muted);
  font-size: clamp(12px, 3.2vw, 15px);
  line-height: 1.25;
  text-align: center;
}

.dtp-cover,
.dtp-result {
  justify-content: center;
  align-items: stretch;
  gap: 16px;
  text-align: center;
}

.dtp-brand-mark {
  align-self: center;
  width: clamp(92px, 26vw, 140px);
  height: clamp(92px, 26vw, 140px);
  border-radius: 34px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 35% 26%, rgba(255,255,255,.55), transparent 18%),
    linear-gradient(180deg, #ffcf4a, #ff8e3d);
  box-shadow: 0 20px 50px rgba(0,0,0,.32), inset 0 2px 0 rgba(255,255,255,.34);
  color: #201500;
  font-weight: 1000;
  font-size: clamp(38px, 12vw, 58px);
  letter-spacing: -.08em;
}

.dtp-title {
  margin: 0;
  font-size: clamp(36px, 11vw, 58px);
  line-height: .92;
  letter-spacing: -.08em;
  font-weight: 1000;
}

.dtp-subtitle {
  margin: 0 auto;
  max-width: 330px;
  color: var(--dtp-muted);
  font-size: clamp(14px, 3.8vw, 18px);
  line-height: 1.45;
  letter-spacing: -.03em;
}

.dtp-menu-card,
.dtp-score-card,
.dtp-rank-card {
  border: 1px solid var(--dtp-line);
  border-radius: var(--dtp-radius);
  background: var(--dtp-panel);
  backdrop-filter: blur(14px);
  padding: 16px;
}

.dtp-menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.dtp-mini-stat {
  padding: 10px 8px;
  border-radius: 16px;
  background: rgba(0,0,0,.18);
}

.dtp-mini-stat b {
  display: block;
  font-size: clamp(17px, 5vw, 23px);
  letter-spacing: -.05em;
}

.dtp-mini-stat span {
  display: block;
  margin-top: 4px;
  color: var(--dtp-muted);
  font-size: 11px;
}

.dtp-btn {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffda62, #ff9f37);
  color: #231600;
  font-weight: 950;
  font-size: clamp(16px, 4.3vw, 20px);
  letter-spacing: -.04em;
  box-shadow: 0 9px 0 rgba(109,52,0,.6), 0 18px 30px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.55);
  cursor: pointer;
  touch-action: manipulation;
}

.dtp-btn:active {
  transform: translateY(5px);
  box-shadow: 0 4px 0 rgba(109,52,0,.6), 0 12px 22px rgba(0,0,0,.20), inset 0 1px 0 rgba(255,255,255,.55);
}

.dtp-btn-secondary {
  background: linear-gradient(180deg, #e8edff, #aab9ff);
  color: #111827;
  box-shadow: 0 9px 0 rgba(45,53,103,.65), 0 18px 30px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.55);
}

.dtp-score-card strong {
  display: block;
  font-size: clamp(44px, 14vw, 72px);
  line-height: 1;
  font-weight: 1000;
  letter-spacing: -.08em;
  color: var(--dtp-accent);
  font-variant-numeric: tabular-nums;
}

.dtp-score-card span {
  display: block;
  margin-top: 6px;
  color: var(--dtp-muted);
}

.dtp-rank-card {
  text-align: left;
}

.dtp-rank-card h2 {
  margin: 0 0 10px;
  font-size: clamp(18px, 4.6vw, 24px);
  letter-spacing: -.05em;
}

.dtp-rank-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
}

.dtp-rank-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(0,0,0,.18);
  font-variant-numeric: tabular-nums;
}

.dtp-rank-list li.dtp-new-record {
  outline: 2px solid rgba(255,207,74,.75);
  background: rgba(255,207,74,.16);
}

.dtp-hidden {
  display: none !important;
}

@keyframes dtpPop {
  0% { transform: scale(1); opacity: 1; }
  45% { transform: scale(1.22) rotate(-4deg); opacity: 1; }
  100% { transform: scale(.2); opacity: 0; }
}

@keyframes dtpBad {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

@keyframes dtpFloat {
  0% { opacity: 0; transform: translate(-50%, 16px) scale(.88); }
  18% { opacity: 1; transform: translate(-50%, 0) scale(1.04); }
  100% { opacity: 0; transform: translate(-50%, -38px) scale(.96); }
}

@keyframes dtpPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@media (min-width: 900px) {
  .dtp-app {
    border-radius: 30px;
  }
}

@media (max-height: 680px) {
  .dtp-screen { padding-top: calc(10px + var(--dtp-safe-top)); padding-bottom: calc(10px + var(--dtp-safe-bottom)); }
  .dtp-topbar { min-height: 52px; }
  .dtp-bottom-guide { min-height: 36px; padding: 7px 10px; }
}
