@font-face {
  font-family: 'GameFont';
  src: url('../assets/fonts/Comfortaa-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: 'GameFont';
  src: url('../assets/fonts/Comfortaa-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  height: var(--app-height, 100%);
  overflow: hidden;
  touch-action: manipulation;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: none;
  font-family: 'GameFont', 'Comfortaa', 'Segoe UI', Arial, sans-serif;
  background: #1a1a2e;
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: var(--app-height, 100%);
  touch-action: none;
  outline: none;
}

#ui-root {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: var(--app-height, 100%);
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
}

/* --- Screen system --- */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s;
  display: flex;
  flex-direction: column;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* --- Loading screen --- */
.loading-screen {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  justify-content: center;
  align-items: center;
  color: #fff;
}

.loading-screen .spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

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

.loading-screen .loading-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
}

/* --- Buttons --- */
.btn {
  pointer-events: auto;
  touch-action: manipulation;
  min-height: 48px;
  min-width: 48px;
  padding: 12px 32px;
  border: none;
  border-radius: 16px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.btn-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: rgba(255,255,255,0.9);
  color: #2d1b69;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.btn-icon {
  padding: 8px;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  font-size: 22px;
  background: rgba(255,255,255,0.85);
  color: #2d1b69;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  touch-action: manipulation;
  pointer-events: auto;
  border: none;
  cursor: pointer;
}

.btn-icon.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
}

/* --- Gameplay HUD --- */
.gameplay-hud {
  pointer-events: none !important;
  justify-content: space-between;
}

.gameplay-hud > * {
  pointer-events: auto;
}

.hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(8px, env(safe-area-inset-top)) 12px 8px;
  gap: 8px;
}

.hud-top-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-top-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.timer-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.4);
  border-radius: 20px;
  padding: 4px 12px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}

.timer-bar .timer-fill {
  width: 80px;
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
  overflow: hidden;
}

.timer-bar .timer-fill-inner {
  height: 100%;
  background: #4ade80;
  border-radius: 3px;
  transition: width 0.3s linear;
}

.timer-bar .timer-fill-inner.warning {
  background: #fbbf24;
}

.timer-bar .timer-fill-inner.danger {
  background: #ef4444;
}

.coins-display {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0,0,0,0.4);
  border-radius: 20px;
  padding: 4px 10px;
  color: #ffd700;
  font-size: 14px;
  font-weight: 700;
}

.coins-display .coin-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffd700;
  box-shadow: inset -2px -2px 0 #b8860b;
}

/* --- Bottom toolbar --- */
.hud-bottom {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 12px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  touch-action: manipulation;
}

.tool-bar {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.tool-btn {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: rgba(255,255,255,0.85);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s;
  pointer-events: auto;
  touch-action: manipulation;
}

.tool-btn:active {
  transform: scale(0.92);
}

.tool-btn.active {
  border-color: #764ba2;
  background: linear-gradient(135deg, #e0c3fc, #cfdef3);
  box-shadow: 0 0 10px rgba(118, 75, 162, 0.3);
}

.tool-btn.locked {
  opacity: 0.4;
  pointer-events: none;
}

.tool-btn svg {
  width: 30px;
  height: 30px;
}

.tool-btn .lock-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  background: #ef4444;
  border-radius: 50%;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

/* --- Color palette --- */
.color-palette {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 4px 0;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.6);
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s;
  pointer-events: auto;
}

.color-swatch:active {
  transform: scale(0.9);
}

.color-swatch.active {
  border-color: #2d1b69;
  transform: scale(1.15);
  box-shadow: 0 0 8px rgba(45, 27, 105, 0.4);
}

.color-swatch.locked {
  opacity: 0.3;
  pointer-events: none;
}

/* --- Done button --- */
.done-bar {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* --- Client request card --- */
.client-card {
  position: absolute;
  top: 56px;
  right: 12px;
  width: 110px;
  background: rgba(255,255,255,0.95);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.15);
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.2s;
  z-index: 5;
}

.client-card:active {
  transform: scale(1.05);
}

.client-card .client-name {
  font-size: 13px;
  font-weight: 700;
  color: #2d1b69;
  text-align: center;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-card .client-preview {
  width: 90px;
  min-height: 50px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f0e6ff, #e8dff5);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 600;
  color: #5a3e8e;
  text-align: center;
  line-height: 1.3;
}

.client-card .client-preview .style-icon {
  font-size: 22px;
  margin-bottom: 3px;
}

.preview-3d-btn {
  display: inline-block;
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 14px;
  cursor: pointer;
  margin-top: 4px;
  line-height: 1;
}
.preview-3d-btn:active {
  background: #4f46e5;
}
.cat-preview-btn {
  margin-top: 6px;
  padding: 4px 10px;
  font-size: 12px;
}

.client-card .client-type {
  font-size: 10px;
  color: #888;
  text-align: center;
  margin-top: 6px;
  font-weight: 600;
}

.client-card .client-color-req {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 10px;
  color: #666;
}

.client-card .client-color-req .color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.1);
}

/* --- Hairstyle Catalog Modal --- */
.catalog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: var(--app-height, 100%);
  background: rgba(0,0,0,0.6);
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s, visibility 0.3s;
}

.catalog-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.catalog-panel {
  background: #fff;
  border-radius: 20px;
  padding: 20px;
  max-width: 420px;
  width: 92%;
  max-height: 80%;
  max-height: min(80%, calc(var(--app-height, 100vh) - 40px));
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  overflow: hidden;
}

.catalog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.catalog-title {
  font-size: 20px;
  font-weight: 700;
  color: #2d1b69;
}

.catalog-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}

.catalog-tab {
  flex: 1;
  padding: 8px 6px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(0,0,0,0.05);
  color: #5a3e8e;
  border: 2px solid transparent;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s;
  pointer-events: auto;
  touch-action: manipulation;
}

.catalog-tab.active {
  background: linear-gradient(135deg, #764ba2, #667eea);
  color: #fff;
  box-shadow: 0 2px 8px rgba(118,75,162,0.3);
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
  padding: 4px;
  flex: 1;
  min-height: 0;
}

.catalog-grid::-webkit-scrollbar { display: none; }

.catalog-item {
  background: linear-gradient(135deg, #f8f4ff, #efe8fa);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
  transition: transform 0.1s;
}

.catalog-item .cat-icon {
  font-size: 28px;
  margin-bottom: 4px;
}

.catalog-item .cat-name {
  font-size: 12px;
  font-weight: 700;
  color: #2d1b69;
  margin-bottom: 3px;
}

.catalog-item .cat-desc {
  font-size: 10px;
  color: #777;
  line-height: 1.3;
}

.catalog-item .cat-zones {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-top: 5px;
}

.catalog-item .zone-bar {
  width: 10px;
  border-radius: 2px;
  background: #c4b5e0;
  min-height: 4px;
}

.catalog-item .cat-color {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.1);
  margin-top: 4px;
}

/* --- Result screen --- */
.result-screen {
  background: rgba(0,0,0,0.6);
  justify-content: center;
  align-items: center;
  gap: 16px;
}

.result-panel {
  background: #fff;
  border-radius: 24px;
  padding: 32px 24px;
  text-align: center;
  max-width: 340px;
  width: 90%;
  max-height: min(90%, calc(var(--app-height, 100vh) - 24px));
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.result-panel .result-title {
  font-size: 24px;
  font-weight: 700;
  color: #2d1b69;
  margin-bottom: 12px;
}

.stars-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.star {
  width: 36px;
  height: 36px;
  font-size: 32px;
  line-height: 36px;
  opacity: 0.2;
  transition: opacity 0.3s, transform 0.3s;
}

.star.earned {
  opacity: 1;
  animation: starPop 0.4s ease;
}

@keyframes starPop {
  0% { transform: scale(0); }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.result-coins {
  font-size: 22px;
  font-weight: 700;
  color: #ffa500;
  margin-bottom: 8px;
}

.result-tip {
  font-size: 14px;
  color: #666;
  margin-bottom: 20px;
}

.result-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.btn-rewarded {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1a1a2e;
  font-size: 15px;
}

.btn-rewarded .reward-detail {
  font-size: 11px;
  opacity: 0.8;
}

/* --- Shop screen --- */
.shop-screen {
  background: linear-gradient(180deg, #f5f0ff 0%, #ede4f7 100%);
}

.shop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255,255,255,0.6);
  border-bottom: 1px solid rgba(118,75,162,0.1);
}

.shop-title {
  font-size: 22px;
  font-weight: 700;
  color: #2d1b69;
}

.shop-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 16px 8px;
  justify-content: center;
}

.shop-tab {
  flex: 1;
  padding: 10px 8px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  background: rgba(255,255,255,0.7);
  color: #5a3e8e;
  border: 2px solid transparent;
  cursor: pointer;
  pointer-events: auto;
  text-align: center;
  transition: background 0.2s, border-color 0.2s;
}

.shop-tab.active {
  background: linear-gradient(135deg, #764ba2, #667eea);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(118,75,162,0.3);
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 10px 14px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
  align-content: start;
}

.shop-grid::-webkit-scrollbar {
  display: none;
}

.shop-item {
  background: #fff;
  border-radius: 16px;
  padding: 14px 8px 10px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  pointer-events: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  aspect-ratio: 1;
  justify-content: center;
}

.shop-item:active {
  transform: scale(0.93);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.shop-item .item-icon {
  font-size: 36px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
}

.shop-item .item-icon svg {
  width: 40px;
  height: 40px;
}

.coin-svg {
  vertical-align: middle;
  margin-left: 2px;
}

.shop-item .color-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.8);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.shop-item .item-name {
  font-size: 12px;
  font-weight: 700;
  color: #2d1b69;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-item .item-price {
  font-size: 13px;
  font-weight: 700;
}

.shop-item .item-price .price-tag {
  color: #f59e0b;
}

.shop-item .item-price .owned-badge {
  color: #22c55e;
  font-size: 12px;
}

.shop-item.owned {
  opacity: 0.6;
  background: #f8f8f8;
}

@media (min-width: 420px) {
  .shop-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* --- Toast notifications --- */
.toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Mobile auto-hide toggle --- */
.ui-toggle-btn {
  position: fixed;
  bottom: max(8px, env(safe-area-inset-bottom));
  right: 8px;
  z-index: 20;
  pointer-events: auto;
}

/* --- Responsive --- */
@media (orientation: landscape) and (max-height: 500px) {
  .hud-top {
    padding: 4px 8px;
  }
  .hud-bottom {
    padding: 4px 8px;
    gap: 4px;
  }
  .client-card {
    top: auto;
    bottom: 8px;
    right: 8px;
    width: 80px;
    padding: 6px;
    z-index: 6;
  }
  .client-card .client-preview {
    width: 64px;
    min-height: 36px;
    padding: 4px;
    font-size: 10px;
  }
  .client-card .client-name {
    font-size: 11px;
    margin-bottom: 3px;
  }
  .client-card .client-type {
    display: none;
  }
  .client-card .client-color-req {
    margin-top: 2px;
  }
  .tool-btn {
    width: 42px;
    height: 42px;
    font-size: 18px;
    border-radius: 10px;
  }
  .btn-done {
    padding: 8px 28px !important;
    font-size: 15px;
  }
  .timer-bar {
    font-size: 13px;
    padding: 3px 8px;
  }
  .timer-bar .timer-fill {
    width: 50px;
  }
  .catalog-panel {
    max-height: calc(var(--app-height, 100vh) - 16px);
    padding: 10px 14px;
    border-radius: 14px;
    width: 80%;
    max-width: 500px;
  }
  .catalog-header {
    margin-bottom: 6px;
  }
  .catalog-title {
    font-size: 16px;
  }
  .catalog-tabs {
    margin-bottom: 6px;
  }
  .catalog-tab {
    padding: 5px 4px;
    font-size: 12px;
  }
  .catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
  }
  .catalog-item .cat-icon {
    font-size: 22px;
  }
  .catalog-item .cat-name {
    font-size: 11px;
  }
  .catalog-item .cat-desc {
    display: none;
  }
  .catalog-item .cat-zones {
    margin-top: 3px;
  }
  .cat-preview-btn {
    font-size: 10px;
    padding: 2px 6px;
    margin-top: 3px;
  }
  .result-panel {
    padding: 16px 14px;
    border-radius: 16px;
    max-width: 300px;
  }
  .result-panel .result-title {
    font-size: 18px;
    margin-bottom: 6px;
  }
  .stars-row {
    gap: 4px;
    margin-bottom: 8px;
  }
  .star {
    width: 28px;
    height: 28px;
    font-size: 24px;
    line-height: 28px;
  }
  .result-coins {
    font-size: 18px;
    margin-bottom: 4px;
  }
  .result-tip {
    font-size: 12px;
    margin-bottom: 10px;
  }
  .result-buttons {
    gap: 6px;
  }
  .result-buttons .btn {
    min-height: 40px;
    padding: 8px 20px;
    font-size: 14px;
  }
  .btn-rewarded {
    font-size: 13px !important;
  }
  .toast {
    top: 40px;
    font-size: 13px;
    padding: 6px 14px;
  }
  .shop-screen .shop-header {
    padding: 4px 10px;
  }
  .shop-title {
    font-size: 18px;
  }
  .shop-tabs {
    padding: 4px 10px 4px;
    gap: 3px;
  }
  .shop-tab {
    padding: 6px 4px;
    font-size: 12px;
  }
  .shop-grid {
    gap: 6px;
    padding: 6px 10px;
  }
  .shop-item {
    padding: 8px 4px 6px;
    aspect-ratio: auto;
  }
  #rotate-screen .rotate-icon {
    font-size: 48px;
  }
  #rotate-screen .rotate-text {
    font-size: 18px;
  }
  #rotate-screen .rotate-hint {
    font-size: 12px;
  }
}

@media (max-width: 400px) {
  .tool-btn {
    width: 46px;
    height: 46px;
    font-size: 20px;
  }
  .color-swatch {
    width: 30px;
    height: 30px;
  }
  .catalog-panel {
    width: 96%;
    padding: 12px;
    max-height: 85%;
  }
  .catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
  }
  .catalog-item .cat-desc {
    display: none;
  }
  .shop-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 8px 10px;
  }
  .shop-item .item-icon {
    font-size: 28px;
    width: 40px;
    height: 40px;
  }
  .shop-item .item-name {
    font-size: 10px;
  }
  .shop-item .item-price {
    font-size: 11px;
  }
}

@media (max-width: 340px) {
  .tool-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
    border-radius: 10px;
  }
  .color-swatch {
    width: 26px;
    height: 26px;
  }
  .hud-top {
    padding: 4px 8px;
    gap: 4px;
  }
  .timer-bar {
    font-size: 13px;
    padding: 3px 8px;
  }
  .timer-bar .timer-fill {
    width: 50px;
  }
  .client-card {
    width: 90px;
    padding: 6px;
  }
  .client-card .client-name {
    font-size: 11px;
  }
  .client-card .client-preview {
    width: 72px;
    font-size: 10px;
  }
  .btn-done {
    padding: 8px 24px !important;
    font-size: 14px;
  }
  .shop-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Portrait lock (mobile only) --- */
#rotate-screen {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: var(--app-height, 100%);
  background: linear-gradient(135deg, #1a1a2e 0%, #2d1b69 100%);
  z-index: 10000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #fff;
  font-family: inherit;
}

#rotate-screen .rotate-icon {
  font-size: 64px;
  animation: rotatePhone 2s ease-in-out infinite;
}

#rotate-screen .rotate-text {
  font-size: 22px;
  font-weight: 700;
}

#rotate-screen .rotate-hint {
  font-size: 14px;
  opacity: 0.6;
  max-width: 240px;
  text-align: center;
  line-height: 1.4;
}

@keyframes rotatePhone {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(90deg); }
  50%, 75% { transform: rotate(90deg); }
}

@media (pointer: coarse) and (orientation: portrait) {
  #rotate-screen {
    display: flex;
  }
  #game-canvas,
  #ui-root {
    visibility: hidden;
    pointer-events: none;
  }
}

/* --- Scrollable containers --- */
.scrollable-container {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.scrollable-container::-webkit-scrollbar {
  display: none;
}
