/* =========================================
   EBRARTE - Afinadores + Metrônomo (tema claro)
   Mobile-first, leve, sem frameworks
   ========================================= */

:root{
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #121212;
  --muted: #6b7280;
  --border: #e6e8ef;

  --shadow: 0 10px 30px rgba(0,0,0,.06);

  --btn: #111827;
  --btnText: #ffffff;
  --btn2: #ffffff;
  --btn2Text: #111827;

  --ok: #16a34a;
  --warn: #f59e0b;
  --bad: #ef4444;

  --radius: 16px;
  --radius2: 12px;
  --gap: 14px;

  --maxw: 820px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a{ color: inherit; text-decoration: none; }

.container{
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px;
}

.header{
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(246,247,251,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(230,232,239,.8);
}

.header-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 12px 16px;
  max-width: var(--maxw);
  margin: 0 auto;
}

.brand{
  display:flex;
  align-items:center;
  gap: 10px;
  min-width: 0;
}

.brand img{
  height: 40px;
  width: auto;
  display:block;
}

.brand .title{
  display:flex;
  flex-direction:column;
  line-height: 1.1;
  min-width: 0;
}

.brand .title strong{
  font-size: 14px;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand .title span{
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-title{
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}

.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.card + .card{ margin-top: 14px; }

.grid{
  display:grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}

@media (min-width: 720px){
  .grid.cols-2{ grid-template-columns: 1fr 1fr; }
  .grid.cols-3{ grid-template-columns: 1fr 1fr 1fr; }
}

.h1{
  font-size: 22px;
  margin: 0 0 8px 0;
}
.p{
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

hr.sep{
  border: 0;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

.btn{
  appearance: none;
  border: none;
  cursor: pointer;
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 650;
  font-size: 15px;
  line-height: 1;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 10px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn.primary{
  background: var(--btn);
  color: var(--btnText);
}

.btn.secondary{
  background: var(--btn2);
  color: var(--btn2Text);
  border: 1px solid var(--border);
}

.btn:disabled{
  opacity: .55;
  cursor: not-allowed;
}

.btn.wide{ width:100%; }

.row{
  display:flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items:center;
}

.row.stretch > *{ flex: 1 1 180px; }

.field label{
  display:block;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 6px 2px;
}

select, input[type="number"]{
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 12px;
  font-size: 15px;
  background: #fff;
  color: var(--text);
}

input[type="range"]{
  width: 100%;
}

.badge{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--muted);
  background: #fff;
}

.badge.ok{ border-color: rgba(22,163,74,.35); color: #14532d; }
.badge.warn{ border-color: rgba(245,158,11,.35); color: #7c2d12; }
.badge.bad{ border-color: rgba(239,68,68,.35); color: #7f1d1d; }

.big-number{
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.8px;
}
.small{
  font-size: 13px;
  color: var(--muted);
}

/* ===== Menu cards (index) ===== */
.tool-card{
  display:flex;
  flex-direction:column;
  gap: 10px;
  padding: 16px;
}

.tool-card .tool-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}

.tool-card .emoji{
  font-size: 26px;
}

.tool-card h2{
  margin: 0;
  font-size: 18px;
}

.tool-card p{
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

/* ===== Afinador ===== */
.tuner-read{
  display:flex;
  flex-direction:column;
  gap: 8px;
}

.tuner-line{
  display:flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: baseline;
}

.tuner-line .big-number{ margin-right: 8px; }

.tuner-meter{
  margin-top: 8px;
}

.meter-track{
  height: 14px;
  background: #eef0f6;
  border: 1px solid var(--border);
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}

.meter-okzone{
  position:absolute;
  left: 50%;
  top: 0;
  height: 100%;
  width: 12%; /* zona OK (visual); a lógica em JS define o OK real */
  transform: translateX(-50%);
  background: rgba(22,163,74,.18);
}

.meter-center{
  position:absolute;
  left: 50%;
  top: 0;
  width: 2px;
  height: 100%;
  transform: translateX(-50%);
  background: rgba(17,24,39,.35);
}

.meter-needle{
  position:absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 24px;
  border-radius: 10px;
  transform: translate(-50%, -50%);
  background: #111827;
  box-shadow: 0 6px 14px rgba(0,0,0,.12);
}

.meter-labels{
  display:flex;
  justify-content:space-between;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

/* ===== Metrônomo ===== */
.metro-wrap{
  display:flex;
  flex-direction:column;
  gap: 12px;
  align-items:stretch;
}

.pulse-area{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding: 10px 0 2px 0;
  gap: 10px;
}

.pulse-count{
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.pulse-circle{
  width: 180px;
  height: 180px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display:flex;
  align-items:center;
  justify-content:center;
  position: relative;
  overflow:hidden;
}

.pulse-circle::after{
  content:"";
  position:absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 25%, rgba(17,24,39,.06), transparent 60%);
}

.pulse-dot{
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(17,24,39,.25);
  box-shadow: 0 10px 24px rgba(0,0,0,.10);
  transform: scale(1);
  transition: transform 80ms ease, background 80ms ease, opacity 80ms ease;
  opacity: .8;
}

.pulse-dot.hit{
  transform: scale(1.8);
  opacity: 1;
  background: rgba(17,24,39,.80);
}

.pulse-dot.accent{
  background: rgba(17,24,39,.95);
}

/* ===== Rodapé de navegação ===== */
.footer-nav{
  margin-top: 14px;
  display:flex;
  flex-direction:column;
  gap: 10px;
}

@media (min-width: 720px){
  .footer-nav{
    flex-direction:row;
  }
  .footer-nav .btn{ flex: 1; }
}

/* ===== mensagens ===== */
.notice{
  margin-top: 10px;
  padding: 12px 12px;
  border-radius: var(--radius2);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.notice strong{ color: var(--text); }
