/* =========================
   Base / Variables
========================= */
:root{
  --bg: #f8fafc;
  --card: #ffffff;
  --line: #e5e7eb;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #fb7185;
  --soft: #fff7ed;
}

*{ box-sizing: border-box; }
html,body{
  margin:0;
  padding:0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN",
               "Noto Sans JP", sans-serif;
}

/* =========================
   Layout
========================= */
.wrap{
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

.top{
  display:flex;
  gap:16px;
  align-items:flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.brand .title{
  font-size: 22px;
  font-weight: 900;
}
.brand .subtitle{
  color: var(--muted);
  font-size: 13px;
}

.controls{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap: wrap;
}

.grid{
  display:grid;
  grid-template-columns: 1.4fr 1fr;
  gap:16px;
}

@media (max-width: 900px){
  .grid{ grid-template-columns: 1fr; }
}

/* =========================
   Controls
========================= */
.ctl{
  display:flex;
  gap:6px;
  align-items:center;
  font-size: 12px;
}
.ctl span{ color: var(--muted); }

.toggle{
  display:flex;
  gap:6px;
  align-items:center;
  font-size: 12px;
  cursor:pointer;
}
.toggle input{ cursor:pointer; }

button, select, input, textarea{
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 6px 10px;
  font-size: 13px;
}

button.primary{
  background: linear-gradient(180deg, #fff 0%, #fff0f3 100%);
  border-color: #fb718533;
  font-weight: 800;
}

button{
  cursor:pointer;
}
button:active{
  transform: translateY(1px);
}

/* =========================
   Cards
========================= */
.card{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 18px 45px rgba(15,23,42,.06);
}

aside.card{
  display:flex;
  flex-direction: column;
  gap:14px;
}

/* =========================
   Status / Pills
========================= */
.statusRow{
  display:flex;
  gap:10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.pill{
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}
.pill.soft{
  background: var(--soft);
  border-color: #fed7aa;
}

.label{
  margin-top: 10px;
  margin-bottom: 4px;
  font-size: 12px;
}

/* =========================
   Prompt / Input
========================= */
.prompt{
  min-height: 72px;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 12px;
  line-height: 1.8;
  font-size: 16px;
  background: #fff;
  word-break: break-word;
}

.prompt .ok{ color:#16a34a; }
.prompt .ng{ color:#ef4444; text-decoration: underline; }

.typebox{
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 16px;
  margin-top: 4px;
}

/* =========================
   Footer
========================= */
.footer{
  display:flex;
  align-items:center;
  justify-content: space-between;
  margin-top: 10px;
  gap:10px;
  flex-wrap: wrap;
}

.kbd{
  display:inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 11px;
  margin: 0 2px;
}

/* =========================
   Toast (message)
========================= */
.toast{
  position: fixed;
  right: 20px;
  bottom: 20px;
  display:flex;
  gap:10px;
  align-items:flex-start;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 20px 60px rgba(15,23,42,.25);
  z-index: 40;
}
.toast .dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  margin-top: 6px;
}
.toastTitle{
  font-weight: 800;
}

/* =========================
   History table
========================= */
.history table{
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.history th,
.history td{
  border-bottom: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
}
.history th{
  color: var(--muted);
  font-weight: 700;
}

.historyBtns{
  display:flex;
  gap:10px;
  margin-top: 8px;
}

.wpmCol,
.starsCol{
  text-align: right;
}

/* =========================
   Stats (aside)
========================= */
.stats{
  display:grid;
  grid-template-columns: repeat(2,1fr);
  gap:10px;
}
.stat{
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #fff;
}
.stat .k{
  font-size: 11px;
  color: var(--muted);
}
.stat .v{
  font-size: 18px;
  font-weight: 900;
}

/* =========================
   Custom text
========================= */
.custom textarea{
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 10px;
  resize: vertical;
  font-size: 13px;
}

/* =========================
   Utility
========================= */
.muted{
  color: var(--muted);
}
.footnote{
  font-size: 12px;
  color: var(--muted);
}

/* header nav link */
.navLink{
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
}
.navLink:hover{
  color: var(--text);
  box-shadow: 0 8px 18px rgba(15,23,42,.08);
}
