/* ==========================================================================
   I love Julia — terminal rosa
   ========================================================================== */

:root {
  --font: 'JetBrains Mono', 'Cascadia Mono', Consolas, 'SF Mono', Menlo,
          'DejaVu Sans Mono', monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --theme-t: .9s;
}

/* Tema 1: o CMD sem graça de sempre */
body[data-theme='classic'] {
  --page: #0a0a0a;
  --bg: #0c0c0c;
  --fg: #cccccc;
  --dim: #7a7a7a;
  --accent: #cccccc;
  --hot: #ffffff;
  --bar: #2b2b2b;
  --bar-fg: #f2f2f2;
  --border: #3b3b3b;
  --glow: rgba(255, 122, 184, 0);
  --shadow: rgba(0, 0, 0, .6);
}

/* Tema 2: a cor favorita dela */
body[data-theme='rosa'] {
  --page: #ffe6f1;
  --bg: #1d0a15;
  --fg: #ffe3f0;
  --dim: #c58aa7;
  --accent: #ff7ab8;
  --hot: #ffffff;
  --bar: #ff6fae;
  --bar-fg: #ffffff;
  --border: #ff9ccb;
  --glow: rgba(255, 122, 184, .45);
  --shadow: rgba(214, 51, 132, .45);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--page);
  color: var(--fg);
  font-family: var(--font);
  font-size: clamp(12.5px, 0.55vw + 10.5px, 15px);
  line-height: 1.55;
  transition: background-color var(--theme-t);
  -webkit-text-size-adjust: 100%;
}

button { font: inherit; color: inherit; }

/* ---------- fundo da página (rosa + branco) ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 1.4s;
  background:
    radial-gradient(60% 50% at 15% 10%, #ffffff 0, transparent 70%),
    radial-gradient(55% 55% at 90% 95%, #ff9fcb 0, transparent 70%),
    radial-gradient(40% 40% at 85% 10%, #ffd0e6 0, transparent 70%),
    linear-gradient(135deg, #fff3f8, #ffc7df);
}
body[data-theme='rosa'] .backdrop { opacity: 1; }

.backdrop::after {            /* gradezinha de pontinhos */
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 111, 174, .35) 1px, transparent 1.5px);
  background-size: 22px 22px;
  mask-image: radial-gradient(circle at center, transparent 30%, #000 100%);
  -webkit-mask-image: radial-gradient(circle at center, transparent 30%, #000 100%);
}

.floater {
  position: absolute;
  bottom: -3em;
  color: #ff7ab8;
  opacity: 0;
  animation: float-up linear infinite;
  text-shadow: 0 0 12px rgba(255, 255, 255, .9);
}
.floater:nth-child(3n) { color: #ffffff; text-shadow: 0 0 10px #ff7ab8; }

@keyframes float-up {
  0%   { transform: translate3d(0, 0, 0) rotate(-8deg); opacity: 0; }
  10%  { opacity: .75; }
  90%  { opacity: .75; }
  100% { transform: translate3d(var(--drift, 30px), -115vh, 0) rotate(12deg); opacity: 0; }
}

/* ---------- janela ---------- */

.window {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(920px, 100vw - 32px);
  height: min(640px, 100dvh - 32px);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
  box-shadow: 0 30px 80px -18px var(--shadow), 0 0 0 1px rgba(255, 255, 255, .04) inset;
  transition: background-color var(--theme-t), border-color var(--theme-t),
              box-shadow var(--theme-t);
}

.window.shake { animation: shake .45s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px) rotate(-.4deg); }
  40% { transform: translateX(8px) rotate(.4deg); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(4px); }
}
.window.squish { animation: squish .6s var(--ease); }
@keyframes squish {
  35% { transform: scale(.92, .86) translateY(18px); }
  70% { transform: scale(1.015); }
}
.window.pop { animation: pop .5s var(--ease); }
@keyframes pop {
  40% { transform: scale(1.03); }
}

.titlebar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  height: 38px;
  padding-left: 12px;
  background: var(--bar);
  color: var(--bar-fg);
  font-size: 12.5px;
  user-select: none;
  transition: background-color var(--theme-t), color var(--theme-t);
}
.titlebar__icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 18px;
  border-radius: 3px;
  background: var(--bg);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: -1px;
  transition: background-color var(--theme-t), color var(--theme-t);
}
.titlebar__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.titlebar__controls { display: flex; height: 100%; }
.titlebar__controls button {
  width: 44px;
  height: 100%;
  border: 0;
  background: transparent;
  font-size: 12px;
  cursor: pointer;
  transition: background-color .15s;
}
.titlebar__controls button:hover { background: rgba(255, 255, 255, .18); }
.titlebar__controls button[data-ctl='close']:hover { background: #e81160; }

/* ---------- tela ---------- */

.screen {
  position: relative;
  flex: 1;
  min-height: 0;
}

.rain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 2s;
  pointer-events: none;
}
body[data-theme='rosa'] .rain { opacity: .2; }
body[data-theme='rosa'].matrix .rain { opacity: .6; }

.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, .028) 0 1px, transparent 1px 3px),
    radial-gradient(120% 90% at 50% 50%, transparent 60%, rgba(0, 0, 0, .35) 100%);
}

.scroll {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px 16px 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
  overscroll-behavior: contain;
}

.line {
  min-height: 1.55em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-shadow: 0 0 9px var(--glow);
  transition: color var(--theme-t), text-shadow var(--theme-t);
}
.line.dim, .dim { color: var(--dim); }
.line.hot, .hot { color: var(--hot); }
.line.pink, .pink { color: var(--accent); }
.line.center { text-align: center; }
.line.bold, .bold { font-weight: 700; }
.path { color: var(--accent); transition: color var(--theme-t); }
.cmd { color: var(--hot); }

.line.fade { animation: fade-in .5s both; }
@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
}

/* ---------- prompt ---------- */

.prompt {
  position: relative;
  display: block;
  min-height: 1.55em;
  margin: 0;
  overflow-wrap: anywhere;
  text-shadow: 0 0 9px var(--glow);
  cursor: text;
}
.prompt .path, .prompt__text { white-space: pre-wrap; }
.prompt[hidden] { display: none; }
.prompt__text { color: var(--hot); }
.prompt input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  opacity: 0;
  font-size: 16px;            /* evita zoom automático no iOS */
  background: transparent;
  color: transparent;
  caret-color: transparent;
}

.cursor {
  display: inline-block;
  width: .62em;
  height: 1.15em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--accent);
  box-shadow: 0 0 10px var(--glow);
  animation: blink 1.05s steps(1) infinite;
}
.prompt:not(:focus-within) .cursor {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--accent);
  animation: none;
}
@keyframes blink { 50% { opacity: 0; } }

.skip {
  position: absolute;
  right: 12px;
  bottom: 10px;
  padding: 5px 10px;
  border: 1px solid var(--dim);
  border-radius: 6px;
  background: rgba(0, 0, 0, .35);
  color: var(--dim);
  font-size: 11.5px;
  cursor: pointer;
  transition: color .2s, border-color .2s, opacity .4s;
}
.skip:hover { color: var(--hot); border-color: var(--hot); }
.skip[hidden] { display: none; }

/* ---------- barra de comandos (pra tocar no celular) ---------- */

.chips {
  display: flex;
  flex: none;
  gap: 8px;
  padding: 9px 12px calc(9px + env(safe-area-inset-bottom, 0px));
  overflow-x: auto;
  border-top: 1px solid rgba(255, 122, 184, .28);
  background: rgba(255, 122, 184, .07);
  scrollbar-width: none;
  animation: fade-in .6s both;
}
.chips[hidden] { display: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: none;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(255, 122, 184, .55);
  border-radius: 7px;
  background: rgba(255, 122, 184, .08);
  color: var(--fg);
  font-size: 12.5px;
  cursor: pointer;
  transition: background-color .15s, color .15s, transform .15s, box-shadow .15s;
}
.chips button::before { content: '> '; color: var(--accent); }
.chips button:hover {
  background: var(--accent);
  color: #2a0d1c;
  box-shadow: 0 0 18px var(--glow);
}
.chips button:hover::before { color: #2a0d1c; }
.chips button:active { transform: scale(.95); }
.chips button:focus-visible,
.titlebar__controls button:focus-visible,
.skip:focus-visible,
.game__quit:focus-visible { outline: 2px solid var(--hot); outline-offset: 2px; }
.chips.busy button { opacity: .45; pointer-events: none; }

/* ---------- banner "I LOVE JULIA" em pixels ---------- */

.banner {
  --px: clamp(6px, 1.05vw, 9px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: calc(var(--px) * 3) calc(var(--px) * 4);
  margin: clamp(14px, 4vh, 34px) 0 calc(var(--px) * 3);
}
.banner__word {
  --c: #ffffff;
  --c2: #ff7ab8;
  --sh: #b83a7b;
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--px));
  grid-auto-rows: var(--px);
  filter: drop-shadow(0 0 calc(var(--px) * 1.2) rgba(255, 122, 184, .65));
}
.banner__word.is-love {
  --c: #ff5fa8;
  --c2: #ffffff;
  --sh: #8e1f58;
}
.banner__word i.on {
  background: var(--c);
  box-shadow: calc(var(--px) * .32) calc(var(--px) * .32) 0 var(--sh);
  animation:
    px-in .55s var(--ease) calc(var(--i) * 17ms) both,
    px-shine 4.2s linear calc(var(--i) * 34ms + 1.6s) infinite;
}
@keyframes px-in {
  0%   { transform: scale(0) rotate(45deg); background: #ffffff; }
  60%  { transform: scale(1.3); background: #ffffff; }
  100% { transform: scale(1); }
}
@keyframes px-shine {
  0%, 9%, 100% { background: var(--c); }
  4.5% { background: var(--c2); }
}

/* ---------- coração ASCII ---------- */

.heart {
  width: max-content;
  max-width: 100%;
  margin: 10px auto;
  color: var(--accent);
  font: inherit;
  font-size: clamp(9px, 2.45vw, 14px);
  line-height: 1.12;
  text-shadow: 0 0 10px var(--glow);
  transform-origin: 50% 55%;
}
.heart.beat { animation: beat 1.1s ease-in-out infinite; }
@keyframes beat {
  0%, 100% { transform: scale(1); }
  12% { transform: scale(1.09); }
  24% { transform: scale(1); }
  36% { transform: scale(1.06); }
  50% { transform: scale(1); }
}

/* ---------- jogo do coelho ---------- */

.game {
  width: 100%;
  max-width: 620px;
  margin: 8px auto 10px;
  border: 1px solid rgba(255, 122, 184, .6);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(10, 2, 7, .72);
  box-shadow: 0 0 26px -6px var(--glow);
  animation: fade-in .5s both;
}
.game__hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px dashed rgba(255, 122, 184, .4);
  font-size: .95em;
}
.game__letters { white-space: pre; color: var(--dim); font-weight: 700; }
.game__letters b { color: var(--hot); text-shadow: 0 0 10px var(--accent); }
.game__quit {
  border: 0;
  background: none;
  color: var(--dim);
  cursor: pointer;
  white-space: nowrap;
}
.game__quit:hover { color: var(--hot); }
.game canvas {
  display: block;
  width: 100%;
  height: var(--game-h, clamp(150px, 46dvh, 360px));
  touch-action: none;
  cursor: grab;
}
.game__hint {
  padding: 5px 10px 7px;
  border-top: 1px dashed rgba(255, 122, 184, .4);
  color: var(--dim);
  font-size: .88em;
  text-align: center;
}
.game.over canvas { cursor: default; }
.game.over .game__quit { visibility: hidden; }

/* ---------- partículas de coração ---------- */

.fx {
  position: fixed;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  pointer-events: none;
}
.fx span {
  position: absolute;
  font-family: var(--font);
  text-shadow: 0 0 12px rgba(255, 95, 168, .9);
  animation: burst var(--t, 1.6s) cubic-bezier(.15, .7, .3, 1) both;
  will-change: transform, opacity;
}
@keyframes burst {
  0%   { transform: translate(-50%, -50%) scale(.2); opacity: 0; }
  12%  { opacity: 1; }
  100% {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy)))
               scale(var(--s)) rotate(var(--r));
    opacity: 0;
  }
}

/* ---------- sem JavaScript ---------- */

.noscript {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  margin: 0;
  background: #1d0a15;
  color: #ff7ab8;
  font: 700 28px var(--font);
}

/* ---------- celular ---------- */

@media (max-width: 600px) {
  .window {
    width: calc(100vw - 14px);
    height: calc(100dvh - 14px);
  }
  .scroll { padding: 12px 12px 16px; }
  .banner { --px: calc((100vw - 46px) / 31); }
  .titlebar__controls button { width: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  .floater, .heart.beat, .banner__word i.on { animation: none; }
  .window.shake, .window.squish, .window.pop { animation: none; }
}
