/* ============================================================================
   The Melt - Mumble Guide (learn) - shared styles
   Header/start-screen/brick/legend/pattern-library styling ported verbatim
   from stress/learn's own assets/style.css - same trio family, same visual
   language, no reinvention. Two things this app doesn't need, so they're
   dropped rather than carried over unused: the locale toggle (the source
   guide is AmE-only; there's no structured UK mumble data to switch to) and
   the local guide-page/rule-card styling (this app's "?" buttons link out to
   ../melt.html directly - that page already *is* the
   guide, so there's nothing to duplicate here).
   ============================================================================ */

:root {
  --bg-color: #232323;
  --card-color: #1d1d1d;
  --accent-gold: #e6c27a;
  --hot-pink: #FF2E88;
  --light-gray: #D8D8D8;
  --darker-gray: #888888;
  --stage-bg: #0A0A0A;

  --stress-primary: #FFB74D;
  --stress-none: #9E9E9E;
  --stress-primary-mid: #FFA9D6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background-color: var(--bg-color);
  color: var(--light-gray);
  font-family: Verdana, Geneva, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 60px;
}

a { color: inherit; }

.game-body { padding-bottom: 0; }

#pause-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(6px);
  z-index: 1050;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}
#pause-overlay.visible { display: flex; }
#pause-overlay .paused-label {
  color: var(--accent-gold);
  font-size: 1.3rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* -------------------------------------------------------------------------
   Header (shared: start screen, game)
   ------------------------------------------------------------------------- */
header.app-header {
  position: sticky;
  top: 0;
  background-color: rgba(18, 18, 18, 0.95);
  backdrop-filter: blur(5px);
  border-bottom: 2px solid var(--card-color);
  padding: 15px 20px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-title { display: flex; align-items: center; gap: 12px; }
.logo-link { display: inline-flex; border-radius: 50%; line-height: 0; flex-shrink: 0; }
.logo-img { width: 56px; height: 56px; border-radius: 50%; display: block; object-fit: cover; }

.back-link {
  color: var(--darker-gray);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: color 0.2s;
}
.back-link:hover { color: var(--accent-gold); }

header.app-header h1 {
  color: var(--accent-gold);
  font-size: 1.3rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.game-controls { display: flex; align-items: center; gap: 8px; }
.game-controls .icon-btn[data-action="exit"]:hover { border-color: var(--hot-pink); color: var(--hot-pink); }

.icon-btn {
  background: none;
  border: 1px solid #444;
  color: var(--darker-gray);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.icon-btn:hover { border-color: var(--accent-gold); color: var(--accent-gold); }
.icon-btn svg { width: 16px; height: 16px; fill: currentColor; }

/* -------------------------------------------------------------------------
   Start screen
   ------------------------------------------------------------------------- */
.hero { max-width: 800px; margin: 30px auto 0; padding: 0 20px; }
.hero p { color: #c8c8c8; font-size: 1.05rem; }

main { max-width: 800px; margin: 0 auto; padding: 20px; }

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.level-card {
  background-color: var(--card-color);
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.level-title { font-size: 1.1rem; font-weight: 800; margin-bottom: 4px; }
.level-desc { color: #999; font-size: 0.85rem; margin-bottom: 14px; }

.group-actions { display: flex; gap: 10px; margin-top: auto; }

.go-btn,
.help-btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 0.9rem;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  padding: 8px 0;
  text-decoration: none;
  text-align: center;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.go-btn { flex: 1 1 auto; background-color: var(--accent-gold); color: #121212; padding: 8px 20px; }
.help-btn { width: 36px; flex: 0 0 auto; background-color: #2a2a2a; color: var(--light-gray); border: 1px solid #3a3a3a; }
.go-btn:hover,
.help-btn:hover { transform: translateY(-1px); opacity: 0.92; }

.resume-btn {
  margin: 22px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background-color: var(--accent-gold);
  color: #121212;
  font-family: inherit;
  font-weight: 800;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 14px 28px;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 0 rgba(230, 194, 122, 0);
}
.resume-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(230, 194, 122, 0.25);
}
.resume-btn:disabled {
  background-color: var(--card-color);
  color: var(--darker-gray);
  cursor: default;
}

/* -------------------------------------------------------------------------
   Game screen
   ------------------------------------------------------------------------- */
.game-shell {
  max-width: 700px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.word-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0px;
  min-height: 38vh;
  width: 100%;
  background-color: var(--stage-bg);
  padding: 40px 16px 20px;
  transition: gap 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.word-stage.split { gap: 18px; }

.brick {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 150px;
  min-width: 120px;
  padding: 0 34px;
  border-radius: 8px;
  background-color: #2a2a2a;
  border: 1px solid #3a3a3a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -2px 0 rgba(0, 0, 0, 0.25);
  color: var(--light-gray);
  font-weight: 800;
  font-size: clamp(2.4rem, 6.5vw, 4.4rem);
  letter-spacing: 0.02em;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px) scale(0.94);
  transition: transform 0.4s, height 0.6s, padding 0.6s, background-color 0.6s, border-color 0.6s, box-shadow 0.6s, color 0.6s, opacity 0.4s, font-size 0.6s, min-width 0.6s;
  user-select: none;
}
.brick.visible { opacity: 1; transform: none; }

.brick.brick-intro {
  height: auto;
  min-width: 0;
  padding: 0;
  border-radius: 0;
  background-color: transparent;
  border-color: transparent;
  box-shadow: none;
  color: #FFFFFF;
  font-size: clamp(3.8rem, 10.5vw, 7.5rem);
  cursor: default;
}

.brick:hover { transform: translateY(-3px); }

.brick.revealed.stress-none {
  height: 118px;
  padding: 0 26px;
  background-color: var(--stress-none);
  border-color: var(--stress-none);
  color: #1a1a1a;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2), inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}

.brick.revealed.stress-primary {
  animation: brickRise 1.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes brickRise {
  0% {
    height: 150px;
    padding: 0 34px;
    font-size: clamp(2.4rem, 6.5vw, 4.4rem);
    background-color: #2a2a2a;
    border-color: #3a3a3a;
    color: var(--light-gray);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -2px 0 rgba(0, 0, 0, 0.25);
  }
  55% {
    height: 205px;
    padding: 0 88px;
    font-size: clamp(3.6rem, 9.5vw, 6.6rem);
    background-color: var(--stress-primary-mid);
    border-color: var(--stress-primary-mid);
    color: #3a0022;
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3), inset 0 -3px 0 rgba(0, 0, 0, 0.2),
      0 0 30px rgba(255, 169, 214, 0.4);
  }
  100% {
    height: 148px;
    padding: 0 94px;
    font-size: clamp(3.6rem, 9.5vw, 6.6rem);
    background-color: var(--stress-primary);
    border-color: var(--stress-primary);
    color: #1a1200;
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.25), inset 0 -3px 0 rgba(0, 0, 0, 0.25),
      0 0 26px rgba(255, 183, 77, 0.45);
  }
}

.legend-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 0.95rem;
  color: var(--darker-gray);
}
.legend-row span { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend-dot.primary { background-color: var(--stress-primary); }
.legend-dot.none { background-color: var(--stress-none); }

.rule-hint {
  max-width: 520px;
  text-align: center;
  color: #999;
  font-size: 0.88rem;
  min-height: 20px;
}

/* The contraction spelling shown under the brick animation (e.g. HE'S) -
   bigger and bolder than a generic .rule-hint, since it's the answer being
   confirmed, not a passing tip. */
#word-note {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--light-gray);
  letter-spacing: 0.03em;
}

.site-footer {
  text-align: center;
  color: var(--darker-gray);
  font-size: 0.8rem;
  margin-top: 40px;
}

.no-results {
  display: none;
  text-align: center;
  padding: 40px;
  color: var(--darker-gray);
}

/* -------------------------------------------------------------------------
   Word navigation within a selected pattern - prev/next only.
   ------------------------------------------------------------------------- */
.word-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#word-picker {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 4px;
}
#word-picker.visible { display: flex; }

.word-nav-btn {
  background: transparent;
  border: 1px solid #3a3a3a;
  color: var(--light-gray);
  font-family: inherit;
  font-size: 20px;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.word-nav-btn:hover:not(:disabled) { border-color: var(--accent-gold); color: var(--accent-gold); }
.word-nav-btn:disabled { opacity: 0.3; cursor: default; }

.word-nav-line { width: 56px; height: 0; border-top: 2px dotted #444; opacity: 0.7; }

/* Caption block shown under the word picker once a word has been played:
   just the "in a phrase" example now (English, then its own mumble) - the
   contraction and its full form(s) moved up into #word-note, paired
   together (e.g. "HE IS - HE'S"), so repeating the full form here would
   be redundant. */
#word-meta { font-size: 0.8rem; color: var(--darker-gray); text-align: center; }
.phrase-line { font-size: 1.05rem; font-weight: bold; font-style: italic; }
.phrase-line .phrase-en { color: #999; }
.phrase-line .phrase-mumble { color: var(--accent-gold); font-weight: 700; margin-left: 8px; }

/* -------------------------------------------------------------------------
   Pattern library
   ------------------------------------------------------------------------- */
#pattern-library { max-width: 820px; margin: 0 auto; width: 100%; padding: 20px; }

.pattern-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); justify-content: center; gap: 12px; }

.pattern-card {
  position: relative;
  min-width: 0;
  background: var(--card-color);
  border: 1px solid #252525;
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}
.pattern-card:hover { border-color: #3a3a3a; transform: translateY(-2px); }
.pattern-card.active { border-style: dotted; border-width: 2px; border-color: var(--accent-gold); }
.pattern-card .p-name { font-size: 0.9rem; font-weight: 800; color: var(--accent-gold); letter-spacing: 0.02em; }

@media (max-width: 480px) {
  .word-stage { gap: 10px; min-height: 36vh; }
  .brick { min-width: 76px; padding: 0 18px; }
}
