* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: radial-gradient(circle at top, #1b2a41 0%, #0d1420 70%);
  color: #eaf2ff;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#appRoot {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

/* ---------- roulette ---------- */
.roulette {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.roulette-window {
  overflow: hidden;
  height: 56px;
  border-radius: 14px;
  background: #0a1220;
  border: 2px solid #2b3c56;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.6);
}

.roulette-track {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.roulette-track li {
  height: 56px;
  line-height: 56px;
  font-size: 1.1rem;
  font-weight: 700;
}

.spin-btn {
  margin-top: 14px;
  border: none;
  border-radius: 12px;
  padding: 12px 22px;
  font-size: 1rem;
  font-weight: 800;
  background: #2f7fbf;
  color: #fff;
  cursor: pointer;
}

.spin-btn:active {
  transform: scale(0.96);
}

.spin-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.roulette-result {
  margin-top: 10px;
  font-size: 0.95rem;
  color: #9fd3ff;
  min-height: 1.2em;
}

/* ---------- room layout ---------- */
.room {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 44px;
}

.room[hidden] {
  display: none;
}

/* ---------- indoor unit ---------- */
.unit {
  width: min(400px, 82vw);
}

.unit-body {
  background: linear-gradient(180deg, #f5f9ff 0%, #d9e6f5 100%);
  border-radius: 24px;
  padding: 26px 28px 36px;
  color: #1b2a41;
  box-shadow: 0 24px 40px rgba(0, 0, 0, 0.4);
  position: relative;
}

.unit.indoor .unit-body::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 20px;
  right: 20px;
  height: 12px;
  background: #eef4fb;
  border-radius: 6px 6px 0 0;
}

.unit-screen {
  background: #0e1c2c;
  color: #6ef0c0;
  font-weight: 700;
  font-size: 1.2rem;
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
  width: fit-content;
  margin-bottom: 20px;
}

.dot-sep {
  opacity: 0.5;
}

.power-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #55606f;
  display: inline-block;
  margin-right: 4px;
}

.power-dot.on {
  background: #4dff9e;
  box-shadow: 0 0 8px #4dff9e;
}

.vents {
  height: 84px;
  border-radius: 12px;
  background: #c3d3e6;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  overflow: hidden;
}

.airline {
  width: 4px;
  height: 54px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 2px;
  opacity: 0;
  transform: translateY(-26px);
}

.unit-body.running .airline {
  animation: blow 1.1s ease-in-out infinite;
}

.unit-body.running .airline:nth-child(2) { animation-delay: 0.15s; }
.unit-body.running .airline:nth-child(3) { animation-delay: 0.3s; }

@keyframes blow {
  0%   { opacity: 0; transform: translateY(-16px); }
  40%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(18px); }
}

/* ---------- outdoor unit ---------- */
.unit.outdoor .unit-body {
  background: linear-gradient(180deg, #cfd6dd 0%, #9aa4af 100%);
  color: #1b2a41;
}

.fan-grille {
  width: 132px;
  height: 132px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: repeating-conic-gradient(#4b5563 0deg 4deg, #6b7280 4deg 12deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.5);
}

.fan-blade {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background:
    linear-gradient(0deg, transparent 46%, #1f2937 46% 54%, transparent 54%),
    linear-gradient(60deg, transparent 46%, #1f2937 46% 54%, transparent 54%),
    linear-gradient(120deg, transparent 46%, #1f2937 46% 54%, transparent 54%);
}

.unit-body.running .fan-blade {
  animation: spin 1.4s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- remote ---------- */
.remote {
  width: 168px;
  transition: transform 0.6s cubic-bezier(0.6, -0.2, 0.8, 0.2), opacity 0.6s ease;
}

.remote-body {
  background: linear-gradient(180deg, #2b3648 0%, #171f2c 100%);
  border-radius: 22px;
  padding: 16px 14px;
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.4), inset 0 0 0 2px #0a0f18;
}

.remote-screen {
  background: #0a1220;
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
  margin-bottom: 14px;
  min-height: 66px;
}

.temp-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #eaf6ff;
}

.wind-value {
  font-size: 0.85rem;
  color: #9fd3ff;
  margin-top: 2px;
}

.cooldown-badge {
  margin-top: 4px;
  font-size: 0.72rem;
  color: #ffb454;
  min-height: 1.1em;
}

.remote-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 0;
  font-size: 1rem;
  font-weight: 700;
  background: #3b4a63;
  color: #eaf2ff;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}

.btn:active {
  transform: scale(0.94);
}

.btn-power {
  grid-column: 1 / -1;
  background: #d94f4f;
}

.btn-wind {
  grid-column: 1 / -1;
  background: #2f7fbf;
}

.btn.warn {
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.remote-feet {
  display: none;
  justify-content: center;
  gap: 20px;
  font-size: 1.3rem;
  margin-top: 4px;
}

.remote.running .remote-feet {
  display: flex;
  animation: waddle 0.25s ease-in-out infinite;
}

.remote.running {
  animation: runAway 0.9s ease-in forwards;
}

@keyframes waddle {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-3px) rotate(4deg); }
}

@keyframes runAway {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(220px, 40px) rotate(12deg); opacity: 0; }
}

.remote.hidden-gone {
  visibility: hidden;
}

/* ---------- ban panel ---------- */
.ban-panel {
  width: 100%;
  max-width: 420px;
  text-align: center;
  background: #241621;
  border: 1px solid #7a3e5a;
  border-radius: 14px;
  padding: 18px 20px;
}

.ban-message {
  font-weight: 800;
  color: #ffb4d0;
  margin: 0 0 4px;
}

.ban-sub {
  margin: 0 0 10px;
  color: #d7a8c0;
  font-size: 0.9rem;
}

.ban-timer {
  margin: 0;
  font-variant-numeric: tabular-nums;
  color: #ffe0ef;
}

/* ---------- sound toggle ---------- */
.mute-btn {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 60;
  border: none;
  border-radius: 999px;
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
  background: rgba(16, 24, 37, 0.85);
  color: #eaf2ff;
  cursor: pointer;
}

/* ---------- mobile: force landscape ---------- */
/* #appRoot (not html/body) gets rotated, so these stay outside the transform
   and remain correctly fixed to the real, unrotated screen */
.rotate-overlay {
  display: none;
}

.rotate-card {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  background: rgba(16, 24, 37, 0.92);
  border: 1px solid #2f7fbf;
  border-radius: 14px;
  padding: 10px 16px;
  text-align: center;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.rotate-icon {
  font-size: 1.3rem;
}

.rotate-card p {
  margin: 0;
  font-size: 0.8rem;
  color: #eaf2ff;
}

.rotate-card button {
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  font-weight: 700;
  font-size: 0.75rem;
  background: #2f7fbf;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

@media screen and (max-width: 900px) and (orientation: portrait) {
  /* force-rotate just the app content into landscape via CSS, no gesture needed;
     html/body stay untransformed so fixed UI (rotate banner, mute button) stays put */
  body {
    overflow: hidden;
  }

  #appRoot {
    transform: rotate(90deg);
    transform-origin: left top;
    width: 100vh;
    height: 100vw;
    position: absolute;
    top: 100%;
    left: 0;
  }

  .rotate-overlay {
    display: block;
  }
}

@media screen and (min-width: 901px), screen and (orientation: landscape) {
  .rotate-overlay {
    display: none;
  }
}
