@font-face {
    font-family: 'Eurostile';
    src: url('fonts/Eurostile/TTF/Eurostile-Reg.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Eurostile';
    src: url('fonts/Eurostile/TTF/Eurostile-RegObl.ttf') format('truetype');
    font-weight: normal;
    font-style: italic;
}

@font-face {
    font-family: 'Eurostile';
    src: url('fonts/Eurostile/TTF/Eurostile-Bol.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'Eurostile';
    src: url('fonts/Eurostile/TTF/Eurostile-BolObl.ttf') format('truetype');
    font-weight: bold;
    font-style: italic;
}

@font-face {
    font-family: 'Eurostile';
    src: url('fonts/Eurostile/TTF/Eurostile-Med.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'Eurostile';
    src: url('fonts/Eurostile/TTF/Eurostile-MedIta.ttf') format('truetype');
    font-weight: 500;
    font-style: italic;
}

@font-face {
    font-family: 'Eurostile';
    src: url('fonts/Eurostile/TTF/Eurostile-Hea.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
}

@font-face {
    font-family: 'Eurostile';
    src: url('fonts/Eurostile/TTF/Eurostile-HeaIta.ttf') format('truetype');
    font-weight: 900;
    font-style: italic;
}

@font-face {
    font-family: 'Eurostile';
    src: url('fonts/Eurostile/TTF/Eurostile-Bla.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
}

@font-face {
    font-family: 'Eurostile';
    src: url('fonts/Eurostile/TTF/Eurostile-BlaIta.ttf') format('truetype');
    font-weight: 900;
    font-style: italic;
}

@font-face {
    font-family: 'Eurostile Condensed';
    src: url('fonts/Eurostile/TTF/Eurostile Condenced/EurostileCon-Reg.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Eurostile Condensed';
    src: url('fonts/Eurostile/TTF/Eurostile Condenced/EurostileCon-RegIta.ttf') format('truetype');
    font-weight: normal;
    font-style: italic;
}

@font-face {
    font-family: 'Eurostile Condensed';
    src: url('fonts/Eurostile/TTF/Eurostile Condenced/EurostileCon-Hea.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
}

@font-face {
    font-family: 'Eurostile Condensed';
    src: url('fonts/Eurostile/TTF/Eurostile Condenced/EurostileCon-HeaIta.ttf') format('truetype');
    font-weight: 900;
    font-style: italic;
}

@font-face {
    font-family: 'Eurostile Extended';
    src: url('fonts/Eurostile/TTF/Eurostile Extended/Eurostile Extended-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Eurostile Extended';
    src: url('fonts/Eurostile/TTF/Eurostile Extended/Eurostile Extended-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'Eurostile Extended';
    src: url('fonts/Eurostile/TTF/Eurostile Extended/Eurostile Extended-Black.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
}

html {
  overflow-y: scroll;
}

body {
    font-family: 'Eurostile', sans-serif;
    margin: 0;
    /* padding: 20px; */
    background-color: #2E2E33;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    /* min-height: 100vh; */
    box-sizing: border-box;
}

/* Стили экранов */
.screen {
    display: none;
    /* flex-direction: column; */
    align-items: center;
    text-align: center;
    width: 100%;
    /* max-width: 900px; */
    background: #2E2E33;
    /* padding: 30px; */
    /* border-radius: 12px; */
    /* box-shadow: 0 4px 12px rgba(0,0,0,0.1); */
}

.screen h2 {
    font-size: 42px;
}

.screen.active {
    display: flex;
}

.screen_text-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
}

.sreen-slines {
    display: flex;
    flex-direction: column;
    gap: 20rem;
    position: absolute;
    top: -12rem;
    right: 0rem;
    /* z-index: 1; */
}

/* Кнопки */
.btn {
    font-family: 'Eurostile', sans-serif;
    background-color: #AE0018;
    color: white;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-inline: 134px;
    /* padding: 30px 134px; */
    /* border-radius: 8px; */
    /* font-size: 30px; */
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    margin-top: 20px;
}

.btn p {
    /* margin-bottom: 0px; */
    line-height: 0.8;
    font-size: 30px;
}

.btn:hover {
    background-color: #ae0017b2;
}
.btn:active {
    transform: scale(0.98);
}
.btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}
.btn-secondary {
    background-color: #AE0018;
}
.btn-secondary:hover {
    background-color: #ae0017b2;
}

#screen1.active {
    min-height: 100vh;
}

/* Экран 1: Главная */
#screen1 h1 {
    font-size: 5rem;
    margin-bottom: 20px;
    font-weight: 600;
}

#screen2 {
    padding-inline: 100px;
    flex-direction: column;
}

#screen2 .screen-nav {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
}

#screen2 .btn {
    margin-top: 0;
    padding: 19px 80px;
    font-size: 24px;
}

.hero-image-container {
    padding-inline: 100px;
    width: 770px;
    height: 880px;
    /* overflow: hidden; */
    /* border-radius: 8px; */
    margin-bottom: 20px;
    z-index: 5;
}
.hero-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Экран 2: Выбор картины */
.paintings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
    width: 100%;
    margin-top: 20px;
}
.painting-item {
    position: relative;
    cursor: pointer;
    /* Убираем рамку с самого контейнера */
    border: 3px solid transparent; 
    border: none; /* Это даже лучше, убирает рамку совсем */
    display: flex;
    flex-direction: column;
}

.painting-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* border-radius: 8px;  */
    
    /* Вот ключевое изменение: добавляем прозрачную рамку по умолчанию */
    /* border: 1px solid transparent; */
    transition: border-color 0.3s;
    box-sizing: border-box; /* Важно, чтобы рамка была внутри размеров элемента */
}

.painting-item.selected .item-image_block {
    border-color: #ffffff;
}

.item-image_block {
    border: 1px solid transparent;
    transition: border-color 0.3s;
    position: relative;
    height: 100%;
}

.item-transparent {
    position: absolute;
    width: 100%;
    height: 100%;
    background: black;
    opacity: 0;
    transition: all 0.3s;
}

.painting-item.selected .item-image_block .item-transparent {
    opacity: 0.6;
}

.painting-item h4 {
    margin: 8px 0 0 0; /* Отступ только сверху */
    font-size: 20px;
    font-weight: 400;
    text-align: center;
    color: #ffffff;
    line-height: 1.2;
}

.painting-item .checkmark {
    display: none;
    position: absolute;
    top: 0px;
    right: 0px;
    width: 100%;
    height: 100%;
    color: white;
    font-size: 20px;
    line-height: 30px;
    text-align: center;
}
.painting-item.selected .checkmark {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Экран 3: Веб-камера */
#screen3.active {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    height: 100%;
    /* gap: 20rem; */
}

.shot-main {
    display: flex;
}

#screen4.active {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    height: 100%;
}

#screen3 h2, #screen4 h2 {
    margin-bottom: 0px;
}

#screen3 h3, #screen4 h3 {
    font-weight: 400;
    font-size: 30px;
}

.shot-title {
    display: flex;
    flex-direction: column;
    align-items: start;
    width: 100%;
    padding-inline: 100px;
}

.shot-block {
    display: flex;
    min-height: 100vh;
}

.webcam-section {
    flex: 2;
    width: 100%;
}
.webcam-container {
    position: relative;
    width: 100%;
    background-color: #000;
    /* border-radius: 8px; */
    overflow: hidden;
}
#webcam {
    width: 100%;
    height: 560px;
    display: block;
    transform: scaleX(-1); /* Зеркальное отображение */
}
.webcam-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 70%;
    border: 3px dashed white;
    border-radius: 50%; /* Овальная рамка */
    pointer-events: none; /* Чтобы рамка не мешала кликам */
    display: flex;
    justify-content: center;
    align-items: flex-end;
}
.webcam-frame p {
    color: white;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 5px;
    margin-bottom: 10px;
    font-size: 14px;
}
.selection-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: start;
    background: #3E3E45;
    height: 100%;
}

.selection-info_wrapper {
    padding-inline: 100px;
    display: flex;
    flex-direction: column;
    align-items: start;
    padding-top: 84px;
}

.selection-info_wrapper h4 {
    font-size: 20px;
}

#change-painting-btn, #change-painting-btn-2 {
    background: none;
    border: 1px solid white;
    white-space: nowrap;
    padding-top: 16px;
    padding-bottom: 16px;
    font-size: 24px;
}

.selection-info img {
    height: 560px;
    object-fit: contain;
    width: 100%;
    /* max-width: 200px; */
    /* border-radius: 8px; */
    margin-top: 10px;
}
.selection-info h4 {
    margin-top: 10px;
    width: 100%;
    font-weight: 400;
    text-align: center;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    #screen3 {
        flex-direction: column;
    }
    .selection-info {
        margin-top: 20px;
        width: 100%;
    }
}


/* Экран 3: Кнопка "Сделать фото" */
#take-photo-btn {
    margin: auto;
    /* width: 100%; */
    margin-top: 15px;
    padding: 15px;
    font-size: 18px;
    background: none;
}

/* Экран 4: Предпросмотр */
#photo-preview {
    max-width: 100%;
    /* max-height: 50vh; */
    height: 560px;
    /* border-radius: 8px; */
    /* margin-bottom: 20px; */
    /* border: 1px solid #ddd; */
}

.button-group {
    margin: auto;
    display: flex;
    gap: 15px;
}

.button-group button {
    font-size: 24px;
    padding: 16px 110px;
    margin-bottom: 20px;
}

/* Экран 5: Результат */
#result-image {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Индикатор загрузки */
.loading-indicator {
    align-items: center;
    justify-content: center;
    flex-direction: column;
    /* display: flex; */
    width: 100%;
    height: 100%;
    position: absolute; 
    background-color: #0000008e;
    /* margin-top: 20px; */
    text-align: center;
}

.loading-indicator svg {
    fill: white;
}

.loading-indicator p {
    font-size: 1.3rem;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: #007bff;
    margin: 0 auto 10px;
    animation: spin 1s ease infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* Карточка для случайного образа */
.random-item {
    cursor: pointer;
    /* border: 1px solid transparent; */
    /* border-radius: 8px; */
    /* background: black; */
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    /* padding: 20px; */
    min-height: 150px; /* Чтобы соответствовать высоте картинок */
    box-sizing: border-box;
    transition: border-color 0.3s, transform 0.2s;
}

.random-item_block {
    width: 100%;
    height: 100%;
    border: 1px solid transparent;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s, transform 0.2s;
    /* border-radius: 8px; */
}

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

.random-item h4 {
    margin: 8px 0 0 0;
    font-size: 20px;
    font-weight: 400;
    text-align: center;
    color: #ffffff;
    line-height: 1.2;
}

.random-item.selected .random-item_block {
    border-color: #ffffff;
}

.random-item .icon {
    font-size: 40px;
    margin-bottom: 10px;
}

/* Поле для ввода промпта на 4-м экране */
.prompt-container {
    width: 100%;
    max-width: 500px;
    /* margin: 20px 0; */
    text-align: left;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
}
.prompt-container label {
    /* display: block; */
    margin-bottom: 8px;
    /* font-weight: bold; */
}
.prompt-container input {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border-radius: 6px;
    border: 1px solid #cccccc2e;
    box-sizing: border-box;
    background: transparent;
    color: aliceblue;
    outline: none;
}

.prompt-container input:active {
    outline: none;
}

#screen5.active {
    flex-direction: column;
}

#screen5 button {
    font-size: 30px;
    padding: 16px 120px;
}


/* style.css */

/* --- Стили для PTZ-управления --- */
.ptz-controls-container {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 10;
  display: none; /* Скрываем по умолчанию, покажем через JS если камера поддерживает */
}

.ptz-toggle-btn {
  background-color: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  padding: 0;
  color: white;
}

.ptz-toggle-btn:hover {
  background-color: rgba(0, 0, 0, 0.7);
}

.ptz-controls {
  display: none; /* Скрываем панель по умолчанию */
  position: absolute;
  top: 50px;
  right: 0;
  background-color: rgba(13, 13, 13, 0.9); /* #0D0D0D с прозрачностью */
  border: 1px solid #a9a9a9;
  border-radius: 8px;
  padding: 15px;
  width: 220px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Показываем панель, когда у родителя есть класс .open */
.ptz-controls-container.open .ptz-controls {
  display: block;
}

.ptz-control-group {
  margin-bottom: 15px;
}

.ptz-control-group label {
  display: block;
  font-size: 14px;
  color: #a9a9a9;
  margin-bottom: 8px;
}

/* Стилизация слайдера */
input[type="range"] {
  width: 100%;
  cursor: pointer;
}

.ptz-pan-tilt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.ptz-pan-tilt > div {
  display: flex;
  gap: 20px;
}

.ptz-btn {
  background: #333;
  color: white;
  border: 1px solid #555;
  border-radius: 4px;
  width: 40px;
  height: 30px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.ptz-btn:hover {
  background: #444;
}

.ptz-btn:disabled {
  background: #222;
  color: #555;
  cursor: not-allowed;
}

.btn-small {
  padding: 8px 12px;
  font-size: 14px;
  margin-top: 10px;
  width: 100%;
}




/* --- Стили для модального окна с QR-кодом --- */

.modal-overlay {
  /* Изначально скрыто */
  display: none; 
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.7);

  /* Центрирование содержимого */
  justify-content: center;
  align-items: center;
}

/* Добавляем класс 'active' для показа окна через JS */
.modal-overlay.active {
    display: flex;
}

.modal-content {
  background-color: #fefefe;
  color: #333;
  margin: auto;
  padding: 20px 40px 30px;
  border: 1px solid #888;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  text-align: center;
  position: relative;
  box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
}

.modal-content h3 {
    margin-top: 10px;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

#qr-code-container {
    margin-bottom: 20px;
}

#qr-code-image {
    width: 100%;
    max-width: 256px; /* Стандартный размер для QR */
    height: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
}

#qr-code-link {
    display: block;
    word-wrap: break-word; /* Перенос длинных ссылок */
    margin-top: 5px;
    color: #007bff;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 20px;
  color: #aaaaaa;
  font-size: 32px;
  font-weight: bold;
  background: none;
  border: none;
  cursor: pointer;
}

.close-btn:hover,
.close-btn:focus {
  color: #000;
  text-decoration: none;
}

.random-item_block {
  position: relative;
}

.badge-new {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #ff4444;
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  z-index: 1;
}


/* interiors styles */

/* Стили для настроек Дворца ASG */
.asg-settings-container {
    width: 100%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.05);
    /* border-radius: 16px; */
    padding: 20px;
    /* margin-top: 20px; */
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

#asg-settings-container .asg-header h3 {
    margin: 0;
    font-size: 24px;
}

.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.face-mode-toggle {
    padding-top: 20px;
    justify-content: center;
    margin-bottom: 12px;
}

/* Switch Toggle CSS */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #ae0018; /* Цвет золота под стиль */
}

input:focus + .slider {
    box-shadow: 0 0 1px #ae0018;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Interiors Grid */
.interiors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.interior-item {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    aspect-ratio: 1;
}

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

.interior-item.selected {
    border-color: #d1a96e;
    transform: scale(1.05);
}

/* --- Стили для переключателя качества (2K / 4K) --- */

.quality-selector {
    display: flex;
    gap: 10px; /* Чуть больше воздуха между кнопками */
    align-items: center;
}

.quality-option {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Eurostile', sans-serif;
    font-size: 22px; /* Чуть крупнее для удобства */
    color: rgba(255, 255, 255, 0.7); /* Текст чуть приглушен в неактивном состоянии */
    transition: color 0.3s ease;
    user-select: none;
}

/* При наведении текст становится белым */
.quality-option:hover {
    color: white;
}

/* Скрываем стандартный радио-баттон и рисуем свой */
.quality-option input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
    
    /* Размеры квадрата */
    width: 26px;
    height: 26px;
    
    /* Стиль рамки */
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 2px; /* Едва заметное скругление, чтобы не было "пиксельно", но оставалось квадратным */
    background-color: transparent;
    
    display: grid;
    place-content: center; /* Центрируем галочку внутри */
    
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Плавная анимация рамки */
}

/* Эффект при наведении на сам квадрат */
.quality-option:hover input[type="radio"] {
    border-color: white;
    background-color: rgba(255, 255, 255, 0.05);
}

/* --- АКТИВНОЕ СОСТОЯНИЕ (CHECKED) --- */

/* Меняем цвет рамки и фона на красный */
.quality-option input[type="radio"]:checked {
    border-color: #AE0018;
    background-color: #AE0018;
    box-shadow: 0 0 10px rgba(174, 0, 24, 0.4); /* Легкое свечение */
}

/* Делаем текст активного элемента белым и жирным */
.quality-option input[type="radio"]:checked + span {
    color: white;
}

/* --- ГАЛОЧКА (CHECKMARK) --- */

.quality-option input[type="radio"]::before {
    content: "";
    width: 6px;  /* Ширина галочки */
    height: 10px; /* Высота галочки */
    
    /* Рисуем галочку через border */
    border: solid white;
    border-width: 0 2px 2px 0; /* Толщина линий - 2px для аккуратности */
    
    /* Начальное положение для анимации (скрыто) */
    transform: rotate(45deg) scale(0);
    opacity: 0;
    
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Пружинистая анимация */
    margin-bottom: 3px; /* Небольшая коррекция по вертикали */
}

/* Появление галочки при выборе */
.quality-option input[type="radio"]:checked::before {
    transform: rotate(45deg) scale(1);
    opacity: 1;
}

/* Эффект нажатия (Scale Click) */
.quality-option input[type="radio"]:active {
    transform: scale(0.95);
}

/* Toast notifications */
#toast-container {
    position: fixed;
    top: 32px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: rgba(20, 20, 20, 0.92);
    color: #fff;
    padding: 14px 28px;
    border-radius: 12px;
    font-family: 'Eurostile', sans-serif;
    font-size: 15px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: toastIn 0.3s ease-out, toastOut 0.3s ease-in forwards;
    pointer-events: auto;
    text-align: center;
    max-width: 420px;
}

.toast--error {
    border-color: rgba(255, 80, 80, 0.4);
}

.toast--success {
    border-color: rgba(80, 200, 120, 0.4);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-16px); }
}

@media (orientation: portrait) {
    html,
    body {
        overflow-x: hidden;
    }

    body {
        align-items: stretch;
    }

    .screen {
        box-sizing: border-box;
    }

    .screen h2 {
        font-size: clamp(2.5rem, 4vw, 3.8rem);
    }

    .screen h3 {
        font-size: clamp(1.35rem, 2.3vw, 2.1rem);
    }

    .btn {
        min-height: 88px;
        padding-inline: clamp(40px, 8vw, 112px);
        font-size: clamp(1.1rem, 2vw, 1.6rem);
        box-sizing: border-box;
    }

    .btn p {
        font-size: clamp(1.6rem, 2.6vw, 2.4rem);
    }

    #screen1.active {
        flex-direction: column;
        justify-content: center;
        gap: 32px;
        padding: clamp(40px, 5vw, 72px) clamp(28px, 5vw, 56px) clamp(64px, 6vw, 96px);
        min-height: 100vh;
        text-align: center;
    }

    .hero-image-container {
        width: min(100%, 860px);
        height: auto;
        aspect-ratio: 4 / 5;
        padding-inline: 0;
        margin: 0 auto;
    }

    .hero-image-container img {
        object-fit: cover;
    }

    .screen_text-content {
        width: min(100%, 900px);
        margin: 0 auto;
    }

    .screen_text-content img {
        width: min(100%, 340px);
        height: auto;
    }

    #screen1 h1 {
        font-size: clamp(3rem, 6vw, 5rem);
        line-height: 1.05;
        max-width: 14ch;
        margin: 0 auto;
    }

    .sreen-slines {
        top: -4rem;
        right: 0;
        gap: 10rem;
        width: min(18vw, 180px);
        opacity: 0.28;
        pointer-events: none;
    }

    .sreen-slines img {
        width: 100%;
        height: auto;
    }

    #screen2 {
        padding: clamp(24px, 4vw, 48px);
        gap: 20px;
        min-height: 100vh;
        box-sizing: border-box;
    }

    #screen2 .screen-nav {
        position: sticky;
        top: 0;
        z-index: 20;
        padding-block: 12px 18px;
        gap: 16px;
        flex-wrap: wrap;
        background: linear-gradient(180deg, rgba(46, 46, 51, 0.98) 0%, rgba(46, 46, 51, 0.92) 100%);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    #screen2 .screen-nav h2 {
        margin: 0;
        text-align: left;
        max-width: 18ch;
    }

    #screen2 .btn {
        margin-left: auto;
        padding: 18px 42px;
    }

    .paintings-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
        gap: clamp(16px, 2vw, 24px);
        max-width: 1600px;
        margin: 0 auto;
    }

    .paintings-grid > * {
        min-width: 0;
    }

    .item-image_block,
    .random-item_block {
        aspect-ratio: 3 / 4;
    }

    .painting-item img,
    .event-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .painting-item h4,
    .random-item h4 {
        font-size: clamp(1.05rem, 1.6vw, 1.35rem);
        line-height: 1.25;
        margin-top: 12px;
    }

    #screen3.active,
    #screen4.active {
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        min-height: 100vh;
        height: auto;
    }

    .shot-main {
        flex-direction: column;
        gap: 28px;
    }

    .shot-title {
        width: 100%;
        padding: clamp(24px, 3vw, 48px);
        box-sizing: border-box;
        align-items: center;
    }

    .shot-title > h2,
    .shot-title > h3 {
        text-align: center;
        width: min(100%, 980px);
    }

    .webcam-section {
        width: 100%;
        max-width: 1200px;
        margin: 0 auto;
    }

    .webcam-container {
        width: 100%;
        max-width: 1200px;
        height: clamp(560px, 48vh, 1320px);
        margin: 0 auto;
        border-radius: 28px;
        box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    }

    #webcam {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    #photo-preview {
        width: 100%;
        height: 100%;
        object-fit: contain;
        background: #000;
    }

    #screen4 .webcam-container {
        height: clamp(520px, 44vh, 1200px);
    }

    .webcam-frame {
        width: min(72%, 680px);
        height: min(78%, 980px);
        border-width: 4px;
    }

    .face-mode-toggle {
        padding-top: 16px;
        margin-bottom: 12px;
        font-size: clamp(1rem, 1.8vw, 1.4rem);
    }

    #take-photo-btn {
        margin-top: 16px;
    }

    #take-photo-btn svg {
        width: clamp(112px, 12vw, 156px);
        height: auto;
    }

    .shot-block {
        min-height: auto;
        width: 100%;
    }

    .selection-info {
        width: 100%;
        height: auto;
    }

    .selection-info_wrapper {
        width: 100%;
        max-width: 1200px;
        margin: 0 auto;
        padding: clamp(28px, 4vw, 48px);
        display: grid;
        grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
        grid-template-areas:
            "title title"
            "image name"
            "image action";
        gap: 20px 32px;
        align-items: center;
        box-sizing: border-box;
    }

    .selection-info_wrapper > h3 {
        grid-area: title;
        text-align: center;
        margin-inline: auto;
        margin-bottom: 0;
    }

    .selection-info_wrapper > h4 {
        grid-area: name;
        width: 100%;
        text-align: left;
        margin: 0;
    }

    .selection-info img {
        grid-area: image;
        width: min(100%, 360px);
        height: auto;
        max-height: 360px;
        margin-top: 0;
    }

    #change-painting-btn,
    #change-painting-btn-2 {
        grid-area: action;
        justify-self: start;
        width: min(100%, 420px);
        justify-content: center;
        font-size: clamp(1.1rem, 1.8vw, 1.5rem);
    }

    .button-group {
        width: 100%;
        max-width: 1200px;
        margin: 28px auto 0;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .button-group button {
        width: 100%;
        min-height: 88px;
        margin: 0;
        padding: 18px 24px;
        font-size: clamp(1.15rem, 2vw, 1.6rem);
    }

    .prompt-container,
    .asg-settings-container {
        width: min(100%, 1200px);
        max-width: none;
        margin: 0 auto;
        padding: 24px;
        box-sizing: border-box;
    }

    #screen4 .prompt-container,
    #screen4 .asg-settings-container {
        padding: 18px 20px;
    }

    .prompt-container input {
        min-height: 56px;
        font-size: 18px;
    }

    .asg-header {
        gap: 16px;
        flex-wrap: wrap;
    }

    .toggle-wrapper {
        flex-wrap: wrap;
        justify-content: center;
    }

    .quality-selector {
        flex-wrap: wrap;
    }

    #screen5.active {
        min-height: 100vh;
        padding: clamp(32px, 4vw, 56px);
        box-sizing: border-box;
        justify-content: flex-start;
        align-items: center;
        gap: 18px;
    }

    #screen5 h2 {
        margin: 0;
        text-align: center;
    }

    #result-image {
        width: min(100%, 1200px);
        max-height: min(68vh, 2200px);
        object-fit: contain;
        margin-bottom: 8px;
    }

    #screen5 button {
        width: min(100%, 520px);
        min-height: 88px;
        padding: 18px 28px;
        font-size: clamp(1.2rem, 2vw, 1.8rem);
        margin-top: 0;
    }

    .modal-content {
        width: min(92vw, 720px);
        max-width: 720px;
        padding: 32px 40px 40px;
        box-sizing: border-box;
    }

    .modal-content h3 {
        font-size: clamp(1.4rem, 2.4vw, 2rem);
    }

    #qr-code-image {
        max-width: min(62vw, 420px);
    }

    #qr-code-link {
        font-size: 1rem;
    }

    #toast-container {
        top: 24px;
        width: min(100%, 760px);
        padding-inline: 16px;
        box-sizing: border-box;
    }

    .toast {
        width: 100%;
        font-size: 1rem;
        box-sizing: border-box;
    }
}

@media (orientation: portrait) and (max-width: 900px) {
    #screen2 .screen-nav {
        justify-content: center;
    }

    #screen2 .btn {
        width: 100%;
        margin-left: 0;
    }

    .paintings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .button-group {
        grid-template-columns: 1fr;
    }

    .selection-info_wrapper {
        display: flex;
        flex-direction: column;
    }

    .selection-info_wrapper > h4,
    #change-painting-btn,
    #change-painting-btn-2 {
        width: min(100%, 420px);
        text-align: center;
        justify-self: auto;
    }
}

@media (orientation: portrait) and (max-width: 640px) {
    .paintings-grid {
        grid-template-columns: 1fr;
    }

    .webcam-container {
        height: clamp(460px, 44vh, 760px);
    }

    .selection-info img {
        max-height: 360px;
    }

    .modal-content {
        padding-inline: 24px;
    }
}
