@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@500;700;800;900&display=swap');

* {
  box-sizing: border-box;
}

:root {
  --bg-gradient: linear-gradient(135deg, #fceae6 0%, #f7d6d0 50%, #fbe8d8 100%);
  --panel-bg: rgba(255, 251, 247, 0.88);
  --panel-border: #f0c2bd;
  --panel-border-soft: #f7d5d1;
  --text-main: #5a484c;
  --text-muted: #9e8286;
  --accent-gold: #e5a338;
  --accent-rose: #ea9094;
  --accent-rose-hover: #e37b80;
  --accent-rose-dark: #cc5d63;
  --card-bg: #fff8f6;
  --card-hover: #fff0ed;
}

.patreon-badge {
  width: 50px;
  height: 35px;
  object-fit: contain;
  cursor: pointer;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg-gradient);
  color: var(--text-main);
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button,
select,
input {
  touch-action: manipulation;
}

body {
  display: grid;
  place-items: center;
  position: relative;
}

/* Кнопка сброса прогресса в верхнем углу экрана */
.reset-btn-top {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 100;
  background: rgba(255, 255, 255, 0.8);
  border: 1.5px solid var(--panel-border);
  border-radius: 12px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.reset-btn-top:hover {
  background: #fff;
  color: var(--accent-rose-dark);
  border-color: var(--accent-rose);
  transform: translateY(-1px);
}

.game-shell {
  width: min(1200px, 96vw);
  height: min(720px, 94vh);
  padding: 20px 24px 16px;
  position: relative;
  border: 3px solid var(--panel-border);
  border-radius: 28px;
  background-color: #fcf3f0;
  box-shadow: 0 20px 50px rgba(160, 105, 110, 0.25), inset 0 0 40px rgba(255, 255, 255, 0.6);
  transition: background 0.35s ease;
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 56px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.gold-panel {
  min-width: 220px;
  height: 50px;
  padding: 6px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--panel-border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 15px rgba(220, 150, 150, 0.15);
}

.gold-icon {
  color: var(--accent-gold);
  font-size: 24px;
  filter: drop-shadow(0 2px 4px rgba(229, 163, 56, 0.3));
}

.gold-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gold-value {
  font-size: 20px;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1;
}

.gold-rate {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  margin-left: auto;
}

.bg-switch {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-195px, -50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--accent-rose);
  background: #ffffff;
  box-shadow: 0 3px 8px rgba(234, 144, 148, 0.3);
  cursor: pointer;
  transition: all 0.2s ease;
}

.bg-switch:hover {
  transform: translate(-195px, -50%) scale(1.1);
  background: #fceae6;
}

.game-area {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 290px 1fr 310px;
  gap: 20px;
}

.panel {
  border: 2px solid var(--panel-border);
  border-radius: 24px;
  background: var(--panel-bg);
  box-shadow: 0 10px 25px rgba(180, 120, 125, 0.08);
  backdrop-filter: blur(8px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel h2 {
  margin: 14px 0 10px;
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

/* --- ПАНЕЛЬ СПОСОБНОСТЕЙ --- */
.abilities-panel {
  padding: 0 12px 14px;
}

.ability-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
  padding-right: 2px;
}

/* --- КАРТОЧКА СПОСОБНОСТИ --- */
.ability {
  min-height: 86px;
  border: 2px solid var(--panel-border-soft);
  border-radius: 18px;
  background: var(--card-bg);
  color: var(--text-main);
  position: relative;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
  display: grid;
  grid-template-columns: 1fr 60px;
  align-items: stretch;
  overflow: hidden;
}

.ability:hover {
  border-color: var(--accent-rose);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(234, 144, 148, 0.15);
}

.ability-main {
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 10px;
  align-items: center;
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
  font-family: inherit;
}

.ability-main:hover {
  background: rgba(234, 144, 148, 0.06);
}

.ability-main:active {
  transform: scale(0.98);
}

.ability-main:disabled {
  cursor: default;
  opacity: 0.65;
}

.ability-main.is-active {
  background: rgba(229, 163, 56, 0.12);
  box-shadow: inset 0 0 12px rgba(229, 163, 56, 0.1);
}

.ability-main.is-cooldown {
  background: rgba(0, 0, 0, 0.02);
  opacity: 0.6;
}

.ability-icon {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 2px solid var(--accent-rose);
  overflow: hidden;
  background: var(--panel-border-soft);
  flex-shrink: 0;
}

.ability-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ability-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.ability-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ability-status {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-rose-dark);
  line-height: 1.1;
}

.ability-desc {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.2;
  margin-top: 1px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ability-upgrade {
  align-self: stretch;
  min-width: 60px;
  border: 0;
  border-left: 2px solid var(--panel-border-soft);
  background: #fdf0ed;
  color: var(--accent-rose-dark);
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: all 0.2s ease;
}

.ability-upgrade:hover:not(:disabled) {
  background: var(--accent-rose);
  color: #ffffff;
}

.ability-upgrade:active:not(:disabled) {
  background: var(--accent-rose-hover);
}

.ability-upgrade:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.5;
  background: #f7ece9;
}

/* --- СЕКЦИЯ ПЕРСОНАЖА --- */
.character-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  position: relative;
  padding: 10px 0;
}

.character-stage {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  user-select: none;
}

.character-placeholder {
  position: relative;
  width: 220px;
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease;
  transform: scale(1.8);
}

.character-placeholder:active {
  transform: scale(1.7);
}

.character-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 10px 20px rgba(150, 90, 100, 0.18));
}

.character-img.is-locked {
  filter: brightness(0) drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
}

.skin-lock {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid var(--panel-border);
  padding: 14px 20px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  z-index: 10;
  backdrop-filter: blur(6px);
}

.lock-icon {
  font-size: 28px;
  line-height: 1;
}

.lock-price {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
}

.buy-skin-btn {
  border: 0;
  border-radius: 10px;
  background: var(--accent-rose);
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 12px;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.buy-skin-btn:hover:not(:disabled) {
  background: var(--accent-rose-hover);
}

.buy-skin-btn:disabled {
  background: #e0d0cd;
  color: #9c8a87;
  cursor: not-allowed;
}

.skins-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 276px;
  padding: 8px 16px;
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  border-radius: 20px;
  box-shadow: 0 8px 20px rgba(180, 120, 125, 0.12);
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.skins-wrapper:hover {
  border-color: var(--accent-rose);
  box-shadow: 0 10px 24px rgba(234, 144, 148, 0.2);
}

.skins {
  display: flex;
  gap: 12px;
  align-items: center;
}

.skin {
  width: 16px;
  height: 16px;
  border: 2px solid var(--panel-border-soft);
  border-radius: 50%;
  background: #ffffff;
  padding: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.skin.locked {
  opacity: 0.5;
}

.skin:hover {
  transform: scale(1.2);
  border-color: var(--accent-rose);
}

.skin.active {
  border-color: var(--accent-rose-dark);
  background: var(--accent-rose);
  transform: scale(1.25);
  box-shadow: 0 0 8px rgba(234, 144, 148, 0.5);
}

.skin-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
  text-align: center;
  white-space: nowrap;
}

/* --- ПАНЕЛЬ МАГАЗИНА --- */
.shop-panel {
  padding: 0 14px 14px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border: 2px solid var(--panel-border-soft);
  border-radius: 14px;
  overflow: hidden;
  background: #f7ece9;
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
  margin-bottom: 10px;
}

.tab {
  height: 34px;
  background: transparent;
  color: var(--text-muted);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  transition: all 0.2s ease;
}

.tab.active {
  color: var(--accent-rose-dark);
  background: #ffffff;
  box-shadow: 0 3px 8px rgba(180, 120, 125, 0.12);
}

.shop-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  padding: 2px 4px 6px 2px;
}

/* --- Выделение предметов при наведении --- */
.shop-item,
.background-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid var(--panel-border-soft);
  border-radius: 16px;
  box-sizing: border-box;
  transition: all 0.2s ease;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
}

.shop-item:hover,
.background-item:hover {
  background: var(--card-hover);
  border-color: var(--accent-rose);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(234, 144, 148, 0.18);
}

.shop-item.purchased {
  cursor: default;
  opacity: 0.8;
}

.shop-item.purchased:hover {
  transform: none;
  border-color: var(--panel-border-soft);
  box-shadow: none;
  background: rgba(255, 255, 255, 0.85);
}

/* Крупная иконка */
.item-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--panel-border-soft);
  border-radius: 14px;
  background: #ffffff;
  overflow: hidden;
  flex-shrink: 0;
  pointer-events: none;
}

.item-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Блок с текстом */
.item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  pointer-events: none;
}

.item-info strong {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  white-space: normal;
  word-break: break-word;
}

.item-info small {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.3;
  white-space: normal;
  word-break: break-word;
}

/* Кнопка покупки */
.buy,
.select-bg {
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--accent-rose);
  color: #ffffff;
  font-family: inherit;
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(234, 144, 148, 0.25);
  transition: all 0.2s ease;
  pointer-events: none;
}

.buy:disabled,
.select-bg:disabled {
  background: #e8d7d4;
  color: #b09a97;
  box-shadow: none;
}

.shop-item .buy:disabled {
  background: #d1c7c5;
  color: #7d6e6c;
}

/* Увеличенные карточки фонов */
.background-item {
  min-height: 84px;
  padding: 12px 14px;
  justify-content: space-between;
}

.bg-item-content {
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.bg-item-content strong {
  font-size: 14px;
  font-weight: 800;
}

.bg-preview {
  width: 88px;
  height: 56px;
  border-radius: 10px;
  border: 1.5px solid var(--panel-border-soft);
  background-size: cover;
  background-position: center;
  pointer-events: none;
  flex-shrink: 0;
}

/* Скроллбары */
.shop-list::-webkit-scrollbar,
.ability-list::-webkit-scrollbar {
  width: 5px;
}

.shop-list::-webkit-scrollbar-track,
.ability-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.03);
  border-radius: 10px;
}

.shop-list::-webkit-scrollbar-thumb,
.ability-list::-webkit-scrollbar-thumb {
  background: rgba(216, 91, 115, 0.4);
  border-radius: 10px;
}

.shop-list::-webkit-scrollbar-thumb:hover,
.ability-list::-webkit-scrollbar-thumb:hover {
  background: rgba(216, 91, 115, 0.7);
}

/* Анимация всплывающего текста */
.floating-texts {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1000;
}

.float {
  position: absolute;
  transform: translate(-50%, -50%);
  color: #ff3385;
  font-size: 28px;
  font-weight: 900;
  -webkit-text-stroke: 1px #ffffff;
  text-shadow: 0 0 10px rgba(255, 51, 133, 0.8);
  animation: floatUp 0.6s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.5);
  }

  30% {
    transform: translate(-50%, -70px) scale(1.3);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -120px) scale(1);
  }
}

.hidden {
  display: none !important;
}

@media (max-width: 960px) {
  .game-shell {
    width: 98vw;
    height: 98vh;
    padding: 12px;
  }

  .game-area {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    overflow-y: auto;
  }

  .abilities-panel,
  .shop-panel {
    max-height: 250px;
  }
}

/* Контейнер кнопок в верхнем углу */
.top-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  gap: 10px;
}

.reset-btn-top,
.audio-btn-top {
  position: static;
  background: rgba(255, 255, 255, 0.8);
  border: 1.5px solid var(--panel-border);
  border-radius: 12px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.reset-btn-top:hover,
.audio-btn-top:hover {
  background: #fff;
  color: var(--accent-rose-dark);
  border-color: var(--accent-rose);
  transform: translateY(-1px);
}

/* Модальное окно настроек */
.settings-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.settings-content {
  background: var(--panel-bg);
  border: 3px solid var(--panel-border);
  border-radius: 24px;
  padding: 20px 24px;
  width: 320px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

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

.settings-header h2 {
  margin: 0;
  font-size: 18px;
  color: var(--text-main);
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.close-btn:hover {
  color: var(--accent-rose-dark);
}

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-item label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
}

.setting-item input[type="range"] {
  width: 100%;
  accent-color: var(--accent-rose);
  cursor: pointer;
}

.settings-select {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--panel-border-soft);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-select:hover,
.settings-select:focus {
  border-color: var(--accent-rose);
}

/* Модальное окно просмотра фотографий */
.photo-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.photo-modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.photo-modal-content img {
  max-width: 90vw;
  max-height: 70vh;
  border-radius: 16px 16px 0 0;
  border: 3px solid var(--panel-border);
  border-bottom: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  object-fit: contain;
}

/* Диалоговое окно снизу */
.photo-dialog-box {
  width: 100%;
  max-width: 90vw;
  min-height: 70px;
  background: var(--panel-bg);
  border: 3px solid var(--panel-border);
  border-radius: 0 0 16px 16px;
  padding: 12px 18px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

.photo-dialog-box p {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.4;
}

.photo-dialog-box p::after {
  content: "❚";
  margin-left: 4px;
  color: var(--accent-rose-dark);
  animation: blink 0.7s infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

.close-photo-btn {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--panel-border);
  color: var(--text-main);
  font-size: 24px;
  font-weight: bold;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
  z-index: 10;
}

.close-photo-btn:hover {
  background: var(--accent-rose);
  color: #ffffff;
  transform: scale(1.1);
}

@media (max-width: 600px) {

  html,
  body {
    min-height: 100%;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body {
    display: block;
  }

  .game-shell {
    width: 100%;
    min-height: 100dvh;
    height: auto;
    padding: 68px 10px 16px;
    border-width: 0;
    border-radius: 0;
  }

  .top-controls {
    top: 12px;
    right: 10px;
    left: 10px;
    justify-content: space-between;
  }

  .reset-btn-top,
  .audio-btn-top {
    min-height: 42px;
    padding: 8px 12px;
  }

  .topbar {
    height: auto;
    margin-bottom: 14px;
  }

  .gold-panel {
    width: min(100%, 320px);
    min-width: 0;
    height: 56px;
    padding: 6px 14px;
  }

  .game-area {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(330px, 48vh) auto;
    gap: 14px;
    overflow: visible;
  }

  .abilities-panel,
  .shop-panel {
    max-height: none;
    min-height: 0;
  }

  .abilities-panel {
    padding-bottom: 10px;
  }

  .ability-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    overflow: visible;
  }

  .ability {
    min-height: 76px;
  }

  .character-section {
    min-height: 330px;
    padding: 0;
  }

  .character-stage {
    min-height: 270px;
  }

  .character-placeholder {
    transform: scale(1.25);
  }

  .character-placeholder:active {
    transform: scale(1.18);
  }

  .skins-wrapper {
    width: min(276px, 90vw);
    min-height: 58px;
    padding: 8px 14px;
  }

  .shop-panel {
    min-height: 360px;
  }

  .shop-list {
    overflow: visible;
  }

  .shop-item,
  .background-item {
    min-height: 70px;
    padding: 10px;
  }

  .buy,
  .select-bg {
    min-height: 44px;
    max-width: 132px;
    padding: 0 10px;
    white-space: normal;
  }

  .settings-content {
    width: calc(100vw - 28px);
    max-width: 360px;
  }

  .photo-modal-content {
    width: calc(100vw - 24px);
    max-width: none;
  }

  .photo-modal-content img,
  .photo-dialog-box {
    max-width: 100%;
  }

  .close-photo-btn {
    top: -10px;
    right: -4px;
  }
}

@media (orientation: landscape) and (max-height: 600px) {

  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  body {
    display: block;
  }

  .game-shell {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    padding: 8px;
    border-width: 0;
    border-radius: 0;
  }

  .top-controls {
    top: 8px;
    right: 8px;
    left: auto;
    gap: 6px;
  }

  .reset-btn-top,
  .audio-btn-top {
    min-height: 34px;
    padding: 5px 8px;
    font-size: 11px;
  }

  .topbar {
    height: 42px;
    margin: 0 0 6px;
    justify-content: flex-start;
  }

  .gold-panel {
    min-width: 180px;
    width: auto;
    height: 38px;
    padding: 4px 10px;
    gap: 6px;
  }

  .gold-icon {
    font-size: 18px;
  }

  .gold-value {
    font-size: 16px;
  }

  .gold-rate {
    font-size: 11px;
  }

  .game-area {
    height: calc(100dvh - 56px);
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(140px, 0.8fr) minmax(150px, 1fr) minmax(190px, 1.2fr);
    grid-template-rows: 1fr;
    gap: 8px;
    overflow: hidden;
  }

  .panel {
    min-height: 0;
    border-radius: 16px;
  }

  .panel h2 {
    margin: 8px 0 6px;
    font-size: 14px;
  }

  .abilities-panel,
  .shop-panel {
    max-height: none;
    padding: 0 7px 7px;
  }

  .ability-list,
  .shop-list {
    min-height: 0;
    overflow-y: auto;
    gap: 6px;
  }

  .ability {
    min-height: 64px;
    grid-template-columns: 1fr 48px;
    border-radius: 12px;
  }

  .ability-main {
    grid-template-columns: 34px 1fr;
    gap: 6px;
    padding: 6px;
  }

  .ability-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }

  .ability-name {
    font-size: 10px;
  }

  .ability-status,
  .ability-desc {
    font-size: 9px;
  }

  .ability-upgrade {
    min-width: 48px;
    font-size: 9px;
  }

  .character-section {
    min-height: 0;
    padding: 0;
  }

  .character-stage {
    min-height: 0;
  }

  .character-placeholder {
    transform: scale(0.82);
  }

  .character-placeholder:active {
    transform: scale(0.78);
  }

  .skins-wrapper {
    width: min(220px, 100%);
    min-height: 48px;
    padding: 5px 10px;
    border-radius: 14px;
  }

  .skins {
    gap: 9px;
  }

  .skin-name {
    font-size: 11px;
  }

  .shop-item,
  .background-item {
    min-height: 58px;
    gap: 6px;
    padding: 6px;
    border-radius: 11px;
  }

  .item-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
  }

  .item-info {
    gap: 1px;
  }

  .item-info strong,
  .item-info small {
    font-size: 9px;
  }

  .buy,
  .select-bg {
    min-height: 34px;
    max-width: 76px;
    padding: 0 5px;
    font-size: 9px;
  }

  .background-item {
    min-height: 64px;
  }

  .bg-item-content {
    gap: 6px;
  }

  .bg-preview {
    width: 54px;
    height: 38px;
  }
}