:root {
  --bg: #0f1724;
  --panel: rgba(16, 24, 38, .92);
  --text: #dfe8f2;
  --muted: #8a9bb0;
  --accent: #f2c14e;
  --green: #5ac002;
  --line: rgba(255, 255, 255, .1);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, sans-serif;
}
canvas { position: fixed; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
#safe { position: fixed; left: 0; bottom: 0; width: 0; height: env(safe-area-inset-bottom, 0px); pointer-events: none; }

#top {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 14px 18px; pointer-events: none;
}
#top a { pointer-events: auto; }
.logo { font: 600 16px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text); text-decoration: none; white-space: nowrap; }
.logo .mark { color: var(--green); }
.cursor {
  display: inline-block; width: 8px; height: 15px; margin-left: 4px;
  background: var(--green); vertical-align: -2px; animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
/* casinha + plaquinhas, apoiadas no chão do jardim (GROUND = altura - 76px) */
#home {
  position: fixed; right: 24px; bottom: 74px;
  display: flex; align-items: flex-end; gap: 14px;
  pointer-events: none;
}
.house { width: 124px; height: auto; display: block; }
.house .window { animation: lamp 5s ease-in-out infinite; }
.house .lightspill { animation: spill 5s ease-in-out infinite; }
@keyframes lamp { 0%, 100% { fill: #f6c96a; } 47% { fill: #f9d47f; } 50% { fill: #eab75a; } 53% { fill: #f7cf74; } }
@keyframes spill { 0%, 100% { opacity: 1; } 50% { opacity: .8; } }
.house .smoke circle { fill: rgba(200, 210, 225, .25); animation: smoke 4.5s linear infinite; }
.house .smoke circle:nth-child(2) { animation-delay: 1.5s; }
.house .smoke circle:nth-child(3) { animation-delay: 3s; }
@keyframes smoke {
  0% { transform: translate(0, 0) scale(.6); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translate(10px, -26px) scale(1.8); opacity: 0; }
}
.house .smoke circle { transform-box: fill-box; transform-origin: center; }

.signs { display: flex; align-items: flex-end; gap: 12px; padding-bottom: 0; }
.sign {
  pointer-events: auto; display: flex; flex-direction: column; align-items: center;
  text-decoration: none; outline: none; transition: transform .2s;
}
.sign .board {
  display: grid; place-items: center; width: 34px; height: 30px;
  background: #7a5638; border: 2px solid #5a3e2b; border-radius: 4px;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18), 0 2px 6px rgba(0, 0, 0, .35);
  transition: background .2s, box-shadow .2s;
}
.sign svg { width: 17px; height: 17px; fill: #f1e6d2; }
.sign.s4 svg { width: 22px; }
.sign .post { width: 4px; background: #5a3e2b; border-radius: 1px; }
.sign.s1 .post { height: 26px; transform: rotate(-2deg); }
.sign.s2 .post { height: 16px; }
.sign.s3 .post { height: 30px; transform: rotate(2deg); }
.sign.s4 .post { height: 20px; }
.sign:hover, .sign:focus-visible { transform: translateY(-3px) rotate(-2deg); }
.sign:hover .board, .sign:focus-visible .board {
  background: #8c6443; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18), 0 0 14px rgba(246, 201, 106, .45);
}

button {
  background: rgba(255, 255, 255, .06); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
  cursor: pointer; font: inherit; font-size: 13px;
}
button:hover { background: rgba(255, 255, 255, .12); }

#dock { position: fixed; right: 14px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 8px; }
#dock button { display: flex; align-items: center; gap: 6px; background: var(--panel); }
#dock button.on { border-color: rgba(242, 193, 78, .55); }
#dock button.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242, 193, 78, 0); border-color: var(--line); }
  50% { box-shadow: 0 0 0 6px rgba(242, 193, 78, .18); border-color: rgba(242, 193, 78, .7); }
}

#panel {
  position: fixed; right: 14px; bottom: 70px; width: 290px;
  max-height: calc(100vh - 140px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 4px 14px 12px; backdrop-filter: blur(6px);
  display: none;
}
#panel.open { display: block; }
#panel h2 {
  font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: .06em; margin: 14px 0 6px;
}
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 7px 0; }
.row label { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 6px; }
kbd {
  font: 11px ui-monospace, monospace; color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px; padding: 0 4px;
}
input[type=checkbox], input[type=range] { accent-color: var(--accent); }
input[type=range] { width: 100px; }
.val { color: var(--muted); font-size: 12px; min-width: 48px; text-align: right; }
.btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.btns button { flex: 1 1 auto; }
select {
  background: rgba(255, 255, 255, .06); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 3px 4px; font: inherit; font-size: 13px;
}
select option { background: #1a2433; }
.chords { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 6px 0; }
.chords select { width: 100%; }
.hint { color: var(--muted); font-size: 12px; margin-top: 12px; }
.hint b { color: var(--text); font-weight: 600; }

#hint {
  position: fixed; left: 50%; top: 170px; transform: translateX(-50%);
  color: var(--muted); font-size: 13px; white-space: nowrap;
  background: rgba(16, 24, 38, .65); padding: 6px 14px; border-radius: 999px;
  pointer-events: none; transition: opacity .8s;
}
#hint.gone { opacity: 0; }
#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 14px; opacity: 0; transition: opacity .3s; pointer-events: none; text-align: center;
}
#toast.show { opacity: 1; }

@media (max-width: 600px) {
  #dock .lbl { display: none; }
  #panel { left: 12px; right: 12px; width: auto; max-height: 65vh; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
  #hint { white-space: normal; width: max-content; max-width: calc(100vw - 32px); text-align: center; }
  #home { right: 10px; gap: 8px; }
  .house { width: 84px; }
  .signs { gap: 7px; }
  .sign .board { width: 28px; height: 25px; }
  .sign svg { width: 14px; height: 14px; }
  .sign.s4 svg { width: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .cursor, .house .window, .house .lightspill, .house .smoke circle { animation: none; }
  .house .smoke { display: none; }
}

/* casinha clicável + cartinha "sobre mim" */
.houseBtn {
  background: none; border: 0; padding: 0; border-radius: 6px; cursor: pointer;
  pointer-events: none; /* só as formas pintadas da casa recebem clique */
}
.houseBtn svg > * { pointer-events: auto; }
.houseBtn .lightspill, .houseBtn .smoke { pointer-events: none; }
.houseBtn:hover, .houseBtn:focus-visible { background: none; filter: drop-shadow(0 0 10px rgba(246, 201, 106, .35)); outline: none; }
.house.lit .window { animation: none; fill: #ffe7a3; }
.house.lit .lightspill { animation: none; transform: scale(1.35); transform-box: fill-box; transform-origin: center; }

#about {
  position: fixed; right: 20px; width: min(300px, calc(100vw - 32px));
  background: #f3ead8; color: #3b2a1e; border-radius: 6px; padding: 16px 18px 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 0 40px rgba(246, 201, 106, .15);
  font: 15px/1.5 Georgia, 'Iowan Old Style', serif;
  transform-origin: bottom right; animation: letter .25s ease-out;
}
#about[hidden] { display: none; }
@keyframes letter { from { opacity: 0; transform: translateY(8px) rotate(1deg) scale(.96); } to { opacity: 1; transform: none; } }
#about h2 { margin: 0 0 8px; font-size: 18px; }
#about p { margin: 0 0 8px; }
#about .sign-off { font-style: italic; color: #7a5a3e; text-align: right; margin: 6px 0 0; }
#about .close {
  position: absolute; top: 4px; right: 6px; background: none; border: 0;
  color: #7a5a3e; font-size: 22px; line-height: 1; padding: 4px 8px;
}
#about::after {
  content: ''; position: absolute; bottom: -8px; right: 54px;
  border: 8px solid transparent; border-top-color: #f3ead8; border-bottom: 0;
}
@media (prefers-reduced-motion: reduce) { #about { animation: none; } }

/* atalhos discretos: + nuvem, + folha */
#quick {
  position: fixed; left: 16px; top: 50px; display: flex; gap: 6px;
  opacity: .4; transition: opacity .2s;
}
#quick:hover, #quick:focus-within { opacity: 1; }
#quick button { background: rgba(16, 24, 38, .55); border-radius: 999px; padding: 3px 10px; font-size: 13px; }
@media (hover: none) { #quick { opacity: .6; } }
