/* ============================================================
   Word Quest – style.css
   ============================================================ */

/* ── 1. Google Fonts & Root Variables ──────────────────────── */
:root {
  --font-main: 'Fredoka', 'Nunito', sans-serif;
  --chat-font-size: 1.25rem;
  --bot-message-font-size: 1.4rem;

  /* Palette */
  --green-dark:   #2d6a4f;
  --green-mid:    #40916c;
  --green-light:  #74c69d;
  --green-pale:   #d8f3dc;
  --brown-dark:   #5c3d11;
  --brown-mid:    #8b5e3c;
  --brown-light:  #c9956b;
  --cream:        #fef9ef;
  --warm-yellow:  #f9c74f;
  --gold:         #e9c46a;
  --orange:       #f4a261;
  --coral:        #e76f51;
  --sky:          #90e0ef;
  --ocean-dark:   #0077b6;
  --ocean-mid:    #00b4d8;

  /* UI */
  --card-radius:  20px;
  --btn-radius:   50px;
  --shadow-soft:  0 4px 24px rgba(0,0,0,0.10);
  --shadow-card:  0 8px 32px rgba(0,0,0,0.14);
  --shadow-float: 0 12px 40px rgba(0,0,0,0.18);
  --transition:   0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── 2. Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  font-family: var(--font-main);
  background: var(--cream);
  overflow: hidden;
}

/* ── 3. Screen System ──────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(20px);
  transition:
    opacity 0.4s ease,
    transform 0.4s ease,
    visibility 0s linear 0.4s;
  contain: layout paint style;
  z-index: 1;
}
.screen.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transform: translateY(0);
  transition-delay: 0s;
  z-index: 2;
}

/* Inactive screens used to keep their composited animations running behind the
   visible screen. Pause them as a safeguard in addition to hiding the screen. */
.screen:not(.active) *,
.screen:not(.active) *::before,
.screen:not(.active) *::after {
  animation-play-state: paused !important;
}

/* ── 4. Background Layers ──────────────────────────────────── */
.bg-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.bg-forest {
  background-image: url('../assets/elements/bg1.jpg');
  background-size: cover;
  background-position: center;
}
.bg-forest::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 249, 235, 0.32);
}
#screen-book-select .bg-forest::after {
  display: none;
}

/* ── 5. ════════════════════════════════════════════════════════
        SCREEN 1 – Book Selection
   ════════════════════════════════════════════════════════════ */
.select-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  padding: 0;
}

/* Header / Logo */
.select-header {
  display: none;
}
.logo-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255,255,255,0.96);
  border-radius: 24px;
  padding: 14px 32px;
  box-shadow: var(--shadow-card);
  border: 2px solid rgba(255,255,255,0.9);
}
.logo-icon { font-size: 2.8rem; }
.logo-text h1 {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--green-dark);
  line-height: 1;
  letter-spacing: -0.5px;
}
.logo-text p {
  font-size: 0.95rem;
  color: var(--brown-mid);
  font-weight: 500;
}

/* Select Body */
.select-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 100%;
  flex: 1;
  /* The supplied composition is 1920 × 1080 in CSS pixels.  Using the
     smaller viewport axis preserves that composition on other 16:9 sizes. */
	padding-top: min(11.979167vw, 21.296296vh);
}
.select-title {
  display: none;
}
.select-subtitle {
  display: none;
}

/* Book carousel */
.book-carousel {
  --book-card-width: min(22.1875vw, 39.444444vh);
  --book-card-gap: min(1.666667vw, 2.962963vh);
  --book-edge-space: min(1.5625vw, 2.777778vh);
  --book-nav-size: min(3.645833vw, 6.481481vh);
  --book-nav-gap: min(1.25vw, 2.222222vh);
  --book-viewport-width: calc(
    var(--book-card-width) + var(--book-card-width) + var(--book-card-width)
    + var(--book-card-gap) + var(--book-card-gap)
    + var(--book-edge-space) + var(--book-edge-space)
  );
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, var(--book-viewport-width)) auto;
  align-items: center;
  justify-content: center;
  column-gap: var(--book-nav-gap);
  width: 100%;
}

.book-viewport {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-block: min(0.625vw, 1.111111vh);
  scroll-behavior: smooth;
  scroll-padding-inline: var(--book-edge-space);
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.book-viewport::-webkit-scrollbar {
  display: none;
}

.book-viewport:focus-visible {
  outline: 3px solid rgba(255, 210, 74, 0.95);
  outline-offset: -3px;
}

.book-grid {
  display: flex;
	gap: var(--book-card-gap);
  justify-content: flex-start;
  align-items: stretch;
  flex-wrap: nowrap;
  width: max-content;
  min-width: 100%;
	padding-inline: var(--book-edge-space);
}

.book-card {
  background: linear-gradient(180deg, #fbf9ed 0%, #fbf7ec 100%);
	position: relative;
	border-radius: min(1.5625vw, 2.777778vh);
	padding:
		min(1.822917vw, 3.240741vh)
		min(1.822917vw, 3.240741vh)
		min(1.822917vw, 3.240741vh);
	width: var(--book-card-width);
	height: min(32.34375vw, 57.5vh);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
	cursor: default;
  border: 0;
  box-shadow: 0 min(0.416667vw, 0.740741vh) min(1.666667vw, 2.962963vh) rgba(54, 38, 20, 0.13);
  transition: var(--transition);
  text-decoration: none;
	overflow: visible;
	flex: 0 0 auto;
	scroll-snap-align: start;
}
.book-card:hover {
	box-shadow: var(--shadow-float);
}
.book-card[aria-disabled="true"] {
  cursor: wait;
}
.book-card[aria-disabled="true"] .book-play-btn {
  opacity: 0.5;
}

.book-cover {
  width: 100%;
  aspect-ratio: 4 / 3;
  flex: 0 0 auto;
  object-fit: cover;
	border-radius: min(1.041667vw, 1.851852vh);
  box-shadow: none;
  transition: transform 0.3s;
}
.book-card:hover .book-cover { transform: none; }

.book-info {
  width: 100%;
	margin-top: min(1.302083vw, 2.314815vh);
  text-align: center;
}
.book-name {
	font-size: min(1.458333vw, 2.592593vh);
  font-weight: 700;
  color: #461c06;
  line-height: min(1.875vw, 3.333333vh);
  white-space: nowrap;
}
.book-subtitle {
  margin-top: min(0.260417vw, 0.462963vh);
  font-size: min(1.145833vw, 2.037037vh);
  line-height: min(1.666667vw, 2.962963vh);
  color: #55270f;
  white-space: nowrap;
}

.chapter-picker {
	position: relative;
	z-index: 5;
	width: 100%;
	height: min(3.177083vw, 5.648148vh);
	margin-top: min(1.510417vw, 2.685185vh);
}

.chapter-select {
	display: flex;
	width: 100%;
	height: 100%;
	align-items: center;
	justify-content: space-between;
	padding: 0 min(1.041667vw, 1.851852vh);
	border: 1px solid #9a948b;
	border-radius: min(1.71875vw, 3.055556vh);
	color: #4b210d;
	font-family: var(--font-main);
	font-size: min(1.25vw, 2.222222vh);
	font-weight: 500;
	line-height: 1;
	text-align: left;
	background: #fff;
	cursor: pointer;
}

.chapter-select:focus-visible {
	outline: 3px solid rgba(64, 145, 108, 0.45);
	outline-offset: 2px;
}

.chapter-select:disabled {
	color: #887f76;
	cursor: not-allowed;
}

.chapter-chevron {
	font-size: min(1.458333vw, 2.592593vh);
	line-height: 1;
	transform: translateY(-10%);
	transition: transform 0.2s ease;
}

.chapter-select[aria-expanded='true'] .chapter-chevron {
	color: #4c9256;
	transform: rotate(180deg) translateY(10%);
}

.chapter-menu {
	position: absolute;
	right: min(-0.3125vw, -0.555556vh);
	bottom: calc(100% + min(0.104167vw, 0.185185vh));
	left: min(-0.3125vw, -0.555556vh);
	z-index: 20;
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: min(1.041667vw, 1.851852vh) min(0.520833vw, 0.925926vh);
	padding:
		min(1.458333vw, 2.592593vh)
		min(1.302083vw, 2.314815vh)
		min(1.302083vw, 2.314815vh);
	border-radius: min(1.5625vw, 2.777778vh);
	background: #fbf9f0;
	box-shadow: 0 min(0.416667vw, 0.740741vh) min(1.25vw, 2.222222vh) rgba(45, 35, 22, 0.22);
}

.chapter-option {
	height: min(2.777778vw, 4.938272vh);
	border: 1px solid #8f8980;
	border-radius: min(1.09375vw, 1.944444vh);
	color: #4b210d;
	font-family: var(--font-main);
	font-size: min(1.197917vw, 2.12963vh);
	font-weight: 500;
	line-height: 1;
	background: #fff;
	cursor: pointer;
}

.chapter-option.active {
	border-color: #57905a;
	color: #fff8eb;
	background: #57905a;
}

.chapter-option:focus-visible {
	outline: 3px solid rgba(64, 145, 108, 0.45);
	outline-offset: 2px;
}
.book-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--green-pale);
  color: var(--green-dark);
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
}

.book-play-btn {
  width: 100%;
	height: min(3.90625vw, 6.944444vh);
	min-height: min(3.90625vw, 6.944444vh);
	margin-top: min(1.041667vw, 1.851852vh);
  padding: 0;
  background: linear-gradient(180deg, #529051 0%, #347346 100%);
  color: white;
  border: none;
  border-radius: var(--btn-radius);
  font-family: var(--font-main);
	font-size: min(1.458333vw, 2.592593vh);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(64,145,108,0.4);
  white-space: nowrap;
}

.book-play-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}
.book-play-btn:hover {
  background: linear-gradient(180deg, #478447 0%, #28663a 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(64,145,108,0.5);
}

.book-nav {
  position: relative;
  grid-row: 1;
  z-index: 10;
  display: grid;
  place-items: center;
  width: var(--book-nav-size);
  height: var(--book-nav-size);
  min-width: 44px;
  min-height: 44px;
  padding: 0 0 min(0.260417vw, 0.462963vh);
  border: min(0.208333vw, 0.37037vh) solid rgba(255, 252, 239, 0.95);
  border-radius: 50%;
  color: #fffdf1;
  background: linear-gradient(180deg, rgba(82, 144, 81, 0.98), rgba(42, 105, 60, 0.98));
  box-shadow: 0 min(0.3125vw, 0.555556vh) min(1.041667vw, 1.851852vh) rgba(39, 71, 35, 0.32);
  font-family: Arial, sans-serif;
  font-size: min(3.125vw, 5.555556vh);
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transform: none;
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.book-nav-prev {
  grid-column: 1;
}

.book-nav-next {
  grid-column: 3;
}

.book-nav:hover:not(:disabled) {
  transform: scale(1.08);
  box-shadow: 0 min(0.416667vw, 0.740741vh) min(1.354167vw, 2.407407vh) rgba(39, 71, 35, 0.42);
}

.book-nav:focus-visible {
  outline: 4px solid rgba(255, 210, 74, 0.95);
  outline-offset: 3px;
}

.book-nav:disabled {
  opacity: 0.32;
  cursor: default;
}

.book-carousel.is-static .book-nav {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.book-carousel.is-static .book-grid {
  justify-content: center;
}

.book-carousel-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .book-viewport {
    scroll-behavior: auto;
  }
}

/* Leaves decoration */
.leaves-deco { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.leaf {
  position: absolute;
  font-size: 2rem;
  opacity: 0.4;
}
.leaf-1 { top: 10%; left: 5%; }
.leaf-2 { top: 20%; right: 8%; transform: translateY(-6px) rotate(8deg); }
.leaf-3 { bottom: 15%; left: 10%; transform: translateY(-10px) rotate(12deg); }

/* Profile entry on the landing screen */
.profile-orb {
  position: absolute;
  top: clamp(22px, 4vh, 48px);
  right: clamp(22px, 3vw, 52px);
  z-index: 8;
  width: clamp(72px, 6.4vw, 104px);
  height: clamp(72px, 6.4vw, 104px);
  padding: 5px;
  border: 4px solid rgba(255, 250, 235, 0.96);
  border-radius: 50%;
  background: #f7d06a;
  box-shadow: 0 10px 28px rgba(55, 35, 15, 0.28);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.profile-orb:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 14px 34px rgba(55, 35, 15, 0.34);
}

.profile-orb:focus-visible {
  outline: 4px solid rgba(255, 210, 74, 0.9);
  outline-offset: 4px;
}

.profile-orb img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  opacity: 1;
  transition: opacity 0.18s ease;
}

html:not(.profile-session-present) .profile-orb {
  background: #f4f1e7;
  border-color: rgba(245, 245, 240, 0.96);
}

.profile-avatar-pending .profile-orb {
  background: linear-gradient(105deg, #e9d9ad 30%, #fff4d4 48%, #e9d9ad 66%);
  background-size: 240% 100%;
  animation: profile-avatar-loading 1.1s ease-in-out infinite;
}

.profile-avatar-pending .profile-orb img {
  opacity: 0;
}

@keyframes profile-avatar-loading {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

.profile-orb-label {
  position: absolute;
  left: 50%;
  bottom: -27px;
  min-width: 104px;
  transform: translateX(-50%);
  color: #4b210d;
  font-family: var(--font-main);
  font-size: 0.86rem;
  font-weight: 800;
  text-shadow: 0 1px 5px rgba(255, 255, 255, 0.85);
}

/* Compact account menu inspired by ChatGPT's anchored profile menu. */
.profile-menu {
  position: absolute;
  top: clamp(132px, calc(4vh + 112px), 162px);
  right: clamp(18px, 2.5vw, 44px);
  z-index: 20;
  width: 248px;
  padding: 7px;
  border: 1px solid rgba(66, 53, 39, 0.14);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.98);
  box-shadow: 0 16px 42px rgba(35, 28, 20, 0.25);
  backdrop-filter: blur(16px);
  transform-origin: right top;
  animation: profile-menu-in 0.16s ease-out;
}

@keyframes profile-menu-in {
  from { opacity: 0; transform: translateY(7px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.profile-menu > button {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border: 0;
  border-radius: 10px;
  color: #332d27;
  background: transparent;
  font: 650 0.94rem 'Nunito', sans-serif;
  text-align: left;
  cursor: pointer;
}

.profile-menu > button:hover,
.profile-menu > button:focus-visible {
  outline: 0;
  background: #f1eee8;
}

.profile-menu-icon {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
}

.profile-menu-divider {
  height: 1px;
  margin: 6px 5px;
  background: rgba(66, 53, 39, 0.12);
}

.profile-menu > .profile-menu-logout { color: #a33d32; }

.charge-modal-inner { width: min(440px, 92vw); gap: 14px; }
.charge-modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.charge-modal-header h3 { margin-top: 3px; text-align: left; }
.charge-modal-eyebrow { color: #4b895a; font-size: 0.72rem; font-weight: 900; letter-spacing: 0.12em; }
.charge-balance { padding: 12px 14px; border-radius: 14px; color: #6b4b0e; background: #fff0b8; font-size: 0.88rem; font-weight: 700; }
.charge-balance strong { margin-inline: 4px; font-size: 1.08rem; }
.charge-code-label { display: block; margin-bottom: 7px; color: var(--brown-dark); font-size: 0.85rem; font-weight: 800; }
#charge-code-input { width: 100%; padding: 14px 15px; border: 2px solid var(--green-light); border-radius: 14px; outline: 0; color: var(--brown-dark); font: 700 0.9rem/1.2 'Nunito', sans-serif; letter-spacing: 0.025em; text-transform: uppercase; }
#charge-code-input:focus { border-color: var(--green-mid); box-shadow: 0 0 0 3px rgba(64,145,108,0.15); }
.charge-message { min-height: 20px; margin-top: 7px; font: 700 0.8rem/1.4 'Nunito', sans-serif; }
.charge-error { color: #b84a32; }
.charge-success { color: #39764e; }
#charge-submit:disabled { cursor: wait; opacity: 0.6; }

/* ── Help page ─────────────────────────────────────────────── */
#screen-help {
  overflow-y: auto;
  background:
    radial-gradient(circle at 9% 12%, rgba(216, 243, 220, 0.72), transparent 26%),
    radial-gradient(circle at 94% 18%, rgba(255, 226, 141, 0.48), transparent 24%),
    #fffaf1;
}

.help-shell {
  position: relative;
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 42px 0 38px;
}

.help-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 104px 44px 34px;
  border: 1px solid rgba(93, 121, 72, 0.14);
  border-radius: 30px;
  background: rgba(255, 255, 250, 0.82);
  box-shadow: 0 14px 40px rgba(74, 91, 47, 0.1);
}

.help-back-btn {
  position: absolute;
  top: 58px;
  left: 66px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border: 0;
  border-radius: 30px;
  color: #245a42;
  background: #eff8ed;
  font: 800 0.9rem var(--font-main);
  cursor: pointer;
}

.help-back-btn span { font: 800 1.3rem/0.7 'Nunito', sans-serif; }
.help-back-btn:hover { background: #e1f0df; transform: translateX(-2px); }
.help-back-btn:focus-visible { outline: 3px solid #f9c74f; outline-offset: 3px; }

.help-title-mark {
  width: 94px;
  height: 94px;
  display: grid;
  place-items: center;
  margin-top: 0;
  border: 8px solid #f8cf58;
  border-radius: 50%;
  color: #fffdf1;
  background: #3b855e;
  box-shadow: 0 10px 0 #d9aa3e, 0 15px 28px rgba(59, 133, 94, 0.24);
  font: 700 3.4rem/1 'Fredoka', sans-serif;
}

.help-eyebrow,
.help-section-kicker {
  color: #4b895a;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.help-header h1 {
  margin-top: 7px;
  color: #3d2818;
  font-size: clamp(2.3rem, 4vw, 3.5rem);
  line-height: 1;
}

.help-lead {
  max-width: 680px;
  margin-top: 12px;
  color: #78695c;
  font: 600 1.06rem/1.55 'Nunito', sans-serif;
}

.help-quick-nav {
  position: sticky;
  top: 14px;
  z-index: 5;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 20px auto;
  padding: 7px;
  border: 1px solid rgba(78, 109, 69, 0.14);
  border-radius: 28px;
  background: rgba(255, 255, 250, 0.9);
  box-shadow: 0 8px 22px rgba(74, 91, 47, 0.1);
  backdrop-filter: blur(12px);
}

.help-quick-nav a {
  padding: 8px 15px;
  border-radius: 20px;
  color: #55705a;
  font: 800 0.83rem var(--font-main);
  text-decoration: none;
}

.help-quick-nav a:hover,
.help-quick-nav a:focus-visible { color: #245a42; background: #e8f4e4; outline: 0; }

.help-content { display: grid; gap: 18px; }

.help-card {
  scroll-margin-top: 78px;
  padding: 30px 34px 34px;
  border: 1px solid rgba(91, 74, 52, 0.12);
  border-radius: 24px;
  background: rgba(255, 255, 252, 0.94);
  box-shadow: 0 8px 28px rgba(77, 57, 32, 0.07);
}

.help-card-heading {
  display: flex;
  align-items: center;
  gap: 15px;
}

.help-card-number {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 14px;
  color: #fff;
  background: #478a60;
  font: 800 0.95rem 'Nunito', sans-serif;
}

.help-card h2 {
  margin-top: 3px;
  color: #422b1c;
  font-size: clamp(1.55rem, 2.5vw, 2.1rem);
  line-height: 1.1;
}

.help-card-intro {
  margin: 16px 0 0 59px;
  color: #74685c;
  font: 600 0.95rem/1.55 'Nunito', sans-serif;
}

.help-step-list {
  display: grid;
  gap: 14px;
  margin: 24px 0 0 59px;
  list-style: none;
}

.help-step-list li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 13px;
  align-items: start;
}

.help-step-number {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #39764e;
  background: #e7f4e5;
  font: 900 0.86rem 'Nunito', sans-serif;
}

.help-step-list strong,
.help-action-item h3,
.help-result-block h3 { color: #4b301f; font-size: 1rem; }

.help-step-list p,
.help-action-item p,
.help-result-block p,
.help-mode-copy p,
.help-mode-copy li { color: #74685c; font: 600 0.89rem/1.55 'Nunito', sans-serif; }

.help-step-list p { margin-top: 3px; }

.help-mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 22px; }

.help-mode-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 16px;
  padding: 22px;
  border: 1px solid transparent;
  border-radius: 19px;
}

.help-mode-ai { border-color: #cce5c9; background: #f1faef; }
.help-mode-user { border-color: #f0ddb0; background: #fff8e5; }
.help-mode-icon { font-size: 2.45rem; line-height: 1; }
.help-mode-label { color: #648068; font: 900 0.72rem 'Nunito', sans-serif; letter-spacing: 0.06em; text-transform: uppercase; }
.help-mode-user .help-mode-label { color: #a17236; }
.help-mode-copy h3 { margin-top: 4px; color: #3f2b1d; font-size: 1.18rem; }
.help-mode-copy p { margin-top: 8px; }
.help-mode-copy ul { display: grid; gap: 5px; margin: 12px 0 0 17px; }

.help-action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; margin: 23px 0 0 59px; }

.help-action-item,
.help-result-block {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 15px;
  border-radius: 15px;
  background: #fffaf1;
}

.help-action-icon,
.help-result-icon { font-size: 1.7rem; line-height: 1.15; }
.help-action-item p,
.help-result-block p { margin-top: 4px; }

.help-tip {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 20px 0 0 59px;
  padding: 13px 16px;
  border-radius: 14px;
  color: #526a4d;
  background: #edf7e9;
}

.help-tip > span { font-size: 1.35rem; }
.help-tip p { font: 600 0.86rem/1.45 'Nunito', sans-serif; }

.help-result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; margin: 23px 0 0 59px; }
.help-result-block { background: #f8faf4; }

.help-footer {
  padding-top: 27px;
  color: #71906c;
  font: 800 0.93rem var(--font-main);
  text-align: center;
}

@media (max-width: 760px) {
  .help-shell { width: min(100% - 24px, 600px); padding-top: 18px; }
  .help-header { display: block; padding: 82px 22px 25px; border-radius: 22px; }
  .help-back-btn { top: 31px; left: 22px; }
  .help-title-mark { width: 74px; height: 74px; margin-bottom: 19px; border-width: 6px; font-size: 2.7rem; box-shadow: 0 7px 0 #d9aa3e, 0 11px 22px rgba(59, 133, 94, 0.2); }
  .help-lead { font-size: 0.96rem; }
  .help-quick-nav { top: 8px; gap: 3px; width: 100%; margin: 14px auto; padding: 5px; }
  .help-quick-nav a { flex: 1 1 auto; padding: 7px 8px; font-size: 0.76rem; text-align: center; }
  .help-card { padding: 23px 18px 24px; border-radius: 20px; }
  .help-card-heading { gap: 11px; }
  .help-card-number { width: 38px; height: 38px; border-radius: 12px; font-size: 0.8rem; }
  .help-card-intro,
  .help-step-list,
  .help-action-grid,
  .help-tip,
  .help-result-grid { margin-left: 0; }
  .help-card-intro { margin-top: 14px; }
  .help-step-list { margin-top: 20px; }
  .help-mode-grid,
  .help-action-grid,
  .help-result-grid { grid-template-columns: 1fr; }
  .help-mode-card { grid-template-columns: 44px minmax(0, 1fr); gap: 11px; padding: 17px; }
  .help-mode-icon { font-size: 2rem; }
  .help-action-grid,
  .help-result-grid { margin-top: 18px; }
  .help-tip { margin-top: 17px; }
}

/* ── User profile ─────────────────────────────────────────── */
#screen-profile {
  overflow-y: auto;
  background: #efe6cc;
}

.profile-shell {
  position: relative;
  z-index: 2;
  width: min(1120px, calc(100% - 48px));
  min-height: 100%;
  margin: 0 auto;
  padding: clamp(70px, 10vh, 110px) 0 48px;
  display: flex;
  align-items: center;
}

.profile-back-btn {
  position: absolute;
  top: 28px;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 20px;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 30px;
  color: #315d40;
  background: rgba(255, 252, 241, 0.94);
  box-shadow: var(--shadow-soft);
  font: 700 1rem var(--font-main);
  cursor: pointer;
}

.profile-card {
  width: 100%;
  min-height: 600px;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.82);
  border-radius: 36px;
  background: #fffaf0;
  box-shadow: 0 24px 70px rgba(35, 28, 17, 0.3);
}

.profile-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 74px 34px 44px;
  color: #fffaf0;
  text-align: center;
  background:
    radial-gradient(circle at 15% 15%, rgba(255,255,255,0.18), transparent 28%),
    linear-gradient(155deg, #5b9b68 0%, #2e6d4d 100%);
}

.profile-avatar-wrap {
  position: relative;
  width: 164px;
  height: 164px;
  padding: 7px;
  border-radius: 50%;
  background: rgba(255, 251, 231, 0.96);
  box-shadow: 0 14px 36px rgba(23, 55, 39, 0.32);
}

.profile-avatar-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  background: #f1d37d;
}

.avatar-edit-btn {
  position: absolute;
  right: 3px;
  bottom: 9px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 3px solid #fffaf0;
  border-radius: 50%;
  color: #3d2a0e;
  background: #f9c74f;
  font-size: 1.2rem;
  font-weight: 900;
  cursor: pointer;
}

.profile-identity h1 {
  margin-top: 24px;
  font-size: 2rem;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.profile-identity > p#profile-email {
  margin-top: 9px;
  color: rgba(255,255,255,0.82);
  font: 600 0.95rem 'Nunito', sans-serif;
  overflow-wrap: anywhere;
}

.avatar-upload-btn {
  margin-top: 28px;
  padding: 11px 23px;
  border: 2px solid rgba(255,255,255,0.72);
  border-radius: 28px;
  color: #fff;
  background: rgba(255,255,255,0.12);
  font: 700 0.95rem var(--font-main);
  cursor: pointer;
}

.avatar-upload-btn:hover { background: rgba(255,255,255,0.22); }
.avatar-upload-btn:disabled { opacity: 0.55; cursor: wait; }

.avatar-upload-hint {
  margin-top: 10px;
  color: rgba(255,255,255,0.68);
  font: 600 0.76rem 'Nunito', sans-serif;
}

.avatar-upload-status {
  min-height: 22px;
  margin-top: 12px;
  color: #fff3b8;
  font: 700 0.82rem 'Nunito', sans-serif;
}

.avatar-upload-status.error { color: #ffd0cb; }

.profile-data {
  position: relative;
  padding: 48px 52px 74px;
  color: #4a250f;
}

.profile-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.profile-eyebrow {
  color: #61906b;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.profile-heading-row h2 {
  margin-top: 6px;
  font-size: clamp(1.7rem, 2.4vw, 2.25rem);
  line-height: 1.15;
}

.profile-display-name {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.95fr);
  align-items: end;
  gap: 20px;
  margin-top: 28px;
  padding: 16px 18px;
  border: 1px solid #eadfc7;
  border-radius: 18px;
  background: #fffdf7;
}

.profile-display-name h3 {
  margin-top: 4px;
  font-size: 1.05rem;
}

.profile-display-name-form { min-width: 0; }
.profile-display-name-controls { display: flex; gap: 8px; }
.profile-display-name-controls input {
  min-width: 0;
  flex: 1;
  padding: 10px 12px;
  border: 2px solid #c9dfc8;
  border-radius: 12px;
  outline: 0;
  color: #4a250f;
  background: #fff;
  font: 700 0.9rem 'Nunito', sans-serif;
}
.profile-display-name-controls input:focus {
  border-color: #61906b;
  box-shadow: 0 0 0 3px rgba(97, 144, 107, 0.14);
}
.profile-display-name-controls button {
  flex: 0 0 auto;
  padding: 10px 17px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--green-mid), var(--green-dark));
  font: 800 0.84rem var(--font-main);
  cursor: pointer;
}
.profile-display-name-controls button:hover { transform: translateY(-1px); }
.profile-display-name-controls button:disabled { cursor: wait; opacity: 0.58; transform: none; }
.profile-display-name-status {
  min-height: 18px;
  margin-top: 6px;
  color: #4b895a;
  font: 700 0.74rem 'Nunito', sans-serif;
}
.profile-display-name-status.error { color: #b84a32; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.profile-credit-pill {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 16px;
  border-radius: 30px;
  color: #6b4b0e;
  background: #fff0b8;
  border: 0;
  box-shadow: inset 0 0 0 1px rgba(203, 151, 21, 0.18);
  font-family: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.profile-credit-pill strong { font-size: 1.1rem; }
.profile-credit-pill:hover,
.profile-credit-pill:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgba(109, 137, 61, 0.35), 0 5px 14px rgba(82, 57, 29, 0.12); transform: translateY(-1px); }

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 34px;
}

.profile-stat {
  min-height: 128px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid #eadfc7;
  border-radius: 22px;
  background: #fffdf7;
  box-shadow: 0 6px 18px rgba(82, 57, 29, 0.07);
}

.profile-stat-icon { font-size: 1.45rem; }
.profile-stat strong { margin-top: 4px; color: #39764e; font-size: 1.8rem; line-height: 1; }
.profile-stat > span:last-child { margin-top: 7px; color: #876f5d; font-size: 0.78rem; font-weight: 700; }

.profile-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}

.profile-details > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  color: #806c5a;
  background: #f5efe3;
  font-size: 0.85rem;
}

.profile-details strong { color: #4a250f; }

.profile-recent { margin-top: 28px; }
.profile-recent-heading { display: flex; align-items: center; justify-content: space-between; }
.profile-recent-heading h3 { font-size: 1.18rem; }
.profile-recent-heading > span { color: #8b7868; font-size: 0.8rem; font-weight: 700; }
.profile-history { display: grid; gap: 9px; margin-top: 12px; }

.profile-history-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border: 1px solid #ede3d1;
  border-radius: 14px;
  background: #fffdf9;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.profile-history-item:hover,
.profile-history-item:focus-visible {
  border-color: #b9d4b8;
  outline: none;
  box-shadow: 0 5px 16px rgba(63, 104, 64, 0.12);
  transform: translateY(-1px);
}

.profile-history-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #e4f2e4;
}

.profile-history-copy { min-width: 0; }
.profile-history-copy strong { display: block; overflow: hidden; font-size: 0.88rem; text-overflow: ellipsis; white-space: nowrap; }
.profile-history-copy span { display: block; margin-top: 2px; color: #907d6d; font: 600 0.74rem 'Nunito', sans-serif; }
.profile-history-score { color: #39764e; font-size: 0.9rem; font-weight: 800; }
.profile-history-status { min-width: 66px; color: #7b6958; font-size: 0.72rem; font-weight: 800; text-align: right; text-transform: capitalize; }

.profile-empty {
  padding: 22px;
  border: 2px dashed #ddcfb8;
  border-radius: 16px;
  color: #806e5f;
  text-align: center;
  font-size: 0.88rem;
}

.profile-signout-btn {
  position: absolute;
  right: 52px;
  bottom: 28px;
  border: 0;
  color: #9b6257;
  background: transparent;
  font: 700 0.84rem var(--font-main);
  cursor: pointer;
}

@media (max-width: 760px) {
  .profile-orb { top: 18px; right: 18px; width: 70px; height: 70px; }
  .profile-menu { top: 116px; right: 12px; width: min(248px, calc(100vw - 24px)); }
  .profile-shell { width: min(100% - 24px, 600px); padding-top: 84px; align-items: flex-start; }
  .profile-back-btn { top: 20px; }
  .profile-card { grid-template-columns: 1fr; border-radius: 28px; }
  .profile-identity { padding: 36px 24px 28px; }
  .profile-avatar-wrap { width: 128px; height: 128px; }
  .profile-identity h1 { margin-top: 18px; }
  .avatar-upload-btn { margin-top: 20px; }
  .profile-data { padding: 32px 22px 72px; }
  .profile-heading-row { flex-direction: column; }
  .profile-display-name { grid-template-columns: 1fr; gap: 12px; }
  .profile-stats { gap: 8px; }
  .profile-stat { min-height: 110px; }
  .profile-details { grid-template-columns: 1fr; }
  .profile-history-item { grid-template-columns: 38px minmax(0, 1fr) auto; }
  .profile-history-status { display: none; }
  .profile-signout-btn { right: 24px; }
}

/* Profile adventure layout */
#screen-profile {
  background: #fffbf4;
}

.profile-shell {
  width: 100%;
  min-height: 100%;
  padding: 0;
  display: block;
}

.profile-card {
  min-height: 100vh;
  grid-template-columns: clamp(290px, 26.7vw, 380px) minmax(0, 1fr);
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.profile-identity {
  position: sticky;
  top: 4px;
  align-self: start;
  height: calc(100vh - 8px);
  min-height: 600px;
  margin: 4px 0 4px 4px;
  padding: 130px 24px 26px;
  border-radius: 22px;
  background: #246a50 url('../assets/elements/profile-forest-signs.webp') center bottom / cover no-repeat;
}

.profile-back-btn {
  top: 27px;
  left: 29px;
  min-width: 195px;
  justify-content: center;
  padding: 10px 18px;
  border: 0;
  border-radius: 50px;
  color: #194f37;
  background: #f7fff7;
  box-shadow: 0 8px 18px rgba(11, 55, 40, 0.11);
  font-size: 1.08rem;
  font-weight: 700;
  z-index: 1;
}
.profile-back-btn span { margin-right: 5px; font: 700 1.5rem/0.7 'Nunito', sans-serif; }
.profile-back-btn:hover { background: #fff; transform: translateY(-1px); }
.profile-back-btn:focus-visible,
.avatar-upload-btn:focus-visible,
.avatar-edit-btn:focus-visible,
.profile-signout-btn:focus-visible { outline: 3px solid #f9c74f; outline-offset: 3px; }

.profile-avatar-wrap {
  width: clamp(166px, 16vw, 214px);
  height: clamp(166px, 16vw, 214px);
  padding: 8px;
  background: #fffdf6;
  box-shadow: 0 11px 30px rgba(5, 46, 35, 0.22);
}
.avatar-edit-btn {
  right: 1px;
  bottom: 8px;
  width: 51px;
  height: 51px;
  border: 4px solid #fffdf6;
  background: #f8cb48;
  font-size: 1.55rem;
}
.profile-identity h1 {
  margin-top: 26px;
  font-size: clamp(2.1rem, 3vw, 2.55rem);
  font-weight: 700;
  letter-spacing: 0.015em;
}
.profile-identity > p#profile-email {
  max-width: 100%;
  margin-top: 12px;
  color: #fff;
  font-size: 1.05rem;
  line-height: 1.4;
}
.avatar-upload-btn {
  min-width: 215px;
  margin-top: 28px;
  padding: 13px 26px;
  border: 2px solid #fff;
  border-radius: 50px;
  background: rgba(255,255,255,0.09);
  font-size: 1.08rem;
}
.avatar-upload-hint {
  margin-top: 14px;
  color: rgba(255,255,255,0.82);
  font-size: 0.83rem;
}

.profile-data {
  min-width: 0;
  min-height: 100vh;
  padding: 46px clamp(28px, 3vw, 48px) 76px;
  color: #3e2a1e;
}
.profile-heading-row { align-items: center; }
.profile-eyebrow {
  color: #357954;
  font-size: 0.93rem;
  font-weight: 900;
  letter-spacing: 0.09em;
}
.profile-heading-row h2 {
  margin-top: 8px;
  font-size: clamp(2.5rem, 3.7vw, 3.45rem);
  font-weight: 700;
  line-height: 1.03;
  letter-spacing: -0.025em;
}
.profile-heading-subtitle {
  margin-top: 3px;
  color: #776c64;
  font: 600 1.08rem/1.35 'Nunito', sans-serif;
}
.profile-credit-pill {
  gap: 7px;
  padding: 11px 18px;
  border: 1px solid #f3ca62;
  border-radius: 32px;
  background: #fff5cf;
  color: #56361a;
  font-size: 1rem;
  white-space: nowrap;
}
.profile-credit-pill strong { font-size: 1.35rem; }
.profile-credit-pill span:first-child { font-size: 1.25rem; }

.profile-display-name {
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  align-items: center;
  column-gap: 30px;
  row-gap: 8px;
  min-height: 177px;
  margin-top: 25px;
  padding: 16px 22px 18px;
  border-color: #cee6d6;
  border-radius: 18px;
  background: #f8fff9;
  box-shadow: 0 7px 20px rgba(55, 104, 71, 0.06);
}
.profile-display-name-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #174b35;
}
.profile-display-name-heading h3 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.15;
}
.profile-display-name-icon {
  position: relative;
  width: 41px;
  height: 41px;
  flex: 0 0 auto;
  border-radius: 12px;
  color: transparent;
  background: #d9f2df;
}
.profile-display-name-icon::before,
.profile-display-name-icon::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: #286a44;
}
.profile-display-name-icon::before { top: 8px; width: 11px; height: 11px; border-radius: 50%; }
.profile-display-name-icon::after { bottom: 8px; width: 20px; height: 11px; border-radius: 12px 12px 4px 4px; }
.profile-display-name-copy label {
  display: block;
  color: #432c20;
  font-size: 1.08rem;
  font-weight: 700;
}
.profile-display-name-copy p {
  margin-top: 3px;
  color: #736d68;
  font: 600 0.88rem/1.35 'Nunito', sans-serif;
}
.profile-display-name-controls { gap: 12px; }
.profile-display-name-form,
.profile-display-name-controls { width: 100%; min-width: 0; }
.profile-display-name-controls input {
  width: 0;
  flex: 1 1 0;
  height: 59px;
  padding: 0 20px;
  border: 2px solid #cee5d4;
  border-radius: 15px;
  color: #2d3230;
  background: #fff;
  box-shadow: 0 5px 15px rgba(18, 85, 47, 0.07);
  font: 600 1.05rem 'Nunito', sans-serif;
}
.profile-display-name-controls button {
  min-width: 128px;
  height: 59px;
  padding: 0 18px;
  border-radius: 16px;
  background: linear-gradient(140deg, #409f73, #196746);
  box-shadow: 0 6px 14px rgba(32, 101, 65, 0.12);
  font-size: 1.05rem;
}
.profile-display-name-status {
  min-height: 19px;
  margin-top: 8px;
  font-size: 0.82rem;
}
.profile-display-name-status.success::before,
.profile-display-name-status.error::before {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 9px;
  border-radius: 50%;
  color: #fff;
  background: #3c9653;
  content: '✓';
  font: 900 0.72rem 'Nunito', sans-serif;
  vertical-align: middle;
}
.profile-display-name-status.error::before { background: #b84a32; content: '!'; }

.profile-stats { gap: 20px; margin-top: 20px; }
.profile-stat {
  position: relative;
  min-height: 172px;
  overflow: hidden;
  border-color: #eadcca;
  border-radius: 17px;
  background: #fffefa;
}
.profile-stat::before {
  content: '';
  position: absolute;
  inset: auto -10% -28px;
  height: 80px;
  background: radial-gradient(circle at 10% 55%, #eaf8ee 0 23px, transparent 24px), radial-gradient(circle at 31% 73%, #eaf8ee 0 20px, transparent 21px), radial-gradient(circle at 79% 76%, #eaf8ee 0 26px, transparent 27px), radial-gradient(circle at 100% 48%, #eaf8ee 0 30px, transparent 31px);
  opacity: 0.8;
}
.profile-stat > * { position: relative; }
.profile-stat-icon { font-size: 2.8rem; line-height: 1.1; }
.profile-stat strong { margin-top: 7px; font-size: 2.8rem; line-height: 0.95; }
.profile-stat > span:last-child { margin-top: 4px; color: #796759; font-size: 0.92rem; }

.profile-details { gap: 10px; margin-top: 20px; }
.profile-details > div {
  min-height: 87px;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  padding: 10px 20px;
  border: 1px solid #e1e8dc;
  border-radius: 17px;
  background: linear-gradient(160deg, #fff, #f0fbf3);
  box-shadow: 0 4px 12px rgba(56, 83, 56, 0.06);
}
.profile-detail-icon {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #205e42;
  background: #dff5e5;
  font-size: 1.7rem;
  font-weight: 900;
}
.profile-detail-copy { display: flex; flex-direction: column; gap: 2px; color: #746b64; font: 600 0.96rem 'Nunito', sans-serif; }
.profile-detail-copy strong { color: #4a3023; font: 700 1.1rem var(--font-main); }

.profile-recent { margin-top: 26px; }
.profile-recent-heading h3 { display: flex; align-items: center; gap: 12px; font-size: 1.45rem; }
.profile-recent-heading h3 span { font-size: 1.7rem; }
.profile-recent-heading > span { font-size: 0.92rem; }
.profile-history { gap: 8px; margin-top: 10px; }
.profile-history-item {
  grid-template-columns: 52px minmax(0, 1fr) auto 100px 14px;
  min-height: 62px;
  gap: 14px;
  padding: 5px 18px;
  border-color: #eadbca;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 5px 15px rgba(108, 76, 37, 0.06);
}
.profile-history-item::after { content: '›'; color: #4b4039; font: 400 1.5rem/1 'Nunito', sans-serif; }
.profile-history-icon { width: 52px; height: 50px; border-radius: 13px; font-size: 1.5rem; }
.profile-history-copy strong { color: #492e22; font-size: 0.95rem; }
.profile-history-copy span { margin-top: 1px; font-size: 0.78rem; }
.profile-history-score { color: #28714b; font-size: 0.95rem; white-space: nowrap; }
.profile-history-status {
  min-width: 0;
  padding: 8px 10px;
  border-radius: 25px;
  background: #f1f0ef;
  color: #655f5a;
  font-size: 0.76rem;
  text-align: center;
}
.profile-history-status[data-status='playing'] { background: #e0f5e7; color: #276641; }
.profile-signout-btn { right: clamp(28px, 3vw, 48px); bottom: 26px; color: #a33f2c; font-size: 0.92rem; }
.profile-signout-btn::after { content: '⇥'; margin-left: 10px; font: 700 1.2rem 'Nunito', sans-serif; }

@media (max-width: 1050px) {
  .profile-display-name { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .profile-display-name-heading { grid-column: 1; }
  .profile-display-name-copy { margin-top: 5px; }
  .profile-history-item { grid-template-columns: 46px minmax(0, 1fr) auto 78px 12px; gap: 9px; }
  .profile-history-icon { width: 46px; height: 46px; }
  .profile-history-status { font-size: 0.7rem; }
}

@media (max-width: 760px) {
  .profile-card { width: 100%; min-width: 0; grid-template-columns: minmax(0, 1fr); }
  .profile-identity {
    position: relative;
    top: auto;
    height: auto;
    min-height: 390px;
    margin: 4px;
    padding: 94px 24px 30px;
    background-position: center 55%;
  }
  .profile-back-btn { top: 18px; left: 20px; min-width: 0; padding: 9px 16px; font-size: 0.95rem; }
  .profile-avatar-wrap { width: 138px; height: 138px; }
  .avatar-edit-btn { width: 42px; height: 42px; font-size: 1.2rem; }
  .profile-identity h1 { margin-top: 17px; }
  .profile-identity > p#profile-email { margin-top: 7px; font-size: 0.9rem; }
  .avatar-upload-btn { min-width: 180px; margin-top: 15px; padding: 9px 16px; font-size: 0.95rem; }
  .avatar-upload-hint { margin-top: 8px; }
  .profile-data { min-height: 0; padding: 29px 22px 80px; }
  .profile-heading-row { align-items: flex-start; gap: 15px; }
  .profile-heading-row h2 { font-size: clamp(2.1rem, 7vw, 2.8rem); }
  .profile-heading-subtitle { font-size: 0.96rem; }
  .profile-credit-pill { padding: 8px 13px; font-size: 0.88rem; }
  .profile-display-name { margin-top: 22px; padding: 16px; }
  .profile-display-name-controls input,
  .profile-display-name-controls button { height: 52px; }
  .profile-display-name-controls button { min-width: 90px; }
  .profile-stats { gap: 8px; }
  .profile-stat { min-height: 120px; }
  .profile-stat-icon { font-size: 1.8rem; }
  .profile-stat strong { font-size: 1.75rem; }
  .profile-stat > span:last-child { font-size: 0.72rem; }
  .profile-details { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .profile-details > div { gap: 8px; padding: 8px; }
  .profile-detail-icon { width: 36px; height: 36px; border-radius: 10px; font-size: 1.1rem; }
  .profile-detail-copy { font-size: 0.7rem; }
  .profile-detail-copy strong { font-size: 0.84rem; }
  .profile-history-item { grid-template-columns: 42px minmax(0, 1fr) auto 12px; gap: 8px; padding: 5px 9px; }
  .profile-history-icon { width: 42px; height: 42px; font-size: 1.25rem; }
  .profile-history-status { display: none; }
  .profile-history-score { font-size: 0.78rem; }
  .profile-history-copy strong { font-size: 0.8rem; }
  .profile-recent-heading h3 { font-size: 1.15rem; }
  .profile-recent-heading > span { font-size: 0.75rem; }
  .profile-signout-btn { right: 22px; }
}


/* ── 6. ════════════════════════════════════════════════════════
        SCREEN 2 – Game Play
   ════════════════════════════════════════════════════════════ */
#screen-game-play {
  background: linear-gradient(160deg, #e8f5e9 0%, #fff8e1 50%, #e3f2fd 100%);
}
#game-bg {
  background-image: url('../assets/elements/bg2.jpg');
  background-size: cover;
  background-position: center;
  opacity: 1;
}

/* ─ HUD ─ */
.game-hud {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  gap: 12px;
}
.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.hud-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.9);
  border: 2px solid rgba(255,255,255,0.95);
  border-radius: 50px;
  padding: 8px 16px;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
  cursor: default;
}
.hud-icon { font-size: 1.2rem; }
.turn-badge { color: var(--green-dark); }
.hint-counter { color: var(--brown-dark); }
.score-badge { color: var(--green-dark); }

/* ─ Main Game Area ─ */
.game-main {
  position: relative;
  z-index: 5;
  flex: 1;
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 0 20px;
  overflow: hidden;
}

/* ─ Left: Image Card Area ─ */
.image-card-area {
  flex: 0 0 46%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding: 4px 0 4px 8px;
}

/* Card reveal container */
.image-card-flipper {
  width: 100%;
  max-width: 520px;
  aspect-ratio: 3 / 4;
  cursor: default;
  position: relative;
}

/* Cross-fading avoids keeping a large 3D scene on the GPU while idle. */
.image-card-flipper .card-face {
  position: absolute;
  inset: 0;
  border-radius: 32px;
  overflow: hidden;
  box-shadow: var(--shadow-float);
  border: 9px solid rgba(255,255,255,0.95);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s;
}

/* Front face: visible by default */
.image-card-flipper .card-front {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  background: #075a37;
}

/* Back face is not painted until the card is revealed. */
.image-card-flipper .card-back {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.025);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s linear 0.35s;
  background: #f7e7bd;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Revealed state */
.image-card-flipper.flipped .card-front {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.975);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s linear 0.35s;
}
.image-card-flipper.flipped .card-back {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s;
}

/* Front artwork and a static glow around the question mark */
.card-front-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.question-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.question-glow {
  position: absolute;
  left: 50%;
  top: 52%;
  width: 58%;
  height: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 220, 92, 0.38) 0%,
    rgba(249, 199, 79, 0.16) 38%,
    rgba(249, 199, 79, 0) 76%
  );
}

/* Back face image */
.word-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.word-label {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 8%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  color: var(--brown-dark);
  font-family: var(--font-main);
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  font-weight: 700;
  line-height: 1;
  text-align: center;
  overflow-wrap: anywhere;
  pointer-events: none;
}
.hidden { display: none !important; }

/* ─ Ready Overlay ─ */
.ready-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 60, 35, 0.72);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease, visibility 0s;
  pointer-events: all;
}
.ready-overlay.ready-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
}
.ready-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}
.ready-emoji {
  font-size: 5rem;
  animation: readyBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes readyBounce {
  from { transform: scale(0) rotate(-20deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg);  opacity: 1; }
}
.ready-countdown {
  font-size: 7rem;
  font-weight: 900;
  color: var(--warm-yellow);
  text-shadow: 0 0 40px rgba(249,199,79,0.8), 0 4px 12px rgba(0,0,0,0.4);
  line-height: 1;
  animation: countPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes countPop {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.ready-label {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
  letter-spacing: 1px;
  animation: readyBounce 0.5s 0.1s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ─ Right: Chat Area ─ */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  /* Top/bottom padding is set dynamically by JS to match the image card's bounds */
  box-sizing: border-box;
}

.bot-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.96);
  width: 100%;
  min-height: 88px;
  border-radius: 28px;
  padding: 14px 28px;
  box-shadow: var(--shadow-soft);
  border: 2px solid rgba(255,255,255,0.9);
  flex-shrink: 0;
}
.bot-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--green-light);
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.bot-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bot-name {
  font-size: var(--chat-font-size);
  font-weight: 700;
  color: var(--green-dark);
}
.bot-speaking-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 14px;
}
.bot-speaking-indicator span {
  display: block;
  width: 5px;
  height: 5px;
  background: var(--green-mid);
  border-radius: 50%;
  opacity: 0;
}
.bot-speaking-indicator.active span {
  animation: speakDot 1.2s ease-in-out infinite;
  opacity: 1;
}
.bot-speaking-indicator span:nth-child(1) { animation-delay: 0s; }
.bot-speaking-indicator span:nth-child(2) { animation-delay: 0.2s; }
.bot-speaking-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes speakDot {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.3; }
  40% { transform: scale(1.3); opacity: 1; }
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 0;
  padding-bottom: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.chat-messages::-webkit-scrollbar { display: none; }

/* Message bubbles */
.msg-bubble {
  display: flex;
  gap: 8px;
  width: 100%;
  animation: msgSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.msg-bubble .bubble-content,
.bot-thinking-bubble {
  overflow-wrap: anywhere;
}
.msg-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.9);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.msg-bubble.bot .msg-avatar {
  display: block;
  position: absolute;
  left: 20px;
  top: 20px;
  z-index: 1;
  width: 44px;
  height: 44px;
  flex-basis: 44px;
  border-color: var(--green-light);
}
@keyframes msgSlideIn {
  from { transform: translateY(20px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Bot messages (left aligned) */
.msg-bubble.bot {
  position: relative;
  align-items: flex-start;
}
.msg-bubble.bot .bubble-content {
  background: rgba(255,255,255,0.97);
  width: fit-content;
  border-radius: 28px;
  padding: 28px 18px 28px 84px;
  max-width: 80%;
  font-size: var(--bot-message-font-size);
  font-weight: 600;
  color: var(--brown-dark);
  box-shadow: var(--shadow-soft);
  border: 1.5px solid rgba(255,255,255,0.9);
  line-height: 1.6;
}
.msg-bubble.bot .bubble-content.description-bubble {
  font-size: var(--bot-message-font-size);
  font-weight: 600;
  color: var(--brown-dark);
}

/* User messages (right aligned) */
.msg-bubble.user {
  align-items: flex-end;
  justify-content: flex-end;
}
.msg-bubble.user .bubble-content {
  background: linear-gradient(135deg, var(--green-mid), var(--green-dark));
  color: white;
  border-radius: 20px 20px 4px 20px;
  padding: 12px 20px;
  max-width: 80%;
  font-size: var(--chat-font-size);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(64,145,108,0.35);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Hint Toast */
.hint-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #fff3cd, #fff8e7);
  border: 2px solid var(--warm-yellow);
  width: 100%;
  min-height: 88px;
  border-radius: 28px;
  padding: 18px 28px;
  font-size: var(--chat-font-size);
  font-weight: 600;
  color: var(--brown-dark);
  box-shadow: var(--shadow-soft);
  animation: hintSlide 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}
@keyframes hintSlide {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.hint-icon { font-size: 1.4rem; }

/* ─ Footer / Action Buttons ─ */
.game-footer {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 16px 24px 20px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 124px;
  min-height: 112px;
  border: none;
  border-radius: 18px;
  cursor: pointer;
  font-family: var(--font-main);
  font-weight: 700;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.action-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.2s;
}
.action-btn:hover::after { background: rgba(255,255,255,0.15); }
.action-btn:active { transform: scale(0.95); }

.action-icon { font-size: 2rem; line-height: 1; }
.action-label { font-size: 1.1rem; }

/* Hint Button */
.hint-btn {
  background: linear-gradient(135deg, #f9c74f, #f3a712);
  color: var(--brown-dark);
  padding: 18px 24px;
  box-shadow: 0 4px 16px rgba(249,199,79,0.45);
}
.hint-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 20px rgba(249,199,79,0.6);
}
.hint-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Skip Button */
.skip-btn {
  background: rgba(255,255,255,0.96);
  color: var(--brown-mid);
  padding: 18px 24px;
  border: 2px solid rgba(255,255,255,0.9);
  box-shadow: var(--shadow-soft);
}
.skip-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: var(--shadow-card);
}

/* Type Button */
.type-btn {
  background: rgba(255,255,255,0.96);
  color: var(--brown-mid);
  padding: 18px 24px;
  border: 2px solid rgba(255,255,255,0.9);
  box-shadow: var(--shadow-soft);
}
.type-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: var(--shadow-card);
}

/* Speak Button */
.speak-btn {
  background: linear-gradient(135deg, var(--green-mid), var(--green-dark));
  color: white;
  min-width: 250px;
  padding: 18px 36px;
  border-radius: var(--btn-radius);
  font-size: 1.2rem;
  box-shadow: 0 4px 20px rgba(64,145,108,0.45);
  flex-direction: row;
  gap: 12px;
}
.speak-btn .action-icon {
  display: grid;
  place-items: center;
}
.speak-icon {
  width: 1.25em;
  height: 1.25em;
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.speak-icon-stop { display: none; }
.speak-btn .action-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.speak-btn .action-label { font-size: 1.45rem; }
.speak-btn .action-subtitle {
  min-height: 1em;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  opacity: 0.78;
}
.speak-btn:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 28px rgba(64,145,108,0.55);
}
.speak-btn.recording {
  background: linear-gradient(135deg, #e85753, #d84440);
  animation: recordPulse 1s ease-in-out infinite;
}
.speak-btn.recording .speak-icon-mic { display: none; }
.speak-btn.recording .speak-icon-stop { display: block; }
.speak-btn.recording .action-copy { align-items: center; }
.speak-btn.recording .action-subtitle { display: none; }
@keyframes recordPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(231,111,81,0.5); }
  50% { box-shadow: 0 4px 36px rgba(231,111,81,0.9), 0 0 0 8px rgba(231,111,81,0.15); }
}

/* Next Button */
.next-btn {
  background: linear-gradient(135deg, var(--warm-yellow), var(--orange));
  color: var(--brown-dark);
  padding: 14px 40px;
  border-radius: var(--btn-radius);
  font-size: 1.25rem;
  font-weight: 800;
  box-shadow: 0 4px 20px rgba(249, 199, 79, 0.55);
  flex-direction: row;
  gap: 10px;
  animation: popNext 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.next-btn .action-label { font-size: 1.25rem; }
.next-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 28px rgba(249, 199, 79, 0.7);
}
@keyframes popNext {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ─ Type Modal ─ */
.type-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.type-modal-inner {
  background: white;
  border-radius: 24px;
  padding: 32px;
  width: 400px;
  max-width: 90vw;
  box-shadow: var(--shadow-float);
  animation: modalSlide 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
@keyframes modalSlide {
  from { transform: translateY(40px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.type-modal-inner h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--brown-dark);
  text-align: center;
}
#type-input {
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: 2px solid var(--green-light);
  font-family: var(--font-main);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--brown-dark);
  outline: none;
  transition: border-color 0.2s;
}
#type-input:focus { border-color: var(--green-mid); box-shadow: 0 0 0 3px rgba(64,145,108,0.15); }
.type-modal-actions {
  display: flex;
  gap: 12px;
}
.modal-btn {
  flex: 1;
  padding: 12px;
  border-radius: var(--btn-radius);
  border: none;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.cancel-btn {
  background: #f0f0f0;
  color: #666;
}
.cancel-btn:hover { background: #e0e0e0; }
.submit-btn {
  background: linear-gradient(135deg, var(--green-mid), var(--green-dark));
  color: white;
  box-shadow: 0 4px 16px rgba(64,145,108,0.4);
}
.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(64,145,108,0.5);
}

.session-choice-modal-inner {
  align-items: center;
  width: 460px;
}

.profile-session-detail-modal-inner {
  width: min(760px, 94vw);
  max-width: 760px;
  max-height: min(820px, 90vh);
  overflow-y: auto;
  gap: 18px;
}

.profile-credit-history-modal-inner {
  width: min(720px, 94vw);
  max-width: 720px;
  max-height: min(820px, 90vh);
  overflow: hidden;
  gap: 18px;
}
.profile-credit-history-list { min-height: 0; display: grid; gap: 11px; overflow-y: auto; }
.profile-credit-history-item { padding: 15px 17px; border: 1px solid #eadfce; border-left: 5px solid #e0ad32; border-radius: 16px; background: #fffdf8; }
.profile-credit-history-item-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.profile-credit-history-item-heading strong { color: #b65d3c; font-size: 0.98rem; }
.profile-credit-history-item-heading time { color: #887565; font-size: 0.76rem; font-weight: 700; text-align: right; }
.profile-credit-history-item dl { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; margin-top: 12px; }
.profile-credit-history-item dl > div { min-width: 0; }
.profile-credit-history-item dt { color: #958271; font-size: 0.68rem; font-weight: 800; text-transform: uppercase; }
.profile-credit-history-item dd { margin: 3px 0 0; overflow: hidden; color: #4a250f; font-size: 0.86rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.profile-credit-history-pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; }
.profile-credit-history-pagination button { padding: 9px 13px; border: 1px solid #cfddc9; border-radius: 12px; color: #416d4d; background: #edf4e9; font: 800 0.8rem var(--font-main); cursor: pointer; }
.profile-credit-history-pagination button:last-child { justify-self: end; }
.profile-credit-history-pagination button:disabled { cursor: default; opacity: 0.42; }
.profile-credit-history-pagination span { color: #806f60; font-size: 0.78rem; font-weight: 800; text-align: center; }

.profile-session-detail-header,
.profile-session-round-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.profile-session-detail-header h3 { text-align: left; }
.profile-session-detail-eyebrow { color: #4b895a; font-size: 0.72rem; font-weight: 900; letter-spacing: 0.12em; }
.profile-session-detail-close { width: 36px; height: 36px; border: 0; border-radius: 50%; color: #735d4b; background: #f3eee5; font-size: 1.45rem; cursor: pointer; }
.profile-session-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: #826f5f; font-size: 0.86rem; font-weight: 700; }
.profile-session-game-id { padding: 5px 10px; border-radius: 8px; color: #755b28; background: #f5c95a; font-weight: 900; line-height: 1; overflow-wrap: anywhere; }
.profile-session-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.profile-session-summary > div { display: grid; gap: 3px; padding: 13px; border-radius: 14px; text-align: center; background: #f4f7ed; }
.profile-session-summary strong { color: #39764e; font-size: 1.25rem; }
.profile-session-summary span { color: #7b6d60; font-size: 0.72rem; font-weight: 800; }
.profile-session-word-summary { overflow: hidden; border: 1px solid #eadfce; border-radius: 16px; background: #fffdf8; }
.profile-session-word-summary > h4 { padding: 15px 18px 6px; color: #4a250f; font-size: 1rem; }
.profile-session-word-summary-row { display: flex; align-items: flex-start; gap: 14px; padding: 11px 18px 14px; }
.profile-session-word-summary-row + .profile-session-word-summary-row { border-top: 1px solid #eee4d6; }
.profile-session-word-summary-row > strong { flex: 0 0 auto; padding-top: 5px; font-size: 0.82rem; }
.profile-session-word-summary-correct > strong { color: #4b895a; }
.profile-session-word-summary-incorrect > strong { color: #d46655; }
.profile-session-word-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.profile-session-word-chips > span { padding: 5px 11px; border: 1px solid #cfddc9; border-radius: 99px; color: #4e7557; background: #edf4e9; font-size: 0.78rem; font-weight: 800; }
.profile-session-word-summary-incorrect .profile-session-word-chips > span { border-color: #efd2cd; color: #a95045; background: #fbecea; }
.profile-session-word-chips > .profile-session-word-summary-empty { border-color: transparent; color: #927f6e; background: transparent; }
.profile-session-rounds { display: grid; gap: 13px; }
.profile-session-round { padding: 16px; border: 1px solid #eadfce; border-left: 5px solid #d6b353; border-radius: 16px; background: #fffdf8; }
.profile-session-round-correct { border-left-color: #4b985c; }
.profile-session-round-wrong,
.profile-session-round-skipped { border-left-color: #d96855; }
.profile-session-round-heading h4 { color: #4a250f; font-size: 1rem; }
.profile-session-round-heading span { flex: 0 0 auto; padding: 4px 9px; border-radius: 99px; color: #5f5145; background: #eee8dd; font-size: 0.7rem; font-weight: 900; }
.profile-session-round-meta { margin-top: 4px; color: #8a7565; font-size: 0.76rem; font-weight: 700; }
.profile-session-transcript { display: grid; gap: 7px; margin-top: 13px; }
.profile-session-message { width: fit-content; max-width: 82%; padding: 9px 12px; border-radius: 13px; background: #edf5e9; }
.profile-session-message-user { justify-self: end; background: #fff0c8; }
.profile-session-message strong { display: block; color: #4b7253; font-size: 0.68rem; }
.profile-session-message p { margin-top: 2px; color: #4d433a; font-size: 0.84rem; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.profile-session-no-messages,
.profile-session-detail-empty { color: #8a7868; font-size: 0.82rem; text-align: center; }

@media (max-width: 560px) {
  .profile-session-detail-modal-inner { padding: 22px 16px; }
  .profile-credit-history-modal-inner { padding: 22px 16px; }
  .profile-credit-history-item dl { grid-template-columns: 1fr; }
  .profile-credit-history-item dd { white-space: normal; }
  .profile-session-word-summary-row { display: grid; gap: 5px; }
  .profile-session-word-summary-row > strong { padding-top: 0; }
  .profile-session-message { max-width: 92%; }
}
.session-choice-icon {
  font-size: 3rem;
  line-height: 1;
}
.session-choice-copy {
  color: var(--brown-mid);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}
.session-choice-actions {
  align-self: stretch;
}
.restart-btn {
  background: #fff0ec;
  color: #b84a32;
  border: 2px solid rgba(231, 111, 81, 0.35);
}
.restart-btn:hover {
  background: #ffe2da;
  transform: translateY(-2px);
}

/* ─ Result Toast ─ */
.result-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 200;
  pointer-events: none;
}
.result-toast-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 24px 40px;
  border-radius: 24px;
  background: rgba(255,255,255,0.98);
  box-shadow: var(--shadow-float);
  animation: resultPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes resultPop {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.result-emoji { font-size: 3rem; }
.result-text { font-size: 1.6rem; font-weight: 800; color: var(--brown-dark); }
.result-pts {
  font-size: 2rem;
  font-weight: 900;
}
.result-pts.positive { color: var(--green-dark); }
.result-pts.negative { color: var(--coral); }
.result-pts.neutral { color: var(--brown-mid); }

.result-toast.fade-out {
  animation: fadeOut 0.4s ease forwards;
}
@keyframes fadeOut {
  to { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}


/* ── 7. ════════════════════════════════════════════════════════
        SCREEN 3 – Results
   ════════════════════════════════════════════════════════════ */
#screen-results {
  --results-u: min(0.052083333vw, 0.092592593vh);
  --results-brown: #451a04;
  --results-green: #43874a;
  transform: none;
}

#screen-results.active {
  transform: none;
}

.results-bg {
  background-image: url('../assets/elements/bg2.jpg');
  background-position: center;
  background-size: cover;
}

.results-hud {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.results-hud-pill {
  position: absolute;
  top: calc(25 * var(--results-u));
  height: calc(60 * var(--results-u));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(10 * var(--results-u));
  border-radius: calc(30 * var(--results-u));
  background: #faf8ec;
  color: #3f7135;
  box-shadow: 0 calc(4 * var(--results-u)) calc(15 * var(--results-u)) rgba(50, 31, 16, 0.16);
  font-size: calc(21 * var(--results-u));
  font-weight: 700;
  line-height: 1;
}

.results-hud-icon {
  font-size: calc(25 * var(--results-u));
  line-height: 1;
}

.results-turn {
  left: calc(35 * var(--results-u));
  width: calc(180 * var(--results-u));
}

.results-hints {
  right: calc(208.5 * var(--results-u));
  width: calc(107.5 * var(--results-u));
}

.results-score {
  right: calc(50 * var(--results-u));
  width: calc(143.5 * var(--results-u));
}

.results-container {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}

.results-panel {
  position: absolute;
  left: calc(170 * var(--results-u));
  top: calc(247 * var(--results-u));
  width: calc(1580 * var(--results-u));
  height: calc(563 * var(--results-u));
  overflow: hidden;
  border-radius: calc(30 * var(--results-u));
  background: #fff8e9;
  box-shadow: 0 calc(8 * var(--results-u)) calc(24 * var(--results-u)) rgba(57, 37, 13, 0.17);
}

.results-title {
  position: absolute;
  top: calc(24 * var(--results-u));
  left: 0;
  width: 100%;
  color: var(--results-brown);
  font-size: calc(42 * var(--results-u));
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  letter-spacing: calc(0.4 * var(--results-u));
}

.final-score-display {
  position: absolute;
  left: calc(23 * var(--results-u));
  top: calc(77 * var(--results-u));
  width: calc(300 * var(--results-u));
  height: calc(470 * var(--results-u));
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.results-trophy {
  width: calc(300 * var(--results-u));
  height: calc(300 * var(--results-u));
  flex: 0 0 auto;
  display: block;
  object-fit: cover;
  animation: trophyBounce 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes trophyBounce {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.final-score-label {
  margin-top: calc(2 * var(--results-u));
  color: var(--results-brown);
  font-size: calc(28 * var(--results-u));
  font-weight: 700;
  line-height: calc(42 * var(--results-u));
}

.final-score-number {
  height: calc(90 * var(--results-u));
  color: var(--results-green);
  font-size: calc(78 * var(--results-u));
  font-weight: 700;
  line-height: calc(90 * var(--results-u));
  animation: scoreCount 1s ease-out;
}

.final-score-points {
  color: var(--results-brown);
  font-size: calc(25 * var(--results-u));
  font-weight: 700;
  line-height: calc(38 * var(--results-u));
}

@keyframes scoreCount {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Word Review */
.word-review-list {
  position: absolute;
  left: calc(337 * var(--results-u));
  top: calc(107 * var(--results-u));
  width: calc(1215 * var(--results-u));
  height: calc(410 * var(--results-u));
  display: grid;
  grid-template-columns: repeat(6, calc(190 * var(--results-u)));
  gap: calc(15 * var(--results-u));
  overflow: visible;
}

.word-review-list.is-short {
  display: flex;
  justify-content: center;
}

.review-item {
  position: relative;
  width: calc(190 * var(--results-u));
  height: calc(410 * var(--results-u));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: calc(20 * var(--results-u)) calc(20 * var(--results-u));
  overflow: hidden;
  border: 0;
  border-radius: calc(28 * var(--results-u));
  background: #fbf9f0;
  box-shadow: 0 calc(8 * var(--results-u)) calc(18 * var(--results-u)) rgba(70, 49, 25, 0.17);
  transition: var(--transition);
  animation: reviewSlide 0.4s ease both;
}

@keyframes reviewSlide {
  from { transform: translateY(calc(18 * var(--results-u))); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.review-avatar {
  width: calc(50 * var(--results-u));
  height: calc(50 * var(--results-u));
  flex: 0 0 auto;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 calc(4 * var(--results-u)) calc(10 * var(--results-u)) rgba(41, 27, 13, 0.25);
}

.review-image {
  width: calc(150 * var(--results-u));
  height: calc(200 * var(--results-u));
  flex: 0 0 auto;
  display: block;
  margin-top: calc(20 * var(--results-u));
  border-radius: calc(15 * var(--results-u));
  object-fit: cover;
}

.review-word {
  width: 100%;
  margin-top: calc(17 * var(--results-u));
  overflow: hidden;
  color: var(--results-brown);
  font-size: calc(24 * var(--results-u));
  font-weight: 700;
  line-height: calc(32 * var(--results-u));
  text-align: center;
  text-overflow: ellipsis;
  text-transform: capitalize;
  white-space: nowrap;
}

.review-status {
  position: absolute;
  left: 50%;
  bottom: calc(20 * var(--results-u));
  width: calc(30 * var(--results-u));
  height: calc(30 * var(--results-u));
  display: block;
  transform: translateX(-50%);
}

/* Results Action Buttons */
.results-actions {
  position: absolute;
  left: 50%;
  top: calc(940 * var(--results-u));
  height: calc(100 * var(--results-u));
  display: flex;
  gap: calc(30 * var(--results-u));
  align-items: stretch;
  transform: translateX(-50%);
}

.results-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(15 * var(--results-u));
  height: calc(100 * var(--results-u));
  padding: 0;
  border-radius: calc(50 * var(--results-u));
  border: none;
  font-family: var(--font-main);
  font-size: calc(35 * var(--results-u));
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}

.results-btn-icon {
  font-size: calc(42 * var(--results-u));
  line-height: 1;
}

.results-btn:disabled {
  cursor: not-allowed;
  transform: none;
}

.primary-btn {
  width: calc(290 * var(--results-u));
  background: linear-gradient(180deg, #57975f 0%, #367b48 100%);
  color: #fff8eb;
  box-shadow: 0 calc(6 * var(--results-u)) calc(20 * var(--results-u)) rgba(38, 88, 50, 0.32);
}

.primary-btn:hover {
  transform: translateY(calc(-3 * var(--results-u)));
  box-shadow: 0 calc(9 * var(--results-u)) calc(26 * var(--results-u)) rgba(38, 88, 50, 0.38);
}

.secondary-btn {
  width: calc(200 * var(--results-u));
  background: #efe6d3;
  color: var(--results-brown);
  box-shadow: 0 calc(6 * var(--results-u)) calc(20 * var(--results-u)) rgba(50, 31, 16, 0.18);
}

.play-again-btn {
  width: calc(290 * var(--results-u));
}

.next-adventure-btn {
  width: calc(350 * var(--results-u));
}

.next-adventure-btn:disabled {
  background: #d7d3ca;
  color: #8b8479;
  box-shadow: none;
}

.secondary-btn:hover {
  transform: translateY(calc(-3 * var(--results-u)));
  box-shadow: 0 calc(9 * var(--results-u)) calc(26 * var(--results-u)) rgba(50, 31, 16, 0.23);
}

.results-btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* ── 8. Inline Chat Voice Recording ───────────────────────────── */
.msg-bubble.user .bubble-content.recording-voice {
  background: linear-gradient(135deg, var(--green-mid), var(--green-dark));
  padding: 10px 18px;
  gap: 8px;
  min-width: 140px;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(64, 145, 108, 0.45);
  animation: pulseRecording 1.2s ease-in-out infinite alternate;
}
@keyframes pulseRecording {
  from { box-shadow: 0 4px 12px rgba(64, 145, 108, 0.35); }
  to   { box-shadow: 0 4px 20px rgba(116, 198, 157, 0.7); }
}

.inline-voice-mic {
  font-size: 1.1rem;
  animation: micBlink 0.8s ease-in-out infinite alternate;
}
@keyframes micBlink {
  from { opacity: 0.6; transform: scale(0.95); }
  to   { opacity: 1;   transform: scale(1.1); }
}

.inline-voice-wave {
  display: inline-flex;
  align-items: center;
  gap: 3.5px;
  height: 18px;
}

.inline-voice-bar {
  width: 3px;
  height: 14px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 2px;
  animation: inlineVoiceWave 0.6s ease-in-out infinite alternate;
}
.inline-voice-bar:nth-child(1) { height: 8px;  animation-delay: 0.0s; }
.inline-voice-bar:nth-child(2) { height: 16px; animation-delay: 0.15s; }
.inline-voice-bar:nth-child(3) { height: 10px; animation-delay: 0.3s; }
.inline-voice-bar:nth-child(4) { height: 18px; animation-delay: 0.45s; }
.inline-voice-bar:nth-child(5) { height: 12px; animation-delay: 0.6s; }

@keyframes inlineVoiceWave {
  from { transform: scaleY(0.35); opacity: 0.5; }
  to   { transform: scaleY(1);    opacity: 1; }
}

.inline-voice-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: 0.3px;
}

/* ── 9. Utility Animations ────────────────────────────── */
@keyframes scoreJump {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}
.score-jump { animation: scoreJump 0.4s ease; }

/* ── 10. Mode Badge ─────────────────────────────────── */
.mode-badge {
  font-size: 0.85rem;
  padding: 6px 14px;
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.85));
  border: 2px solid rgba(255,255,255,0.95);
  border-radius: 50px;
  box-shadow: var(--shadow-soft);
  transition: background 0.4s ease, border-color 0.4s ease;
  gap: 5px;
}
.mode-badge.describe-mode {
  background: linear-gradient(135deg, rgba(244,162,97,0.25), rgba(231,111,81,0.15));
  border-color: rgba(244,162,97,0.6);
  color: var(--brown-dark);
}
#mode-badge-icon { font-size: 1rem; }
#mode-badge-text { font-size: 0.82rem; font-weight: 700; }

/* ── 11. Bot-Guess Mode – Describe Speak Button ───────────── */
.speak-btn.describe-mode {
  background: linear-gradient(135deg, var(--orange), var(--coral));
  box-shadow: 0 4px 20px rgba(244,162,97,0.5);
}
.speak-btn.describe-mode:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 28px rgba(244,162,97,0.65);
}
.speak-btn.describe-mode.recording {
  background: linear-gradient(135deg, #e55a2b, #c0392b);
  animation: recordPulse 1s ease-in-out infinite;
}

/* ── 12. Bot-Thinking Bubble ─────────────────────────── */
.bot-thinking-bubble {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.97);
  width: fit-content;
  border-radius: 28px;
  padding: 22px 28px 22px 84px;
  max-width: 80%;
  box-shadow: var(--shadow-soft);
  border: 1.5px solid rgba(255,255,255,0.9);
}
.thinking-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}
.thinking-dot {
  width: 8px;
  height: 8px;
  background: var(--green-mid);
  border-radius: 50%;
  animation: thinkingPop 1.2s ease-in-out infinite;
}
.thinking-dot:nth-child(1) { animation-delay: 0s; }
.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinkingPop {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.35; }
  40% { transform: scale(1.2); opacity: 1; }
}
.thinking-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--brown-dark);
  font-style: italic;
}

/* ── 13. Bot-Guess Round Counter ──────────────────────── */
.bot-guess-round {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brown-mid);
  padding: 5px 12px;
  background: rgba(255,255,255,0.7);
  border-radius: 50px;
  border: 1.5px solid rgba(0,0,0,0.07);
  flex-shrink: 0;
  animation: msgSlideIn 0.3s ease;
}

/* ── 14. Scrollbar Global ────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 4px; }

/* ── 15. Screen 2 design-spec layout ─────────────────────────
   The supplied comp is 3840 × 2160 (2× a 1920 × 1080 CSS layout).
   Every measurement below is tied to that coordinate system. */
#screen-game-play {
  --game-x: min(0.052083333vw, 0.092592593vh);
  --game-green: #43874a;
  --game-brown: #451a04;
  transform: none;
}

#screen-game-play.active {
  transform: none;
}

#screen-game-play .game-hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: block;
  padding: 0;
  pointer-events: none;
}

#screen-game-play .hud-left,
#screen-game-play .hud-right {
  display: contents;
}

#screen-game-play .hud-btn {
  position: absolute;
  top: calc(25 * var(--game-x));
  height: calc(60 * var(--game-x));
  min-height: calc(60 * var(--game-x));
  padding: 0;
  gap: calc(10 * var(--game-x));
  justify-content: center;
  border: 0;
  border-radius: calc(30 * var(--game-x));
  background: #faf8ec;
  color: #3f7135;
  box-shadow: 0 calc(4 * var(--game-x)) calc(15 * var(--game-x)) rgba(50, 31, 16, 0.16);
  font-size: calc(21 * var(--game-x));
  line-height: 1;
  font-weight: 700;
}

#screen-game-play .hud-icon {
  font-size: calc(25 * var(--game-x));
  line-height: 1;
}

#screen-game-play .turn-badge {
  left: calc(35 * var(--game-x));
  width: calc(180 * var(--game-x));
}

#screen-game-play .mode-badge {
  display: none;
}

#screen-game-play .hint-counter {
  right: calc(208.5 * var(--game-x));
  width: calc(107.5 * var(--game-x));
}

#screen-game-play .score-badge {
  right: calc(50 * var(--game-x));
  width: calc(143.5 * var(--game-x));
}

#screen-game-play .game-main {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: block;
  padding: 0;
  overflow: visible;
}

#screen-game-play .image-card-area {
  position: absolute;
  left: calc(350 * var(--game-x));
  top: calc(200 * var(--game-x));
  width: calc(510 * var(--game-x));
  height: calc(680 * var(--game-x));
  padding: 0;
  display: block;
}

#screen-game-play .image-card-flipper {
  width: 100%;
  max-width: none;
  height: 100%;
  aspect-ratio: auto;
}

#screen-game-play .image-card-flipper .card-face {
  border: calc(10 * var(--game-x)) solid #faf2e5;
  border-radius: calc(31 * var(--game-x));
  box-shadow: 0 calc(7 * var(--game-x)) calc(22 * var(--game-x)) rgba(33, 21, 9, 0.18);
}

#screen-game-play .word-label {
  bottom: calc(54 * var(--game-x));
  font-size: calc(42 * var(--game-x));
}

#screen-game-play .chat-area {
  position: absolute;
  left: calc(902.5 * var(--game-x));
  top: calc(230 * var(--game-x));
  width: calc(665 * var(--game-x));
  height: calc(430 * var(--game-x));
  padding: 0 !important;
  gap: calc(15 * var(--game-x));
  overflow: hidden;
}

#screen-game-play .bot-header {
  width: 100%;
  min-height: calc(90 * var(--game-x));
  height: calc(90 * var(--game-x));
  gap: calc(20 * var(--game-x));
  padding: 0 calc(40 * var(--game-x));
  border: 0;
  border-radius: calc(34 * var(--game-x));
  background: #fbf8ef;
  box-shadow: 0 calc(7 * var(--game-x)) calc(18 * var(--game-x)) rgba(45, 40, 25, 0.19);
}

#screen-game-play .bot-avatar {
  width: calc(50 * var(--game-x));
  height: calc(50 * var(--game-x));
  border: 0;
  box-shadow: 0 calc(5 * var(--game-x)) calc(12 * var(--game-x)) rgba(0, 0, 0, 0.25);
}

#screen-game-play .bot-label {
  gap: calc(2 * var(--game-x));
}

#screen-game-play .bot-name {
  color: #28893b;
  font-size: calc(30 * var(--game-x));
  font-weight: 700;
  line-height: 1.1;
}

#screen-game-play .bot-speaking-indicator {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

#screen-game-play .chat-messages {
  gap: calc(15 * var(--game-x));
  padding: 0;
}

#screen-game-play .msg-bubble {
  gap: 0;
  flex: 0 0 auto;
}

#screen-game-play .msg-bubble.bot .bubble-content {
  width: 100% !important;
  max-width: 100%;
  min-height: calc(90 * var(--game-x));
  padding:
    calc(20 * var(--game-x))
    calc(95 * var(--game-x))
    calc(20 * var(--game-x))
    calc(110 * var(--game-x));
  display: flex;
  align-items: center;
  border: 0;
  border-radius: calc(34 * var(--game-x));
  background: #fbf8ef;
  color: var(--game-brown);
  box-shadow: 0 calc(7 * var(--game-x)) calc(18 * var(--game-x)) rgba(45, 40, 25, 0.19);
  font-size: calc(30 * var(--game-x));
  font-weight: 600;
  line-height: 1.48;
  overflow-wrap: normal;
}

#screen-game-play .msg-bubble.bot .bubble-content.description-bubble {
  min-height: calc(220 * var(--game-x));
  color: var(--game-brown);
  font-size: calc(30 * var(--game-x));
  font-weight: 600;
}

#screen-game-play .msg-bubble.bot .msg-avatar {
  left: calc(40 * var(--game-x));
  top: calc(20 * var(--game-x));
  width: calc(50 * var(--game-x));
  height: calc(50 * var(--game-x));
  border: 0;
  box-shadow: 0 calc(5 * var(--game-x)) calc(12 * var(--game-x)) rgba(0, 0, 0, 0.25);
}

#screen-game-play .msg-bubble.user {
  position: relative;
  width: 100%;
  min-height: calc(90 * var(--game-x));
}

#screen-game-play .msg-bubble.user .bubble-content {
  width: 100%;
  max-width: 100%;
  min-height: calc(90 * var(--game-x));
  padding: calc(18 * var(--game-x)) calc(100 * var(--game-x)) calc(18 * var(--game-x)) calc(40 * var(--game-x));
  border-radius: calc(34 * var(--game-x));
  background: linear-gradient(90deg, #4d9855, #347b45);
  box-shadow: 0 calc(7 * var(--game-x)) calc(18 * var(--game-x)) rgba(45, 75, 40, 0.2);
  color: #fff;
  font-size: calc(30 * var(--game-x));
  font-weight: 600;
  line-height: 1.15;
}

#screen-game-play .msg-bubble.user .msg-avatar {
  position: absolute;
  right: calc(40 * var(--game-x));
  top: 50%;
  transform: translateY(-50%);
  width: calc(50 * var(--game-x));
  height: calc(50 * var(--game-x));
  border: 0;
  box-shadow: 0 calc(5 * var(--game-x)) calc(12 * var(--game-x)) rgba(0, 0, 0, 0.25);
}

#screen-game-play .hint-toast {
  width: 100%;
  min-height: calc(90 * var(--game-x));
  padding: calc(18 * var(--game-x)) calc(40 * var(--game-x));
  border-radius: calc(34 * var(--game-x));
  font-size: calc(25 * var(--game-x));
}

#screen-game-play .game-footer {
  position: absolute;
  left: calc(627.5 * var(--game-x));
  top: calc(925 * var(--game-x));
  z-index: 10;
  width: calc(662.5 * var(--game-x));
  height: calc(120 * var(--game-x));
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  gap: calc(15 * var(--game-x));
  padding: 0;
}

#screen-game-play .action-btn {
  min-width: calc(120 * var(--game-x));
  width: calc(120 * var(--game-x));
  min-height: calc(120 * var(--game-x));
  height: calc(120 * var(--game-x));
  gap: calc(8 * var(--game-x));
  padding: 0;
  border-radius: calc(28 * var(--game-x));
}

#screen-game-play .action-icon {
  font-size: calc(42 * var(--game-x));
}

#screen-game-play .action-label {
  color: var(--game-brown);
  font-size: calc(22 * var(--game-x));
  font-weight: 700;
  line-height: 1;
}

#screen-game-play .hint-btn {
  background: linear-gradient(180deg, #ffc04d, #ff9e18);
  box-shadow: 0 calc(5 * var(--game-x)) calc(16 * var(--game-x)) rgba(161, 92, 9, 0.26);
}

#screen-game-play .skip-btn,
#screen-game-play .type-btn {
  border: 0;
  background: #fbf8ef;
  box-shadow: 0 calc(5 * var(--game-x)) calc(16 * var(--game-x)) rgba(50, 31, 16, 0.16);
}

#screen-game-play .skip-btn {
  margin-left: calc(2.5 * var(--game-x));
}

#screen-game-play .speak-btn {
  width: calc(255 * var(--game-x));
  min-width: calc(255 * var(--game-x));
  border-radius: calc(60 * var(--game-x));
  flex-direction: row;
  gap: calc(16 * var(--game-x));
  background: linear-gradient(180deg, #5b9663, #39754a);
  box-shadow: 0 calc(5 * var(--game-x)) calc(18 * var(--game-x)) rgba(36, 91, 52, 0.32);
}

#screen-game-play .speak-btn .action-icon {
  font-size: calc(44 * var(--game-x));
}

#screen-game-play .speak-btn .action-label {
  color: #fff;
  font-size: calc(30 * var(--game-x));
}

#screen-game-play .speak-btn .action-subtitle {
  color: #e6eee7;
  font-size: calc(18 * var(--game-x));
}

#screen-game-play .next-btn {
  width: calc(255 * var(--game-x));
  min-width: calc(255 * var(--game-x));
  margin: calc(15 * var(--game-x)) auto 0;
  border-radius: calc(60 * var(--game-x));
  flex-direction: row;
  gap: calc(14 * var(--game-x));
  background: linear-gradient(180deg, #ffd25a 0%, #ffb521 100%);
  box-shadow: 0 calc(6 * var(--game-x)) calc(18 * var(--game-x)) rgba(161, 92, 9, 0.28);
}

#screen-game-play .next-btn .action-icon {
  font-size: calc(44 * var(--game-x));
}

#screen-game-play .next-btn .action-label {
  color: #411400;
  font-size: calc(30 * var(--game-x));
  font-weight: 700;
}

@media (max-aspect-ratio: 4/3) {
  #screen-game-play .chat-area {
    overflow-y: auto;
  }
}

/* ── 16. Screen 2 / YOU Describe mode ───────────────────────
   Interface 4 uses the same 1920 × 1080 coordinate system, but has
   its own amber conversation palette and a taller message viewport. */
#screen-game-play.bot-guess-mode .chat-area {
  height: calc(470 * var(--game-x));
}

#screen-game-play.bot-guess-mode .bot-name {
  color: #f0a307;
}

#screen-game-play.bot-guess-mode .msg-bubble.bot .bubble-content.description-bubble {
  min-height: calc(175 * var(--game-x));
}

#screen-game-play.bot-guess-mode .msg-bubble.user,
#screen-game-play.bot-guess-mode .msg-bubble.user .bubble-content {
  min-height: calc(175 * var(--game-x));
}

#screen-game-play.bot-guess-mode .msg-bubble.user .bubble-content {
  justify-content: flex-start;
  padding:
    calc(20 * var(--game-x))
    calc(110 * var(--game-x))
    calc(20 * var(--game-x))
    calc(40 * var(--game-x));
  background: linear-gradient(180deg, #f9c94d 0%, #f3b934 100%);
  color: var(--game-brown);
  font-size: calc(32 * var(--game-x));
  line-height: 1.4;
  text-align: left;
  box-shadow: 0 calc(7 * var(--game-x)) calc(18 * var(--game-x)) rgba(115, 73, 13, 0.2);
}

#screen-game-play.bot-guess-mode .game-footer {
  left: calc(765 * var(--game-x));
  width: calc(390 * var(--game-x));
}

#screen-game-play.bot-guess-mode .skip-btn {
  margin-left: 0;
}

#screen-game-play.bot-guess-mode .speak-btn,
#screen-game-play.bot-guess-mode .speak-btn.describe-mode {
  background: linear-gradient(180deg, #f8c649 0%, #f1ae29 100%);
  box-shadow: 0 calc(5 * var(--game-x)) calc(18 * var(--game-x)) rgba(135, 78, 8, 0.28);
}

#screen-game-play.bot-guess-mode .speak-btn .action-label {
  color: var(--game-brown);
}

#screen-game-play.bot-guess-mode .speak-btn .action-subtitle {
  color: var(--game-brown);
}

#screen-game-play .speak-btn.recording,
#screen-game-play.bot-guess-mode .speak-btn.recording,
#screen-game-play.bot-guess-mode .speak-btn.describe-mode.recording {
  background: #e65450;
  box-shadow: 0 calc(5 * var(--game-x)) calc(18 * var(--game-x)) rgba(145, 38, 35, 0.32);
}

#screen-game-play .speak-btn.recording .action-label,
#screen-game-play.bot-guess-mode .speak-btn.recording .action-label {
  color: #fff;
}

/* Error bubble with retry button (chat inline) */
.msg-bubble.bot .error-bubble {
  background: rgba(239, 68, 68, 0.08);
  border: 1.5px solid rgba(239, 68, 68, 0.25);
  border-radius: 28px;
  padding: 20px 24px 16px 24px;
  max-width: 80%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  animation: msgSlideIn 0.3s ease-out;
}

.msg-bubble.bot .error-bubble .error-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.msg-bubble.bot .error-bubble .error-text {
  color: #b91c1c;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
}

.msg-bubble.bot .error-bubble .retry-btn {
  align-self: flex-end;
  background: linear-gradient(135deg, #fca5a5, #f87171);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.msg-bubble.bot .error-bubble .retry-btn:hover {
  background: linear-gradient(135deg, #f87171, #ef4444);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
  transform: translateY(-1px);
}

.msg-bubble.bot .error-bubble .retry-btn:active {
  transform: scale(0.96);
}

.msg-bubble.bot .error-bubble .retry-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
