
.dtr-shell,
.dtr-shell * {
  box-sizing: border-box;
}

.dtr-shell {
  width: 100%;
  margin: 0 auto;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
}

.dtr-loading {
  width: min(430px, calc(100vw - 24px));
  aspect-ratio: 9 / 16;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  border: 3px solid #171717;
  border-radius: 28px;
  background: linear-gradient(180deg, #fff4c6 0%, #eac889 46%, #8a5a35 100%);
  color: #171717;
  font-weight: 950;
}

.dtr-root {
  width: min(1280px, 100%);
  margin: 0 auto;
  min-height: 720px;
  padding: 28px 14px 34px;
  border-radius: 28px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 232, 104, 0.24) 0 9%, transparent 10%),
    radial-gradient(circle at 84% 18%, rgba(255, 190, 73, 0.22) 0 9%, transparent 10%),
    linear-gradient(135deg, #4d3425 0%, #201612 38%, #100b09 100%);
}

.dtr-root::before {
  content: "DOODI GOLD RUN";
  position: absolute;
  left: 36px;
  top: 40px;
  font-size: clamp(42px, 7vw, 96px);
  line-height: .88;
  max-width: 360px;
  font-weight: 950;
  letter-spacing: -.08em;
  color: rgba(255, 219, 95, .13);
  pointer-events: none;
}

.dtr-root::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0,0,0,.38), transparent 24%, transparent 76%, rgba(0,0,0,.38)),
    repeating-linear-gradient(115deg, rgba(255,255,255,.035) 0 2px, transparent 2px 22px);
  pointer-events: none;
}

.dtr-game {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.dtr-stage-wrap {
  width: min(430px, calc(100vw - 28px));
  aspect-ratio: 9 / 16;
  position: relative;
  overflow: hidden;
  border: 3px solid #171717;
  border-radius: 26px;
  background: #f8e0a5;
  box-shadow: 0 20px 0 rgba(0,0,0,.28), 0 26px 60px rgba(0,0,0,.45);
}

.dtr-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
  image-rendering: auto;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.dtr-hud {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 10px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  pointer-events: none;
}

.dtr-hud-card {
  min-width: 86px;
  padding: 7px 8px;
  border: 2px solid #171717;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  color: #171717;
  font-size: 13px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  box-shadow: 0 4px 0 rgba(0,0,0,.18);
}

.dtr-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(44, 26, 14, .12);
}

.dtr-overlay[hidden] {
  display: none !important;
}

.dtr-card {
  width: min(360px, 92%);
  max-height: calc(100% - 28px);
  overflow: auto;
  border: 3px solid #171717;
  border-radius: 26px;
  background: linear-gradient(180deg, #fffdf4 0%, #fff0c5 100%);
  box-shadow: 0 10px 0 rgba(0,0,0,.22);
  padding: 18px 16px 16px;
  text-align: center;
  color: #171717;
}

.dtr-kicker {
  display: inline-block;
  margin-bottom: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #171717;
  color: #fff;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .06em;
}

.dtr-hero-doodi {
  display: block;
  width: 150px;
  height: auto;
  margin: 0 auto 4px;
  filter: drop-shadow(0 8px 0 rgba(0,0,0,.14));
}

.dtr-result-doodi {
  display: block;
  width: 118px;
  height: auto;
  margin: 0 auto 4px;
  filter: drop-shadow(0 7px 0 rgba(0,0,0,.12));
}

.dtr-title {
  margin: 2px 0 8px;
  font-size: clamp(34px, 8vw, 48px);
  line-height: .92;
  letter-spacing: -.055em;
  font-weight: 800;
}

.dtr-subtitle {
  margin: 0 auto 16px;
  max-width: 310px;
  color: #5b4a32;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
  word-break: keep-all;
}

.dtr-help {
  margin-top: 10px;
  color: #6d5733;
  font-size: 12px;
  font-weight: 850;
}

.dtr-buttons,
.dtr-form {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.dtr-btn {
  appearance: none;
  border: 2px solid #171717;
  border-radius: 15px;
  background: #171717;
  color: #fff;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 950;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
  box-shadow: 0 5px 0 rgba(0,0,0,.2);
}

.dtr-btn.secondary {
  background: #fff;
  color: #171717;
}

.dtr-btn.gold {
  background: linear-gradient(180deg, #ffd84d 0%, #f6a71a 100%);
  color: #171717;
}

.dtr-btn:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 rgba(0,0,0,.2);
}

.dtr-result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 13px 0;
}

.dtr-result-item {
  border: 2px solid #171717;
  border-radius: 16px;
  padding: 9px 4px;
  background: #fff3cf;
}

.dtr-result-label {
  display: block;
  color: #735f39;
  font-size: 10px;
  font-weight: 950;
}

.dtr-result-value {
  display: block;
  margin-top: 4px;
  color: #171717;
  font-size: 18px;
  font-weight: 950;
}

.dtr-input {
  width: min(100%, 250px);
  border: 2px solid #171717;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 850;
  outline: 0;
  background: #fff;
  color: #171717;
}

.dtr-message {
  margin-top: 10px;
  min-height: 18px;
  color: #5b4a32;
  font-size: 13px;
  font-weight: 850;
}

.dtr-board {
  width: min(430px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.dtr-board-card {
  overflow: hidden;
  border: 3px solid #171717;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 10px 0 rgba(0,0,0,.2);
}

.dtr-board-title {
  padding: 14px 16px;
  background: linear-gradient(90deg, #171717 0%, #f1a80a 100%);
  color: #fff;
  font-size: 19px;
  font-weight: 950;
  letter-spacing: -.03em;
}

.dtr-rank-row {
  display: grid;
  grid-template-columns: 42px 1fr 74px;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  border-top: 1px solid rgba(23,23,23,.13);
  color: #171717;
  font-size: 14px;
}

.dtr-rank-row strong {
  font-weight: 950;
}

.dtr-rank-row small {
  display: block;
  margin-top: 2px;
  color: #6b5f45;
  font-size: 11px;
  font-weight: 800;
}

.dtr-rank-score {
  text-align: right;
  font-weight: 950;
}

.dtr-empty {
  padding: 16px;
  color: #6b5f45;
  font-weight: 850;
}

@media (min-width: 900px) {
  .dtr-board {
    width: min(860px, calc(100vw - 60px));
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .dtr-shell {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
  }

  .dtr-root {
    width: 100vw;
    min-height: 100svh;
    padding: 0 0 18px;
    border-radius: 0;
  }

  .dtr-root::before {
    display: none;
  }

  .dtr-game {
    gap: 14px;
  }

  .dtr-stage-wrap {
    width: min(100vw, calc(100svh * 9 / 16));
    max-width: 100vw;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    box-shadow: 0 8px 0 rgba(0,0,0,.18);
  }

  .dtr-overlay {
    align-items: flex-start;
    justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom));
  }

  .dtr-card {
    width: 90%;
    max-height: calc(100% - 24px);
    padding: 12px 11px 12px;
    border-radius: 20px;
  }

  .dtr-kicker {
    font-size: 10px;
    padding: 5px 10px;
    margin-bottom: 5px;
  }

  .dtr-hero-doodi {
    width: clamp(96px, 30vw, 128px);
  }

  .dtr-result-doodi {
    width: clamp(70px, 23vw, 92px);
  }

  .dtr-title {
    font-size: clamp(28px, 8.2vw, 38px);
  }

  .dtr-subtitle {
    max-width: 280px;
    font-size: 12px;
    line-height: 1.3;
    margin-bottom: 10px;
  }

  .dtr-btn {
    padding: 9px 10px;
    font-size: 12px;
  }

  .dtr-result-grid {
    gap: 5px;
    margin: 10px 0;
  }

  .dtr-result-item {
    padding: 7px 3px;
    border-radius: 13px;
  }

  .dtr-result-value {
    font-size: 14px;
  }

  .dtr-hud {
    top: 8px;
    left: 6px;
    right: 6px;
  }

  .dtr-hud-card {
    min-width: 74px;
    padding: 6px 7px;
    font-size: 11px;
  }

  .dtr-board {
    width: calc(100vw - 22px);
  }

  .dtr-board-title {
    padding: 12px 14px;
    font-size: 18px;
  }
}


@media (max-width: 760px) and (max-height: 740px) {
  .dtr-card {
    width: 92%;
    padding: 9px 9px 10px;
    border-radius: 18px;
  }
  .dtr-kicker {
    font-size: 9px;
    padding: 4px 9px;
    margin-bottom: 3px;
  }
  .dtr-hero-doodi { width: 92px; }
  .dtr-result-doodi { width: 62px; }
  .dtr-title { font-size: 29px; margin-bottom: 5px; }
  .dtr-subtitle { font-size: 11px; margin-bottom: 8px; }
  .dtr-result-grid { margin: 8px 0; }
  .dtr-input { padding: 9px 11px; font-size: 13px; }
  .dtr-help, .dtr-message { font-size: 11px; margin-top: 6px; }
}

/* v2.4 stability patch: no canvas blur on empty overlay */
.dtr-overlay:empty { display: none !important; }
@media (max-width: 480px) {
  .dtr-root { padding: 6px 4px 18px; border-radius: 0; min-height: auto; }
  .dtr-stage-wrap { width: min(430px, calc(100vw - 8px)); border-width: 2px; border-radius: 20px; }
  .dtr-hud { left: 8px; right: 8px; top: 8px; }
  .dtr-hud-card { min-width: 76px; padding: 6px 7px; font-size: 12px; }
  .dtr-overlay { padding: 8px; }
  .dtr-card { width: min(360px, 96%); padding: 14px 12px 14px; max-height: calc(100% - 16px); }
  .dtr-title { font-size: 34px; }
  .dtr-board { width: min(430px, calc(100vw - 8px)); }
}

