:root{
      --light-blue: #E6F3FF;
      --white: #FFFFFF;
      --light-green: #e2faee;
      --light-yellow: #FEF3C7;
      --light-red: #fef5f5;
      --text-dark: #1E293B;
      --border-soft: #E5E7EB;
      --shadow-soft: rgba(0,0,0,0.00);
      --score-low: #EF4444;
      --score-mid: #FBBF24;
      --score-high: #10B981;
      --score-red: #febcbc;
      --score-purple: #a793fe;
      --score-green: #20d096;
      --score-text-red: #ef4444;
      --score-text-purple: #8575cb;
      --score-text-green: #00a36d;
      --bg-main: #f4f7fa;
      --bg-card: #ffffff;
      --bg-inset: #f8fafc;
      --ink-main: var(--text-dark);
      --ink-muted: #64748b;
      --border-color: #e2e8f0;
      --brand-primary: #0ea5e9;
      --brand-primary-light: #e0f2fe;
      --brand-primary-border: #bae6fd;
      --radius-lg: 16px;
      --radius-md: 12px;
      --radius-sm: 8px;
      --shadow-main: 0 6px 18px rgba(14,165,233,0.06);
      --shadow-strong: 0 12px 30px rgba(14,165,233,0.06);
    }
    .wrap { max-width:1200px; margin:24px auto; padding:16px; }

    .hdr { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:16px; margin-bottom:24px; }
    .brand { display:flex; flex-direction:column; }
    .eyebrow { font-size:12px; font-weight:600; color:var(--ink-muted); text-transform:uppercase; letter-spacing:.1em; }
    .title { font-size:24px; font-weight:800; color:var(--ink-main); }
.tab:hover {
	background: #dee3ea !important;
	color: #64748b;
}
.tab:focus {
	background: var(--brand-primary) !important;
}
    .tabs { display:flex; gap:8px; padding:7px; background:var(--bg-card); border-radius:var(--radius-md); border:1px solid var(--border-color); box-shadow:var(--shadow-main); }
    .tab { padding:8px 10px; border-radius:var(--radius-sm); font-weight:600; font-size:14px; color:var(--ink-muted); background:transparent; border:none; cursor:pointer; }
    .tab[aria-selected="true"]{ background:var(--brand-primary); color:#fff; box-shadow:0 4px 12px rgba(14,165,233,0.12); }
@media (max-width: 900px) {
	.tabs { display:flex; gap:8px;  background:var(--bg-card); border-radius:var(--radius-md); border:1px solid var(--border-color); box-shadow:var(--shadow-main); width: 100%; justify-content: space-around; }
	.tab:focus {
	background: var(--brand-primary) !important;
}
}
    .layout { display:grid; grid-template-columns:1fr 1.3fr; gap:24px; }
    .card { background:var(--bg-card); border-radius:var(--radius-lg); border:1px solid var(--border-color); box-shadow:var(--shadow-main); overflow:hidden; display:flex; flex-direction:column;}
    .card-head { padding:16px 20px; display:flex; gap:12px; align-items:center; justify-content:space-between; border-bottom:1px solid var(--border-color); }
    .card-body { padding:20px; display:flex; flex-direction:column; gap:16px; flex:1; position:relative; }
    .panel-title-wrap .small{ font-size:13px; font-weight:500; color:var(--ink-muted); }
    .panel-title-wrap h2{ margin:0; font-size:18px; font-weight:700; }

    .controls{ display:flex; gap:8px; align-items:center; flex-wrap:wrap;}
    .btn{ display:inline-flex; align-items:center; gap:8px; padding:8px 12px; border-radius:var(--radius-md); background:#fff; border:1px solid var(--border-color); font-weight:600; font-size:14px; color:var(--ink-main); cursor:pointer; }
    .btn:hover{ background:var(--bg-inset); border-color:#cdd5e0; color: #1e293b; }
    .btn.primary{ background:var(--brand-primary); color:#fff;  }
.btn.playbtn {
	min-width: auto !important;
	background: #885df1;
}
#playIcon {
	width: 20px;
}
#dictInput {
	min-height: 117px !important;
	padding: 15px;
	font-weight: normal;
}
    .btn.bad{ background: #ef4460; color:#fff; border-color:#ef4460; }
    .btn-icon{ padding:8px; width:40px; height:40px; border-radius:10px; display:inline-flex; align-items:center; justify-content:center; }

    .btn-small{ padding:6px 8px; font-size:13px; border-radius:10px; }

    .pill{ display:inline-flex; align-items:center; gap:6px; padding:6px 10px; border-radius:var(--radius-md); background:#fff; border:1px solid var(--border-color); font-weight:600; font-size:13px; }
    .pill.no-border{ border:none; background:transparent; padding:0; gap:6px; }

    .wave { height:100px; border-radius:var(--radius-md); border:1px solid var(--border-color); background:linear-gradient(180deg,#fff,#f8fafc); overflow:hidden; }
    canvas{ width:100%; height:100%; display:block; }
.speed button, .mode-wrap button {
	padding: 3px 9px 3px 9px;
}
#modeBtn:focus {
	color: #fff;
}
#modeBtn {
	background: #4c5869 !important;
	color: #fff;
}
    .speed, .mode-wrap { position:relative; display:inline-flex; align-items:center; }
    .speed-menu, .mode-menu { position:absolute; top:calc(100% + 8px); right:0; width:170px; background:var(--bg-card); border:1px solid var(--border-color); padding:6px; box-shadow:0 10px 28px rgba(0,0,0,0.06); display:none; z-index:60; }
    .speed.open .speed-menu, .mode-wrap.open .mode-menu { display:block; }
    .speed-menu button, .mode-menu button{ display:block; width:100%; text-align:left; padding:8px 10px; border:none; background:transparent; cursor:pointer; }
    .speed-menu button:hover, .mode-menu button:hover{ background:var(--bg-inset); }

    textarea, input[type=text] { width:100%; padding:12px; border-radius:var(--radius-md); border:1px solid var(--border-color); font-size:15px; background:var(--bg-inset); }
    textarea:focus, input[type=text]:focus { outline:none; border-color:var(--brand-primary); background:#fff; box-shadow:0 0 0 3px var(--brand-primary-light); }

    /* Cap area */
    #capArea { min-height:72px; border-radius:var(--radius-md); padding:16px; display:flex; align-items:center; justify-content:center; text-align:center; background:linear-gradient(180deg,#fff,#fbfeff); box-shadow:var(--shadow-main); font-weight:700; font-size:20px; }
    #capArea .masked{ letter-spacing:1px; color: #4c5869; font-size:20px; }
    .cap-animate { animation:capReveal .28s cubic-bezier(.2,.9,.3,1); }

    @keyframes capReveal { from{ opacity:0; transform:translateY(-6px) scale(.99);} to{opacity:1; transform:translateY(0) scale(1);} }

    /* Dictation segment counter (no border, color #64748b) */
    .dict-counter{ position:absolute; top:8px; right:18px; color:#64748b; background:transparent; border:none; font-weight:700; font-size:13px; pointer-events:none; }

    /* Transcript list */
    .segments{ display:flex; flex-direction:column; gap:8px; max-height:480px; overflow:auto; padding-right:6px; }
    .seg{ display:flex; gap:12px; align-items:flex-start; padding:12px; border-radius:var(--radius-md); background:#fff; border:1px solid var(--border-color); color: #4c5869; }
    .seg .meta{ min-width:30px; font-weight:700; color: #64748b; }
    .seg .txt{ flex:1; line-height:1.6; }
    .seg.active{ border-color: #babcfd; background: #ecebfe; box-shadow:0 0 0 3px rgba(14,165,233,0.06); color: #000; }
#shadowRef {
	color: #4c5869;
}
#checkTake {
	width: 160px;
	text-align: center;
	display: block;
	margin: auto;
}
    /* Result area: dynamic color variants */
    #resultArea{ display:none; margin-top:12px; border-radius:12px; min-height:66px; overflow:hidden; border:1px solid #babcfd ; }
    #resultArea .result-body{ display:flex; gap:16px; align-items:center; padding:14px; }
    #resultArea .result-accent{ flex:0 0 8px; height:100%; border-radius:6px 0 0 6px; }
    #resultArea.result-ok{ background:var(--light-green); border:1px solid var(--score-green); }
    #resultArea.result-ok .result-accent{ background:linear-gradient(180deg,var(--score-green),#059669); }
    #resultArea.result-bad{ background:var(--light-red); border:1px solid var(--score-red); }
    #resultArea.result-bad .result-accent{ background:linear-gradient(180deg,var(--score-red),#b91c1c); }
#takeText {
	padding: 15px;
	min-height: 120px;
	max-height: 200px;
	font-weight: normal;
}

.mastercombobtn {
	float: right;
	display: inline-block;	
}

#checkBtn, #skipBtn {
	width: 90px;
	display: inline-block;
	padding: 5px 10px 5px 10px;
}
.masterbtn {
	display: inline-block !important;
	align-items:center;
	margin-top:auto;
	flex-wrap:wrap
}

    #resultArea.result-show .result-accent{ background:linear-gradient(180deg,var(--score-purple),#7a63f2); }

    #resultArea .result-content{ flex:1; }
    #resultArea .result-title{ font-weight:700; font-size:16px; margin-bottom:4px; }
    #resultArea .result-sub{ color:var(--ink-muted); font-size:12px;}
#showBtn:focus {
	background: none;
}
#capArea {
	color: #4c5869;
}
    /* Recording button animation */
    .rec-recording{ animation:recordingPulse 1s infinite; box-shadow:0 8px 30px rgba(239,68,68,0.08); }
    @keyframes recordingPulse{ 0%{transform:scale(1);}50%{transform:scale(0.98);}100%{transform:scale(1);} }

    /* Completion modal */
    .modal-overlay{ position:fixed; inset:0; background:rgba(2,6,23,0.45); display:flex; align-items:center; justify-content:center; z-index:1000; }
    .modal { width:min(760px,92%); background:var(--white); border-radius:14px; padding:20px; box-shadow:0 18px 48px rgba(2,6,23,0.18); border:1px solid rgba(2,6,23,0.04); }
    .modal h3{ margin:0; font-size:20px; font-weight:800; color:var(--ink-main); }
    .modal p{ margin:8px 0 0; color:var(--ink-muted); }
    .modal .modal-actions{ display:flex; gap:8px; justify-content:flex-end; margin-top:18px; }
    .modal .btn{ padding:8px 12px; }

    .review-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(48px,1fr)); gap:8px; margin-top:12px;}
    .review-item { padding:8px 10px; border-radius:8px; font-weight:700; text-align:center; }

    @media (max-width:980px){ .layout{ grid-template-columns:1fr; } .dict-counter{ right:12px; top:6px; } }

@media (min-width:980px) {
	#dictPrevIcon, #dictNextIcon {
		display: none;
	}
}
.autonext {
	margin-top: -15px;
	font-size: 13px;
}

#transcriptbtn {
	background: #4c5869 !important;
	padding: 6px !important;
}
#playIcontrans {
	width: 10px;
	color: #fff;
}
.speed-menu button, .mode-menu button {
		 color: #64748b !important;
		 font-weight: 500;
	border-radius: 0;
	font-size: 14px;
	 }
	 .speed-menu button:hover, .mode-menu button:hover {
		 color: #885df1 !important;
		transform: translateX(4px);
	 }

#skipBtn, #showBtn {
	color: #64748b;
}

#audioTitle, #panelTitle {
	font-size: 15px;
		 color: #64748b;
		 font-weight: 600;
}

#speedBtn:focus {
	background: none;
	color: #1e293b;
}
#speedBtn:hover {
	color: #1e293b;
}
 @media (max-width:980px){ 

.card-head {
	display: block;
}
	 #audioTitle, #panelTitle {
		 text-align: right;
		 margin-top: -17px;
	font-size: 15px;
		 color: #64748b;
		 font-weight: 600;
}
	 #headcontrol {
	margin-top: 10px;
		 margin-bottom: -4px;
		 justify-content: space-around !important;
		 
}
	 #speedBtn {
		padding: 2px 8px;
    font-size: 13px;
    border-radius: 10px;
	 }
	 .speed-menu, .mode-menu {
    left: 0;
	 }
	 
	 #panelTools {
		 display: block;
		 margin-top: 10px;
		 margin-left: -4px !important;
		 margin-bottom: -4px !important;
	 }
}