/* ===== Bootstrap button (인라인, 실행 버튼) ===== */
#tulzpark-bootstrap {
  max-width: 500px;
  margin: 40px auto;
  padding: 40px 24px;
  text-align: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #0a0a1e 100%);
  border: 2px solid #ffcc00;
  border-radius: 12px;
  box-shadow: 0 0 40px rgba(255, 204, 0, 0.2);
}
#tp-enter-btn {
  background: linear-gradient(to bottom, #33dd77, #1a9955);
  color: #fff;
  border: 2px solid #0a6633;
  border-radius: 10px;
  padding: 18px 40px;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 0 #0a6633, 0 6px 12px rgba(0,0,0,0.5);
  transition: all 0.08s;
  letter-spacing: 3px;
}
#tp-enter-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #0a6633;
}
.tp-bootstrap-hint {
  color: #888;
  font-size: 13px;
  margin-top: 18px;
}

/* ===== Fullscreen game (body 직속으로 이동됨) ===== */
body.tp-playing {
  overflow: hidden !important;
}

#tulzpark-game.tp-active {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  background: #05050f !important;
  color: #fff !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  touch-action: manipulation !important;
  z-index: 9999 !important;
}

/* ===== HUD ===== */
#tulzpark-game.tp-active .tp-hud {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 6px 10px;
  background: linear-gradient(to bottom, #0a0a1a, #050510);
  border-bottom: 2px solid #1a1a3a;
  font-size: 13px;
  flex-shrink: 0;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
#tulzpark-game.tp-active .tp-hud-item {
  padding: 3px 8px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  white-space: nowrap;
}
#tulzpark-game.tp-active .tp-money { color: #ffd700; text-shadow: 0 0 8px #ffd70066; }
#tulzpark-game.tp-active .tp-time { color: #66ccff; }
#tulzpark-game.tp-active .tp-rating { color: #ff9966; }
#tulzpark-game.tp-active .tp-combo {
  color: #ff3366;
  background: rgba(255,51,102,0.15);
  border: 1px solid #ff336666;
  animation: tp-combo-pulse 0.6s infinite alternate;
}
#tulzpark-game.tp-active .tp-exit {
  background: rgba(255,255,255,0.08);
  color: #ccc;
  border: 1px solid #444;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
#tulzpark-game.tp-active .tp-exit:active { background: rgba(255,255,255,0.2); }
@keyframes tp-combo-pulse {
  from { box-shadow: 0 0 4px #ff336666; transform: scale(1); }
  to   { box-shadow: 0 0 12px #ff3366; transform: scale(1.05); }
}

/* ===== Tower Canvas ===== */
#tulzpark-game.tp-active .tp-tower-wrap {
  flex: 1 1 auto;
  min-height: 260px;
  position: relative;
  background: #000;
  overflow: hidden;
}
#tulzpark-game.tp-active #tp-tower {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  image-rendering: -moz-crisp-edges;
}

/* ===== Queues ===== */
#tulzpark-game.tp-active .tp-queues {
  background: linear-gradient(to bottom, #0c0c1a, #080812);
  padding: 4px 8px;
  border-top: 1px solid #1a1a3a;
  border-bottom: 2px solid #1a1a3a;
  flex-shrink: 0;
  max-height: 110px;
  overflow-y: auto;
}
#tulzpark-game.tp-active .tp-queue-label {
  font-size: 10px;
  color: #888;
  margin: 3px 0 2px;
  font-weight: bold;
  letter-spacing: 0.5px;
}
#tulzpark-game.tp-active .tp-queue {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  min-height: 30px;
}
#tulzpark-game.tp-active .tp-queue::-webkit-scrollbar { height: 3px; }
#tulzpark-game.tp-active .tp-queue::-webkit-scrollbar-thumb { background: #444; border-radius: 2px; }
#tulzpark-game.tp-active .tp-empty { font-size: 11px; color: #555; padding: 6px 4px; font-style: italic; }
#tulzpark-game.tp-active .tp-car {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(to bottom, #2a2a4a, #1a1a2e);
  border: 1px solid #555;
  border-radius: 4px;
  padding: 4px 7px;
  flex-shrink: 0;
  font-size: 11px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  animation: tp-car-slide-in 0.3s ease-out;
}
@keyframes tp-car-slide-in {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}
#tulzpark-game.tp-active .tp-car-chip {
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 4px currentColor;
}
#tulzpark-game.tp-active .tp-plate-prefix { color: #888; font-size: 9px; font-weight: normal; font-family: monospace; }
#tulzpark-game.tp-active .tp-plate-suffix { color: #fff; font-size: 14px; font-weight: bold; font-family: monospace; letter-spacing: 1px; }
#tulzpark-game.tp-active .tp-type-tag { font-size: 10px; color: #aaa; font-style: italic; }
#tulzpark-game.tp-active .tp-floor-tag {
  background: #ffcc00; color: #000;
  padding: 1px 5px; border-radius: 2px;
  font-size: 10px; font-weight: bold;
}
#tulzpark-game.tp-active .tp-patience {
  width: 40px; height: 4px;
  background: #222; border-radius: 2px;
  overflow: hidden; margin-left: 2px;
}
#tulzpark-game.tp-active .tp-patience-bar { height: 100%; transition: width 0.2s, background 0.2s; }

/* ===== Console ===== */
#tulzpark-game.tp-active .tp-console {
  background: linear-gradient(to bottom, #080816, #030308);
  padding: 10px 8px;
  flex-shrink: 0;
  border-top: 3px solid #222;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.8);
}

/* LCD */
#tulzpark-game.tp-active .tp-lcd {
  background: #000;
  border-radius: 6px;
  padding: 3px;
  margin-bottom: 10px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.8), 0 0 0 2px #1a1a1a;
}
#tulzpark-game.tp-active .tp-lcd-inner {
  background: linear-gradient(to bottom, #0a2008, #0d2d0d);
  padding: 18px 14px 14px;
  border-radius: 4px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
#tulzpark-game.tp-active .tp-lcd-inner::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 2px,
    rgba(0,0,0,0.15) 3px
  );
  pointer-events: none;
}
#tulzpark-game.tp-active .tp-lcd-plate {
  display: block;
  font-family: 'Courier New', monospace;
  font-size: 42px;
  font-weight: bold;
  color: #6fff6f;
  letter-spacing: 0.3em;
  padding-left: 0.3em;
  line-height: 1.2;
  text-align: center;
  text-shadow: 0 0 6px #6fff6f, 0 0 12px #6fff6fcc;
}
#tulzpark-game.tp-active .tp-lcd-floor {
  display: block;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #ffaa66;
  text-shadow: 0 0 4px #ffaa66;
  margin-top: 6px;
  letter-spacing: 2px;
}

/* Keypad */
#tulzpark-game.tp-active .tp-pad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
#tulzpark-game.tp-active .tp-key {
  background: linear-gradient(to bottom, #4a4a5e, #2a2a3e);
  color: #fff;
  border: 1px solid #666;
  border-top-color: #888;
  border-radius: 6px;
  font-size: 22px;
  font-weight: bold;
  padding: 14px 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.06s, box-shadow 0.06s;
  font-family: inherit;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  box-shadow: 0 3px 0 #1a1a2e, 0 4px 6px rgba(0,0,0,0.4);
}
#tulzpark-game.tp-active .tp-key:active {
  background: linear-gradient(to bottom, #2a2a3e, #4a4a5e);
  transform: translateY(2px);
  box-shadow: 0 1px 0 #1a1a2e, 0 2px 3px rgba(0,0,0,0.3);
}
#tulzpark-game.tp-active .tp-key-back,
#tulzpark-game.tp-active .tp-key-clear {
  background: linear-gradient(to bottom, #7a3a3a, #4a2222);
  color: #ffcccc;
  box-shadow: 0 3px 0 #2a0a0a, 0 4px 6px rgba(0,0,0,0.4);
}
#tulzpark-game.tp-active .tp-key-back:active,
#tulzpark-game.tp-active .tp-key-clear:active {
  background: linear-gradient(to bottom, #4a2222, #7a3a3a);
  box-shadow: 0 1px 0 #2a0a0a, 0 2px 3px rgba(0,0,0,0.3);
}

/* Floor selector + keypad 가로 배치 */
#tulzpark-game.tp-active .tp-input-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
#tulzpark-game.tp-active .tp-input-row .tp-pad {
  flex: 1;
  margin-bottom: 0;
}
#tulzpark-game.tp-active .tp-floors {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
  width: 56px;
}
#tulzpark-game.tp-active .tp-floor {
  flex: 1;
  background: linear-gradient(to bottom, #2a2a44, #1a1a2e);
  color: #ccc;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 4px 2px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  transition: all 0.1s;
  box-shadow: 0 2px 0 #0a0a14;
  min-height: 0;
}
#tulzpark-game.tp-active .tp-floor:active { transform: translateY(1px); box-shadow: 0 1px 0 #0a0a14; }
#tulzpark-game.tp-active .tp-floor-selected {
  background: linear-gradient(to bottom, #ffdd33, #ffaa00);
  color: #000;
  border-color: #ffcc00;
  box-shadow: 0 0 12px #ffcc0088, 0 2px 0 #aa7700;
  animation: tp-floor-pulse 0.8s infinite alternate;
}
@keyframes tp-floor-pulse {
  from { box-shadow: 0 0 6px #ffcc0088, 0 2px 0 #aa7700; }
  to   { box-shadow: 0 0 16px #ffcc00, 0 2px 0 #aa7700; }
}
#tulzpark-game.tp-active .tp-floor-full {
  background: linear-gradient(to bottom, #3a1a1a, #2a0a0a);
  color: #664;
  border-color: #4a2a2a;
}

/* Call button */
#tulzpark-game.tp-active .tp-call {
  width: 100%;
  background: linear-gradient(to bottom, #ff5544, #cc2a1a);
  color: #fff;
  border: 2px solid #600;
  border-radius: 8px;
  padding: 18px 0;
  font-size: 22px;
  font-weight: bold;
  letter-spacing: 12px;
  padding-left: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 5px 0 #600, 0 6px 12px rgba(0,0,0,0.5);
  font-family: inherit;
  text-shadow: 0 2px 4px rgba(0,0,0,0.6);
  position: relative;
  transition: all 0.08s;
}
#tulzpark-game.tp-active .tp-call:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #600, 0 3px 6px rgba(0,0,0,0.4);
}
#tulzpark-game.tp-active .tp-call-light {
  display: inline-block;
  width: 10px; height: 10px;
  background: #ffdd88;
  border-radius: 50%;
  margin-right: 6px;
  box-shadow: 0 0 8px #ffdd88, inset 0 0 4px #fff;
  animation: tp-call-blink 1.5s infinite;
  vertical-align: middle;
}
@keyframes tp-call-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.3; }
}

/* ===== Overlay ===== */
#tulzpark-game.tp-active .tp-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center, rgba(20,20,50,0.92) 0%, rgba(0,0,0,0.95) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
#tulzpark-game.tp-active .tp-overlay-box {
  background: linear-gradient(to bottom, #1a1a2e, #0a0a1e);
  border: 2px solid #ffcc00;
  border-radius: 12px;
  padding: 28px 24px;
  max-width: 90%;
  width: 360px;
  text-align: center;
  box-shadow: 0 0 40px #ffcc0044, 0 20px 60px rgba(0,0,0,0.8);
  animation: tp-overlay-in 0.4s ease-out;
}
@keyframes tp-overlay-in {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
#tulzpark-game.tp-active .tp-overlay-box h2 {
  color: #ffcc00;
  margin: 0 0 4px 0;
  font-size: 28px;
  text-shadow: 0 0 12px #ffcc0088;
}
#tulzpark-game.tp-active .tp-tagline {
  color: #888;
  font-size: 12px;
  margin: 0 0 20px 0;
  letter-spacing: 1px;
}
#tulzpark-game.tp-active .tp-howto {
  color: #ddd;
  font-size: 13px;
  line-height: 1.9;
  margin: 12px 0;
  text-align: left;
  background: rgba(255,255,255,0.04);
  padding: 12px 16px;
  border-radius: 6px;
  border-left: 3px solid #ffcc00;
}
#tulzpark-game.tp-active .tp-howto strong { color: #ffdd66; }
#tulzpark-game.tp-active .tp-keys {
  color: #666;
  font-size: 10px;
  margin: 12px 0 0;
  font-family: monospace;
}
#tulzpark-game.tp-active #tp-overlay-btn {
  margin-top: 16px;
  background: linear-gradient(to bottom, #33dd77, #1a9955);
  color: #fff;
  border: 2px solid #0a6633;
  border-radius: 8px;
  padding: 14px 40px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  letter-spacing: 6px;
  font-family: inherit;
  box-shadow: 0 4px 0 #0a6633, 0 6px 12px rgba(0,0,0,0.5);
  transition: all 0.08s;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
#tulzpark-game.tp-active #tp-overlay-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #0a6633;
}
#tulzpark-game.tp-active .tp-summary {
  text-align: left;
  margin: 14px 0;
  background: rgba(0,0,0,0.3);
  border-radius: 6px;
  padding: 14px 18px;
}
#tulzpark-game.tp-active .tp-summary > div {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed #333;
  font-size: 14px;
}
#tulzpark-game.tp-active .tp-summary > div:last-child { border-bottom: none; }
#tulzpark-game.tp-active .tp-summary strong { color: #ffcc00; font-family: monospace; }

/* ===== Desktop landscape ===== */
@media (min-width: 900px) and (orientation: landscape) {
  #tulzpark-game.tp-active { flex-direction: row !important; flex-wrap: wrap !important; }
  #tulzpark-game.tp-active .tp-hud {
    position: absolute; top: 0; left: 0; right: 50%;
    z-index: 10;
    background: linear-gradient(to bottom, rgba(10,10,26,0.9), rgba(5,5,16,0.7));
    border-bottom: 1px solid #1a1a3a;
  }
  #tulzpark-game.tp-active .tp-tower-wrap {
    flex: 0 0 50%;
    max-height: 100vh;
    min-height: 100vh;
  }
  #tulzpark-game.tp-active .tp-queues {
    position: absolute;
    bottom: 0; left: 0; right: 50%;
    background: linear-gradient(to bottom, rgba(12,12,26,0.95), rgba(5,5,12,0.95));
    z-index: 10;
    max-height: 140px;
    overflow-y: auto;
  }
  #tulzpark-game.tp-active .tp-console {
    flex: 0 0 50%;
    max-width: 500px;
    overflow-y: auto;
    border-top: none;
    border-left: 3px solid #222;
    max-height: 100vh;
  }
  #tulzpark-game.tp-active .tp-lcd-plate { font-size: 56px; }
  #tulzpark-game.tp-active .tp-key { padding: 20px 0; font-size: 26px; }
}

/* ===== 모바일 세로모드 — 조작반 컴팩트 ===== */
@media (max-width: 900px), (max-height: 900px) and (orientation: portrait) {
  #tulzpark-game.tp-active .tp-console { padding: 5px 5px; }
  #tulzpark-game.tp-active .tp-lcd-inner { padding: 8px 12px 6px; }
  #tulzpark-game.tp-active .tp-lcd-plate { font-size: 30px; }
  #tulzpark-game.tp-active .tp-lcd-floor { font-size: 11px; margin-top: 2px; }
  #tulzpark-game.tp-active .tp-lcd { margin-bottom: 6px; }

  #tulzpark-game.tp-active .tp-input-row { gap: 4px; margin-bottom: 6px; }
  #tulzpark-game.tp-active .tp-pad { gap: 4px; }
  #tulzpark-game.tp-active .tp-key {
    padding: 9px 0;
    font-size: 17px;
    box-shadow: 0 2px 0 #1a1a2e, 0 3px 4px rgba(0,0,0,0.4);
  }
  #tulzpark-game.tp-active .tp-key-back,
  #tulzpark-game.tp-active .tp-key-clear {
    box-shadow: 0 2px 0 #2a0a0a, 0 3px 4px rgba(0,0,0,0.4);
  }
  #tulzpark-game.tp-active .tp-floors { width: 48px; gap: 3px; }
  #tulzpark-game.tp-active .tp-floor {
    padding: 2px 1px;
    font-size: 10px;
    box-shadow: 0 1px 0 #0a0a14;
  }
  #tulzpark-game.tp-active .tp-call {
    padding: 11px 0;
    font-size: 17px;
    letter-spacing: 9px;
    padding-left: 9px;
    box-shadow: 0 3px 0 #600, 0 4px 8px rgba(0,0,0,0.5);
  }
  #tulzpark-game.tp-active .tp-queues { max-height: 70px; padding: 3px 6px; }
  #tulzpark-game.tp-active .tp-queue-label { margin: 1px 0; }
  #tulzpark-game.tp-active .tp-queue { min-height: 26px; padding-bottom: 2px; }
  #tulzpark-game.tp-active .tp-hud { padding: 3px 6px; font-size: 11px; }
  #tulzpark-game.tp-active .tp-hud-item { padding: 2px 6px; }
}