* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; color: #222; }
body { display: flex; flex-direction: column; gap: 1rem; background: #fafafa; }
header, footer { text-align: center; }
header { padding-top: 1rem; }

/* Header with right-side ad */
.header-with-ad { position: relative; }
.header-inner { position: relative; display: flex; align-items: flex-start; justify-content: center; padding: 0 1rem; }
.header-title { padding-right: 340px; /* reserva espaço para o banner 300px + margem */ }
.ads-right { position: absolute; top: 0; right: 1rem; width: 300px; }

main { display: grid; place-items: center; gap: 1rem; padding: 0 1rem 2rem; }

.circle-container { display: grid; grid-template-columns: auto 360px; gap: 1rem; align-items: start; justify-content: center; width: 100%; }
 .circle {
  position: relative;
  width: clamp(280px, 70vw, 520px);
  height: clamp(280px, 70vw, 520px);
  border-radius: 50%;
  background: radial-gradient(circle at center, #fff 45%, #f0f0f0 46%, #e9e9e9 48%, #ddd 50%, #f9f9f9 51%);
  box-shadow: 0 1px 3px rgba(0,0,0,.1), inset 0 0 40px rgba(0,0,0,.05);
}

/* Center display for clef and key signature */
.center-display {
  position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  display: grid;
  gap: .4rem;
  place-items: center;
  padding: .4rem .6rem;
  background: rgba(255,255,255,0.85);
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  min-width: 120px;
}
.center-clef-row { display: flex; align-items: center; gap: .4rem; }
.clef-label { font-size: .85rem; color: #555; }
.clef-select { font-size: .9rem; padding: .15rem .35rem; border-radius: 6px; border: 1px solid #ddd; background: #fff; }

.keysig { font-size: 2.2rem; line-height: 1; font-weight: 400; letter-spacing: .08em; }
.keysig .clef { margin-right: .25rem; }
.keysig .acc { display: inline-block; min-width: .6ch; text-align: center; }

.note {
  position: absolute;
  width: 64px; height: 64px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: white;
  border: 2px solid #ddd;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
  user-select: none;
}

.note:hover {
  transform: translate(-50%, -50%) scale(1.06);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  border-color: #bbb;
}
.note.selected {
  transform: translate(-50%, -50%) scale(1.06);
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
  border-color: #8ab4ff;
  background: #f5faff;
}

.note .label { font-weight: 700; font-size: 0.95rem; text-align: center; line-height: 1.05; }
.note .sub { font-size: 0.7rem; color: #666; }

.panel { width: min(1100px, 96vw); background: white; border: 1px solid #e6e6e6; border-radius: 12px; padding: 1rem; box-shadow: 0 2px 8px rgba(0,0,0,.06); display: grid; grid-template-columns: 1fr; gap: 1rem; align-items: start; }
.panel-left { display: grid; gap: .75rem; }
.help { color: #666; margin-bottom: .5rem; }
.output { min-height: 120px; display: grid; gap: .75rem; }
.placeholder { color: #888; }

.instruments { display: grid; gap: .6rem; border-left: 1px dashed #eee; padding-left: 1rem; }
.instr-title { font-weight: 700; color: #333; }
.instr-hint { color: #777; font-size: .9rem; }

/* Piano */
.piano { position: relative; width: 100%; height: 140px; background: #f8f8f8; border: 1px solid #eee; border-radius: 8px; display: grid; place-items: center; }
.piano svg { width: 100%; height: 100%; display: block; }
.piano .key-white.active { fill: #7db9ff !important; }
.piano .key-black.active { fill: #2c6acb !important; }

/* Guitar */
.gtr-controls { display: flex; align-items: center; gap: .4rem; }
.gtr-controls label { font-size: .9rem; color: #555; }
.gtr-controls select { font-size: .9rem; padding: .15rem .35rem; border-radius: 6px; border: 1px solid #ddd; background: #fff; }
.guitar { position: relative; width: 100%; height: 180px; background: #faf9f6; border: 1px solid #eee; border-radius: 8px; display: grid; place-items: center; }
.guitar svg { width: 100%; height: 100%; display: block; }
.guitar .fret-dot { fill: #ff7f50; stroke: #d95d2b; }
.guitar .barre { fill: rgba(0,0,0,0.18); stroke: rgba(0,0,0,0.25); stroke-width: 1; }
.guitar .marker-text { font-size: 10px; fill: #333; }
.guitar .finger-text { font-size: 9px; fill: #fff; font-weight: 700; pointer-events: none; }
.guitar .barre-finger-text { font-size: 9px; fill: #333; font-weight: 700; pointer-events: none; }

.fields { display: grid; gap: .75rem; }
.field-block { border: 1px solid #eee; border-radius: 10px; padding: .75rem; background: #fcfcfc; }
.field-title { font-weight: 700; margin-bottom: .5rem; }
.chords { display: flex; flex-wrap: wrap; gap: .5rem .6rem; }
.chord { padding: .35rem .55rem; border-radius: 999px; background: #eef6ff; border: 1px solid #d7e9ff; font-weight: 600; font-size: .95rem; cursor: pointer; }
.chord:hover { background: #e4f0ff; }
.chord.selected { background: #d9e9ff; border-color: #bcd6ff; }
.degree { color: #666; font-weight: 600; margin-right: .25rem; }

/* Responsive */
@media (max-width: 1200px) {
  /* Em vez de esconder, reposiciona o bloco para layout vertical */
  .ads-right {
    position: static;
    width: 100%;
    height: auto; /* deixa o AdSense se ajustar */
    margin: .5rem 0 0 0;
  }
  .header-title { padding-right: 0; }
}


@media (max-width: 800px) {
  .panel { grid-template-columns: 1fr; }
  .circle-container { grid-template-columns: 1fr; }
  .instruments { border-left: none; border-top: 1px dashed #eee; padding-left: 0; padding-top: 1rem; }
}

/* Small screen tweaks */
@media (max-width: 420px) {
  .note { width: 56px; height: 56px; }
  .note .label { font-size: 0.85rem; }
}
