:root{
  --bg:#f3f5fb;
  --card:#ffffff;
  --text:#1d2433;
  --muted:#5b667a;
  --border:#e7eaf2;
  --shadow: 0 10px 30px rgba(16,24,40,.08);
  --radius: 18px;
  --primary:#4f46e5;
}

*{
  box-sizing:border-box;
}

body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
}

.wrap{
  max-width:1400px;
  width:96%;
  margin:28px auto;
  padding:0 18px 40px;
}

/* TOP BAR */

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:16px 18px;
  border-radius:var(--radius);
  background:var(--card);
  box-shadow:var(--shadow);
  border:1px solid var(--border);
}

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

.logo{
  width:40px;
  height:40px;
  border-radius:12px;
  background:#0f172a;
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:700;
}

.title{
  font-weight:800;
  font-size:20px;
}

.subtitle{
  color:var(--muted);
  font-size:13px;
  margin-top:2px;
}

.status{
  padding:10px 14px;
  border-radius:999px;
  border:1px solid var(--border);
  background:#f7f8fd;
  color:var(--muted);
  font-weight:600;
  font-size:13px;
}

.status.ok{
  background:#eafff0;
  border-color:#b7f7c4;
  color:#0f7a2f;
}

.status.bad{
  background:#fff1f1;
  border-color:#ffc7c7;
  color:#b00020;
}

/* GRID */

.grid{
  margin-top:18px;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
}

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

.keyboard-card{
  margin-top:18px;
  padding:18px;
  width:100%;
}

h2{
  margin:0 0 12px;
  font-size:18px;
}

/* TEXTAREA */

textarea{
  width:100%;
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
  font-size:16px;
  resize:vertical;
  outline:none;
}

#keyboardText{
  font-size:18px;
  min-height:130px;
}

/* INPUTS */

.row3{
  display:grid;
  grid-template-columns:1fr 120px 120px;
  gap:12px;
  margin-top:12px;
}

label{
  display:block;
  font-size:12px;
  color:var(--muted);
  margin-bottom:6px;
}

.labelBlock{
  margin-top:12px;
  display:block;
  font-size:12px;
  color:var(--muted);
  margin-bottom:6px;
}

select,
input{
  width:100%;
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px;
  font-size:14px;
  outline:none;
  background:#fff;
}

/* BUTTONS */

.btnrow{
  display:flex;
  gap:10px;
  margin-top:12px;
  flex-wrap:wrap;
}

button{
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px 14px;
  cursor:pointer;
  font-weight:700;
  background:#fff;
}

button.primary{
  background:var(--primary);
  border-color:var(--primary);
  color:#fff;
}

button:disabled{
  opacity:.5;
  cursor:not-allowed;
}

audio{
  width:100%;
  margin-top:12px;
}

.small{
  margin-top:10px;
  font-size:12px;
  color:var(--muted);
  line-height:1.5;
}

/* KEYBOARD */

.keyboard-help{
  margin-bottom:12px;
}

.keyboard{
  margin-top:14px;
  display:flex;
  flex-direction:column;
  gap:8px;
  width:100%;
}

.keyboard-row{
  display:flex;
  flex-wrap:nowrap;
  gap:8px;
  width:100%;
  justify-content:flex-start;
}

.key{
  min-width:46px;
  height:48px;
  padding:0 8px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:20px;
  font-weight:700;
  border-radius:12px;
  border:2px solid #bfc9dc;
  background:#ffffff;
  color:#111827;
  box-shadow:0 3px 8px rgba(0,0,0,0.08);
  transition:all .2s ease;
  flex:1 1 0;
}

.key:hover{
  background:#eef2ff;
  border-color:#4f46e5;
  transform:translateY(-1px);
}

.key:active{
  transform:scale(.97);
  background:#e0e7ff;
}

.keyboard-actions{
  margin-top:12px;
}

.keyboard-actions button{
  padding:11px 16px;
  font-weight:700;
  border:1px solid var(--border);
  background:#f8faff;
  border-radius:12px;
}

/* RESPONSIVE */

@media (max-width:1100px){
  .wrap{
    max-width:100%;
    width:98%;
  }

  .key{
    min-width:42px;
    font-size:18px;
    height:46px;
  }
}

@media (max-width:900px){
  .grid{
    grid-template-columns:1fr;
  }

  .row3{
    grid-template-columns:1fr;
  }

  .keyboard-row{
    flex-wrap:wrap;
  }

  .key{
    flex:0 0 48px;
    min-width:48px;
    width:48px;
    height:48px;
    font-size:20px;
  }
}