:root {
  --bg: #f5f1ea;
  --accent: #ffd86b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #2a2a3a;
  overflow: hidden;
}

#stage {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

#tabs-area {
  flex: 0 0 auto;
  display: flex;
  background: var(--bg);
  padding: 0 16px;
  gap: 4px;
}
.tab-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: #6a6558;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 120ms, border-color 120ms;
}
.tab-btn:hover:not(:disabled):not(.tab-active) {
  color: #2a2a3a;
}
.tab-btn.tab-active {
  color: #2a2a3a;
  border-bottom-color: #ffd86b;
}
.tab-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

#board-area {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
  color: #2a2a3a;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

#tab-gallery,
#tab-comic {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#tab-gallery[hidden],
#tab-comic[hidden] {
  display: none;
}

#hero-area {
  flex: 0 0 40%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  padding: 32px 24px;
}

#gallery-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: var(--bg);
  border-top: 1px solid #e0dbd1;
  padding: 16px 16px 20px;
  gap: 12px;
  overflow: hidden;
}

.gallery-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}
.gallery-placeholder {
  font-size: 13px;
  color: #9a958a;
  text-align: center;
}
.gallery-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.gallery-controls[hidden],
.gallery-image[hidden],
.gallery-placeholder[hidden] {
  display: none;
}
.gallery-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #d8d2c5;
  border-radius: 50%;
  background: #fff;
  color: #2a2a3a;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.gallery-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.gallery-counter {
  font-size: 13px;
  color: #6a6558;
  min-width: 48px;
  text-align: center;
}

.comic-page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  background: linear-gradient(180deg, #fbf8f1 0%, #f5f1ea 100%);
}

.comic-grid {
  max-width: 720px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.comic-frame {
  margin: 0;
  padding: 0;
  background: #fff;
  border: 2px solid #1a1a1a;
  border-radius: 2px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  position: relative;
}
.comic-frame-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Full-width — занимает обе колонки */
.comic-frame[data-variant="full"] {
  grid-column: 1 / -1;
  aspect-ratio: 16 / 10;
}

/* Half — занимает одну колонку */
.comic-frame[data-variant="half"] {
  aspect-ratio: 1 / 1;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

@keyframes blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95%           { transform: scaleY(0.1); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50%      { opacity: 0.8; transform: scale(1.1); }
}

/* bubble */
.bubble-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 32px;
  text-align: left;
  height: 100%;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}
.bubble-img {
  width: 280px;
  height: 280px;
  object-fit: contain;
  animation: bob 4s ease-in-out infinite;
  flex-shrink: 0;
  margin-right: -40px;
}
.bubble-say {
  position: relative;
  max-width: 320px;
  padding: 12px 18px;
  background: #ffffff;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.45;
  color: #3a3a4a;
  box-shadow: 0 2px 10px rgba(60, 50, 30, 0.08);
}
.bubble-say::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -8px;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 10px solid #ffffff;
}
