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

:root {
  --bg:      #1e1e1e;
  --surf:    #252526;
  --surf2:   #2d2d2d;
  --surf3:   #333333;
  --border:  #454545;
  --border2: #3c3c3c;
  --text:    #d4d4d4;
  --muted:   #858585;
  --blue:    #007acc;
  --blue-l:  #4fc1ff;
  --green:   #4ec9b0;
  --red:     #f44747;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surf3);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand-logo {
  height: 32px;
  width: auto;
  flex-shrink: 0;
  filter: brightness(0.9);
}
.brand-text { display: flex; flex-direction: column; }
.brand-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.brand-sub {
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.btn-logout {
  padding: 4px 8px;
  height: 28px;
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(244,71,71,0.4);
  border-radius: 2px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, border-color 0.1s;
  line-height: 1;
}
.btn-logout:hover { background: rgba(244,71,71,0.1); border-color: var(--red); }

/* ── Main ── */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px 56px;
}

/* ── Section title ── */
.section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
  text-align: center;
}

/* ── Tools section ── */
.tools-section {
  width: 100%;
  max-width: 480px;
  margin-bottom: 24px;
}
.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.btn-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  font-weight: 400;
  font-size: 13px;
  font-family: inherit;
  border-radius: 2px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  touch-action: manipulation;
}
.btn-tool .tool-icon { font-size: 1rem; }

.btn-tool.blue {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.btn-tool.blue:hover { background: #0068b0; border-color: #0068b0; }

.btn-tool.green {
  background: #1a4a2e;
  color: var(--green);
  border-color: #2a6642;
}
.btn-tool.green:hover { background: #1e5535; border-color: var(--green); }

.btn-tool.ghost {
  background: var(--surf);
  color: var(--muted);
  border-color: var(--border2);
}
.btn-tool.ghost:hover { background: var(--surf2); color: var(--text); border-color: var(--border); }

/* ── Phrase du jour ── */
#phraseWrap {
  display: none;
  width: 100%;
  max-width: 480px;
  margin-bottom: 24px;
}
.phrase-card {
  background: var(--surf);
  border: 1px solid var(--border2);
  border-radius: 2px;
  padding: 14px;
}
.phrase-card-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.phrase-input-row { display: flex; gap: 6px; }
#phraseInput {
  flex: 1;
  background: var(--surf2);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.1s;
}
#phraseInput:focus { border-color: var(--blue); }
#phraseInput::placeholder { color: var(--muted); }
.phrase-actions { display: flex; gap: 6px; }
#phraseBtn     { padding: 7px 14px; white-space: nowrap; }
#phraseClearBtn { padding: 7px 10px; white-space: nowrap; }
#phraseStatus {
  font-size: 11px;
  color: var(--green);
  margin-top: 6px;
  min-height: 16px;
}

/* ── Radio ── */
#radioWrap {
  display: none;
  width: 100%;
  max-width: 480px;
  margin-bottom: 24px;
  background: var(--surf);
  border: 1px solid var(--border2);
  border-radius: 2px;
  overflow: hidden;
}
.radio-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  background: var(--surf3);
  transition: background 0.1s;
}
.radio-head:hover { background: var(--surf2); }
#radioWrap.open .radio-head { border-bottom: 1px solid var(--border2); }
.radio-head-title {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
#radio-now {
  font-size: 11px;
  font-weight: 400;
  color: var(--blue-l);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.radio-toggle-chev {
  font-size: 10px;
  color: var(--muted);
  transition: transform 0.2s;
}
#radioWrap.open .radio-toggle-chev { transform: rotate(180deg); }
#radio-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}
#radioWrap.open #radio-body { max-height: 400px; }

.radio-btns {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
}
.radio-btn {
  width: 34px; height: 34px;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: var(--surf2);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  font-family: inherit;
  touch-action: manipulation;
}
.radio-btn:hover { border-color: var(--blue); color: var(--text); background: rgba(0,122,204,0.1); }
#radio-playbtn {
  width: 44px; height: 44px;
  font-size: 1rem;
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
#radio-playbtn:hover { background: #0068b0; border-color: #0068b0; }

.radio-vol {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px 10px;
}
.radio-vol-ico { font-size: 12px; color: var(--muted); width: 18px; text-align: center; }
.radio-slider {
  flex: 1;
  -webkit-appearance: none; appearance: none;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--blue) var(--v,60%), var(--border) var(--v,60%));
  outline: none;
}
.radio-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--blue-l);
  cursor: pointer;
}
.radio-slider::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--blue-l);
  border: none; cursor: pointer;
}
.radio-list { max-height: 160px; overflow-y: auto; border-top: 1px solid var(--border2); }
.radio-list::-webkit-scrollbar { width: 4px; }
.radio-list::-webkit-scrollbar-thumb { background: var(--surf2); border-radius: 2px; }
.radio-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  transition: background 0.1s, color 0.1s;
}
.radio-item:hover { background: var(--surf2); color: var(--text); }
.radio-item.active { color: var(--blue-l); }
.radio-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--border); flex-shrink: 0; transition: background 0.1s; }
.radio-item.active .radio-dot { background: var(--blue-l); }

/* ── Footer ── */
footer {
  text-align: center;
  padding: 14px 20px;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--border2);
}

/* ── Responsive ── */
@media (max-width: 500px) {
  .tools-grid { grid-template-columns: 1fr; }
  .phrase-input-row { flex-direction: column; }
}
