:root{
  --bg:#fbfaf7;
  --text:#0f172a;
  --muted:#475569;
  --card:#ffffff;
  --border: rgba(15,23,42,.12);

  --male:#cfe6ff;
  --female:#ffd3ea;
  --surname:#e6e6e6;

  --shadow: 0 12px 28px rgba(0,0,0,.08);
  --radius:16px;

  --help:#7c3aed; /* purple */
}

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

.page{
  max-width: 1200px;
  margin: 28px auto 60px;
  padding: 0 18px;
}

.header{ margin-bottom: 18px; }
.title{ font-size: 44px; letter-spacing:-.02em; margin: 0 0 6px; }
.subtitle{ margin:0 0 18px; color:var(--muted); }

.toolbar{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap: 18px;
  margin-bottom: 14px;
}

.toolbar-left{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
}

.chip{
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  cursor:pointer;
  font-size: 14px;
}

.chip[aria-pressed="true"]{
  font-weight:700;
}

.toolbar-right{
  display:flex;
  gap:14px;
  align-items:center;
}

.names-toggle{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
}

.names-label{
  font-size: 14px;
  color: var(--muted);
  font-weight: 700;
}

.names-buttons{
  display:flex;
  gap:10px;
  padding: 10px 12px;
  border-radius: 20px;
  background: #e8ffe0;
  border: 1px solid rgba(0,0,0,.06);
}

.pill{
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 999px;
  padding: 8px 14px;
  cursor:pointer;
  background: #fff;
  font-size: 14px;
}

.pill-male{ background: var(--male); }
.pill-female{ background: var(--female); }
.pill-surname{ background: var(--surname); }

.pill[aria-pressed="true"]{
  font-weight: 800;
  filter: brightness(0.93); /* slightly darker when ON */
}

.icon-btn{
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  cursor:pointer;
  display:grid;
  place-items:center;
}

.icon-btn svg{
  width: 20px;
  height: 20px;
  fill: #111827;
}

.search{
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 16px;
}

.content{
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 18px;
  align-items:start;
  margin-top: 18px;
}

.col{
  background: transparent;
}

.col-head{
  display:flex;
  justify-content:space-between;
  padding: 0 4px 10px;
}

.col-title{
  font-size: 18px;
  font-weight: 800;
  color: rgba(15,23,42,.82);
}

.col-title-right{
  text-align:right;
  width: 40%;
}

.result-row{
  display:grid;
  grid-template-columns: 1fr 40%;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  margin-bottom: 10px;
  cursor:pointer;
  transition: transform .06s ease, box-shadow .12s ease;
}

.result-row:hover{
  box-shadow: 0 10px 24px rgba(0,0,0,.08);
  transform: translateY(-1px);
}

.result-term{
  font-weight: 800;
}

.result-sub{
  color: var(--muted);
  font-size: 14px;
}

.result-translation{
  justify-self:start;
  align-self:start;
  color: var(--muted);
  font-size: 14px;
  padding-top: 2px;
}

.section-label{
  margin: 10px 4px 8px;
  font-weight: 800;
  color: rgba(15,23,42,.72);
}

.explain-box{
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 14px;
  color: var(--muted);
}

.explain .col-head{ padding-left: 2px; }

.detail-line{margin: 4px 0;}
.detail-label{font-weight: 800;}
.detail-value{color: var(--muted);}

.settings-panel{
  position: fixed;
  top: 90px;
  right: 18px;
  width: 320px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 14px;
  z-index: 999;
}

.settings-panel.hidden{ display:none; }

.settings-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom: 8px;
}

.settings-title{
  font-size: 18px;
  font-weight: 900;
}

.settings-section{
  padding: 10px 0;
  border-top: 1px solid rgba(15,23,42,.08);
}

.settings-section-title{
  font-weight: 900;
  margin-bottom: 8px;
}

.check{
  display:flex;
  gap: 10px;
  align-items:center;
  margin: 8px 0;
  color: rgba(15,23,42,.88);
}

.indent{ padding-left: 18px; }

.note{
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.35;
}

.help-wrap{
  position: relative;
  display:inline-block;
  margin-left: 6px;
}

.help-icon{
  display:inline-grid;
  place-items:center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(124,58,237,.14);
  color: var(--help);
  font-weight: 900;
  font-size: 12px;
  cursor: default;
  border: 1px solid rgba(124,58,237,.28);
}

.help-pop{
  display:none;
  position:absolute;
  right: 0;
  top: 22px;
  width: 260px;
  padding: 10px 12px;
  background:#fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.help-wrap:hover .help-pop{
  display:block;
}

.help-pop a{
  color: var(--help);
  text-decoration: none;
  font-weight: 800;
}
.gear-icon{
  width: 30px;
  height: 30px;
  display: block;
}
.card h3{
  text-align: center;
}
.back-to-tool{
  display:flex;
  justify-content:flex-start; /* or center if you want */
  margin: 10px 0 18px;
}

.back-to-tool .btn-back{
  display:inline-flex;
  align-items:center;
  gap:8px;

  background:#fff;
  color:#111 !important;        /* kills blue link */
  text-decoration:none !important;

  border:1px solid rgba(0,0,0,0.18);
  border-radius:999px;          /* “badge/pill” look */
  padding:8px 12px;

  font-weight:700;
  font-size:14px;
  line-height:1;
  box-shadow: 0 2px 0 rgba(0,0,0,0.06);
}

.back-to-tool .btn-back:hover{
  background:#fff;
  border-color: rgba(0,0,0,0.28);
  box-shadow: 0 8px 18px rgba(0,0,0,0.10);
  transform: translateY(-1px);
}

.content{
  display:grid;
  grid-template-columns: 1.1fr 1.6fr 1.1fr; /* left / middle / right */
  gap: 24px;
  align-items:start;
}

.transcript-box{
  width: 100%;
  min-height: 420px;
  resize: vertical;
  padding: 12px;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 16px;
  background: #fff;
  font: inherit;
  line-height: 1.35;
}

/* Mobile: stack nicely */
@media (max-width: 980px){
  .content{
    grid-template-columns: 1fr;
  }
}

/* Make the Transcription column stack and allow the textbox to grow */
.col.transcription {
  display: flex;
  flex-direction: column;
}

/* The transcription textbox should fill the available space and match the Details panel look */
#transcriptionBox {
  width: 100%;
  flex: 1;
  min-height: 420px;              /* adjust if you want taller/shorter */
  padding: 12px 14px;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 16px;
  background: #fff;
  font: inherit;
  line-height: 1.4;
  resize: vertical;               /* or 'none' if you want to lock size */
  outline: none;
}

/* Optional: match focus feel of your other inputs */
#transcriptionBox:focus {
  border-color: rgba(0,0,0,0.25);
}

/* If you have a tip under it, keep it from squishing the textarea weirdly */
.transcription-tip {
  margin-top: 10px;
  font-size: 12px;
  opacity: 0.75;
}
.content {
  align-items: stretch;
}
/* Wrapper that matches your rounded “box” look */
.transcription-box{
  position: relative;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 16px;
  background: #fff;
  padding: 14px;
  min-height: 420px; /* adjust to match your layout height */
}

/* The textarea fills the box, leaving space for the button */
.transcription-text{
  width: 100%;
  height: 100%;
  min-height: 380px; /* so it actually fills */
  border: 0;
  outline: 0;
  resize: vertical;
  background: transparent;
  padding-bottom: 44px; /* reserve space for button */
  font-size: 14px;
  line-height: 1.4;
}

/* Copy button pinned bottom-left */
.copy-transcription-btn{
  position: absolute;
  left: 12px;
  bottom: 12px;
  border: 1px solid rgba(0,0,0,0.15);
  background: #fff;
  color: #111;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.copy-transcription-btn:hover{
  box-shadow: 0 8px 18px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

/* make each result item a positioning context */
.result-item { position: relative; }

/* the plus button floats on the right, not affecting layout */
.add-term-btn{
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  font-weight: 700;
  line-height: 34px;
}

/* keep existing layout but allow an absolutely-positioned + button */
.result-row{
  position: relative;
  padding-right: 52px; /* space reserved for the + button */
}

.add-btn{
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 0;
  background: #20c05c;
  color: #fff;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.add-btn:hover{ filter: brightness(0.95); }
.add-btn:active{ transform: translateY(-50%) scale(0.98); }
