:root{
	/* Korean-inspired palette (obangsaek + modern tones) */
	--bg: #f6f9fb;           /* very light blue */
	--card: #ffffff;
	--primary: #003478;      /* deep hanblue */
	--accent: #c8102e;       /* vivid taegeuk red */
	--gold: #f2b705;         /* warm gold */
	--muted: #6b7280;
	--success: #16a34a;
	--danger: #dc2626;
	--soft-border: #e6eef8;
}

*{box-sizing:border-box;font-family:Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial}
html,body{height:100%;}
body{margin:0;background:linear-gradient(180deg,var(--bg),#ffffff);color:#0b1220;display:flex;align-items:flex-start;justify-content:center;padding:24px}
.app{max-width:920px;width:min(920px,96%);margin:15vh auto 0;padding:28px}
h1{margin:0 0 6px;font-size:22px;color:var(--primary);letter-spacing:0.2px}
.card-header{display:flex;align-items:center;justify-content:flex-start;gap:12px;margin-bottom:12px}
.title-help{margin-left:6px;background:transparent;border:1px solid var(--soft-border);padding:6px 8px;border-radius:8px;color:var(--primary);font-weight:700;cursor:pointer}
.title-help:hover{background:rgba(0,52,120,0.03)}
.title-about{margin-left:6px;background:transparent;border:1px solid var(--soft-border);padding:6px 10px;border-radius:8px;color:var(--primary);font-weight:700;cursor:pointer}
.title-about:hover{background:rgba(0,52,120,0.03)}
.header-actions{display:flex;gap:8px;align-items:center}
.header-actions button{padding:6px 10px;border-radius:8px;border:1px solid var(--soft-border);background:#fff;color:var(--primary);font-weight:600;box-shadow:0 4px 12px rgba(3,31,65,0.04)}
.controls{display:flex;gap:12px;flex-wrap:wrap;margin-bottom:14px;align-items:center;width:100%;max-height:80px;overflow:auto}

.filters{display:flex;flex-direction:row;gap:8px;order:2;flex:1;align-items:stretch;margin-left:12px}

/* Filter card: visually match progress cards but without hover/transform animation */
.filter-card{background:linear-gradient(180deg,#fff,#fbfdff);border-radius:10px;padding:6px 8px;border:1px solid var(--soft-border);min-width:180px;box-shadow:0 6px 18px rgba(3,31,65,0.04);display:flex;flex-direction:column;justify-content:center;gap:4px;flex:1;min-width:0;max-height:64px;overflow:hidden}
.filter-card .card-title{font-size:11px;color:var(--muted);background:transparent;padding:0;margin:0 0 0 0;border-radius:8px;display:inline-block}
.filter-card select{width:100%;padding:6px 8px;border-radius:6px;border:1px solid var(--soft-border);background:#ffffff;color:var(--primary);font-size:12px;font-weight:700;line-height:1.1;box-shadow:none;appearance:auto;-webkit-appearance:menulist-button}

.filter-card select:focus{outline:none;box-shadow:none}

/* On small screens the filters occupy their own row and each spans full width */
@media (max-width:740px){
	.controls{flex-direction:column;align-items:stretch}
	.progress-cards{order:1}
	.filters{order:2;flex-direction:column;width:100%;gap:10px;margin-left:0}
	/* reduce filter card height for mobile */
	.filter-card{width:100%;min-width:0;padding:8px 10px;border-radius:12px;max-height:none;overflow:visible}
	/* allow controls to grow on mobile instead of scrolling */
	.controls{max-height:none;overflow:visible}
	.filter-card .card-title{margin-bottom:6px;padding:0}
	.filter-card select{padding:8px 10px;font-size:13px}
}

/* Mode toggle (prominent) */
#toggleMode{
	padding:10px 10px;border-radius:10px;border:0;background:linear-gradient(180deg,var(--primary),#002b54);color:#fff;font-weight:700;box-shadow:0 8px 24px rgba(0,50,120,0.12);
}
#toggleMode:hover{transform:translateY(-2px)}

/* Large toggle matching progress cards - refined for contrast */
.mode-toggle{
	display:inline-flex;
	align-items:center;
	gap:6px;
	min-width:110px;
	height:48px;
	padding:0 10px;
	border-radius:8px;
	background:linear-gradient(180deg,var(--primary),#002b54);
	border:1px solid rgba(0,0,0,0.06);
	box-shadow:0 6px 18px rgba(2,24,50,0.10);
	color:#ffffff;
	font-weight:700;
	cursor:pointer;
}
.mode-toggle:focus{outline:3px solid rgba(255,255,255,0.12);outline-offset:4px}
.mode-toggle .mode-label{font-size:14px;color:rgba(255,255,255,0.92);font-weight:700}
.mode-toggle .mode-label.en,.mode-toggle .mode-label.kr{display:inline-block;white-space:nowrap}
.mode-toggle .mode-switch{width:42px;height:22px;border-radius:999px;background:#ffffff;border:0;display:inline-flex;align-items:center;padding:3px;position:relative}
.mode-toggle .mode-switch .knob{width:16px;height:16px;border-radius:50%;background:var(--primary);box-shadow:0 5px 12px rgba(0,52,120,0.20);transform:translateX(0);transition:transform .22s cubic-bezier(.2,.9,.2,1),background .12s ease}

/* Smaller toggle when placed inside the card */
.mode-toggle.in-card{height:28px;min-width:64px;padding:0 3px;border-radius:8px}
.mode-toggle.in-card .mode-switch{width:24px;height:14px;padding:1px;border-radius:999px}
.mode-toggle.in-card .mode-switch .knob{width:9px;height:9px;box-shadow:0 2px 6px rgba(0,52,120,0.14);transition:transform .16s ease}
.mode-toggle.in-card[data-mode="KR->EN"] .mode-switch .knob{transform:translateX(13px)}
.mode-toggle.in-card{margin-bottom:0}
.mode-toggle.in-card[data-mode="EN->KR"] .mode-switch .knob{transform:translateX(0)}

/* Focus toggle (eye) placed next to the small mode toggle */
.focus-toggle{margin-left:8px;height:28px;min-width:36px;padding:4px 8px;border-radius:8px;border:1px solid var(--soft-border);background:#fff;color:var(--primary);font-weight:700;cursor:pointer;display:inline-flex;align-items:center;justify-content:center}
.focus-toggle[aria-pressed="true"]{background:#fff;color:var(--primary);border-color:var(--primary);box-shadow:0 4px 10px rgba(0,52,120,0.06)}

/* When `.focus-mode` is active on the app, hide everything except the main practice card */
.app.focus-mode > :not(.card-area){display:none !important}
.app.focus-mode .card-area{margin:0;padding:20px;border-radius:12px}

/* Active label coloring based on data-mode; stronger contrast */
.mode-toggle[data-mode="EN->KR"] .mode-label.en{color:rgba(255,255,255,0.98);font-weight:800}
.mode-toggle[data-mode="EN->KR"] .mode-label.kr{color:rgba(255,255,255,0.78)}
.mode-toggle[data-mode="EN->KR"] .mode-switch{background:#ffffff;border:0}
.mode-toggle[data-mode="EN->KR"] .mode-switch .knob{transform:translateX(0);background:var(--primary)}

.mode-toggle[data-mode="KR->EN"] .mode-label.kr{color:rgba(255,255,255,0.98);font-weight:800}
.mode-toggle[data-mode="KR->EN"] .mode-label.en{color:rgba(255,255,255,0.78)}
.mode-toggle[data-mode="KR->EN"] .mode-switch{background:#ffffff;border:0}
.mode-toggle[data-mode="KR->EN"] .mode-switch .knob{transform:translateX(18px);background:var(--primary)}

@media (max-width:740px){
  .mode-toggle{min-width:120px;padding:10px 10px;gap:8px}
  .mode-toggle .mode-label{font-size:13px}
}

/* Mobile: place the language toggle under the progress cards */
@media (max-width:740px){
	.controls{display:flex;flex-direction:column;align-items:stretch;gap:10px}
	.progress-cards{order:1;width:100%;margin-left:0;display:flex;gap:8px}
	.mode-toggle{order:2;align-self:flex-start;margin-top:0}
}

/* Increase spacing between header actions and the language toggle on mobile */
@media (max-width:740px){
	.controls{gap:20px}
	.header-actions{gap:16px;align-items:center}
}

/* Reveal area */
#revealArea{font-weight:700;color:var(--primary);font-size:18px}
.reveal-details{color:var(--muted);font-size:13px;margin-top:8px}

/* Progress cards */
.progress-cards{display:flex;gap:12px;margin-left:0;align-items:stretch;order:1;flex:0 0 auto}
.prog-card{background:linear-gradient(180deg,#fff,#fbfdff);border-radius:10px;padding:8px 12px;border:1px solid var(--soft-border);min-width:155px;box-shadow:0 6px 18px rgba(3,31,65,0.04);display:flex;flex-direction:column;justify-content:center;max-height:64px;overflow:hidden}
.prog-card{cursor:pointer;transition:transform .12s ease,box-shadow .12s ease,border-color .12s ease}
.prog-card:hover{transform:translateY(-6px);box-shadow:0 14px 30px rgba(3,31,65,0.08);border-color:rgba(0,52,120,0.06)}
.prog-card:active{transform:translateY(-2px);box-shadow:0 8px 20px rgba(3,31,65,0.06)}
.prog-card:focus{outline:3px solid rgba(0,52,120,0.08);outline-offset:4px}
.prog-card .card-title{font-size:12px;color:var(--muted);margin-bottom:8px}
.prog-card .card-body{font-weight:800;font-size:18px;color:var(--primary)}
.prog-card .card-pct{font-weight:700;color:var(--muted);font-size:12px;margin-left:8px}
.prog-card.mastered{border-left:4px solid #16a34a}
.prog-card.not-mastered{border-left:4px solid #f2b705}
.prog-card.not-practised{border-left:4px solid #003478}

@media (max-width:740px){.progress-cards{flex-direction:column;gap:10px;width:100%;margin-left:0}.controls{flex-direction:row;align-items:center;flex-wrap:wrap}}

.card-area{background:var(--card);padding:20px;border-radius:12px;box-shadow:0 12px 30px rgba(6,20,44,0.06)}
.prompt{font-size:30px;margin-bottom:8px;color:var(--primary);font-weight:700}

/* prompt row: place speak button to the left of the prompt */
.prompt-row{display:flex;flex-direction:row;align-items:center;gap:8px;margin-top:10px;margin-bottom:8px}
.inline-speak{width:30px;height:30px;padding:4px;border-radius:8px;border:1px solid var(--soft-border);background:#f3f4f6;color:var(--muted);display:inline-flex;align-items:center;justify-content:center;font-size:12px}
.inline-speak[disabled]{opacity:0.45;cursor:not-allowed}
.example{color:var(--muted);margin-bottom:12px}

/* Inline prompt example (small muted text shown beside the prompt) */
.prompt-row .prompt{margin-bottom:0}
.prompt-example{color:var(--muted);font-size:14px;margin-left:10px;max-width:50%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.input-practice{display:flex;gap:8px;margin-bottom:12px;align-items:center}
#answerInput{flex:1;padding:10px;border:1px solid var(--soft-border);border-radius:10px;box-shadow:inset 0 1px 0 rgba(255,255,255,0.6)}

/* Check button (desktop and default) */
#checkBtn{
	padding:8px 12px;
	border-radius:10px;
	border:0;
	background:var(--primary);
	color:#fff;
	font-weight:700;
	cursor:pointer;
	box-shadow:0 6px 18px rgba(0,50,120,0.08);
	transition:transform .12s ease,filter .12s ease,box-shadow .12s ease;
}
#checkBtn:hover{ transform:translateY(-2px); filter:brightness(.98); }
#checkBtn:active{ transform:translateY(0); }
#checkBtn:focus{ outline:3px solid rgba(0,52,120,0.12); outline-offset:3px }

.quality-actions{display:flex;gap:10px;margin-top:6px}
.quality-actions button{padding:10px 12px;border-radius:10px;border:1px solid var(--soft-border);background:transparent;font-weight:700}
.quality-actions button#tryAnotherBtn{background:#ffffff;color:var(--primary);border:1px solid rgba(0,52,120,0.08)}
.quality-actions button#idkBtn{background:#fff5f5;border:1px solid rgba(220,38,38,0.12);color:var(--danger)}

.status{margin-top:14px;color:var(--muted)}
/* Learn more link styling (grey, subtle) */
.learn-more{color:var(--muted);text-decoration:none;border-bottom:1px dotted rgba(107,114,128,0.6);font-weight:700;font-size:0.95em}
.learn-more:hover{color:var(--primary);border-bottom-color:var(--primary)}
button{cursor:pointer}
footer{margin-top:18px;color:var(--muted)}

/* Modals */
.modal{display:none;position:fixed;inset:0;background:rgba(2,6,23,0.5);align-items:center;justify-content:center;padding:24px}
.modal[aria-hidden="false"]{display:flex}
.modal-content{background:var(--card);padding:18px;border-radius:12px;max-width:720px;width:100%;position:relative;box-shadow:0 20px 60px rgba(3,18,40,0.2);overflow:auto;max-height:calc(100vh - 48px)}
.modal-content h2{margin-top:0}
.modal-content .close{position:absolute;right:12px;top:8px;border:0;background:transparent;font-size:18px;padding:6px;border-radius:6px}

/* Mobile modal adjustments */
@media (max-width:740px){
	.modal{align-items:flex-start;padding-top:6vh}
	.modal-content{max-width:96%;padding:14px;border-radius:10px;max-height:calc(100vh - 80px)}
	.modal-content .close{right:10px;top:6px}
}

/* list modal items */
#listItems li{padding:8px 10px;border-bottom:1px solid #f1f5f9;cursor:pointer;display:flex;justify-content:space-between;align-items:center}
#listItems li:hover{background:#fbfdff}
#listItems .word-main{font-weight:700;color:var(--primary)}
#listItems .word-sub{font-size:13px;color:var(--muted);margin-left:10px}

/* search input inside list modal */
#listSearch{width:100%;padding:8px;border-radius:8px;border:1px solid var(--soft-border);font-size:14px}
#clearListSearch{background:transparent;border:0;color:var(--muted);cursor:pointer}
#clearListSearch:hover{color:var(--primary)}

/* Download progress button in Settings modal */
#exportCsv{
	display:inline-flex;
	align-items:center;
	gap:6px;
	padding:8px 10px;
	border-radius:10px;
	background: linear-gradient(180deg,var(--gold),#dea000);
	color: #082033;
	border: 0;
	font-weight:700;
	font-size:13px;
	box-shadow: 0 8px 18px rgba(218,165,32,0.10);
	cursor: pointer;
	transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
	text-decoration:none;
}
#exportCsv::before{content:'⬇';display:inline-block;font-size:12px;line-height:1}
#exportCsv:hover{ transform: translateY(-2px); filter: brightness(.98); box-shadow: 0 10px 26px rgba(218,165,32,0.12)}
#exportCsv:active{ transform: translateY(0); }
#exportCsv:focus{ outline:3px solid rgba(242,183,5,0.12); outline-offset:3px }

/* Download wordlist button (help popup) - match exportCsv style */
#downloadWordlist{
	display:inline-flex;
	align-items:center;
	gap:6px;
	padding:8px 10px;
	border-radius:10px;
	background: linear-gradient(180deg,var(--gold),#dea000);
	color: #082033;
	border: 0;
	font-weight:700;
	font-size:13px;
	box-shadow: 0 8px 18px rgba(218,165,32,0.10);
	cursor: pointer;
	transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
	text-decoration:none;
}
#downloadWordlist::before{content:'⬇';display:inline-block;font-size:12px;line-height:1}
#downloadWordlist:hover{ transform: translateY(-2px); filter: brightness(.98); box-shadow: 0 10px 26px rgba(218,165,32,0.12)}
#downloadWordlist:active{ transform: translateY(0); }
#downloadWordlist:focus{ outline:3px solid rgba(242,183,5,0.12); outline-offset:3px }

/* check / error badges */
.checkmark{display:inline-block;margin-left:8px;color:#fff;background:var(--success);border-radius:50%;width:30px;height:30px;line-height:30px;text-align:center;font-weight:700;opacity:0;transform:scale(.3);transition:opacity .18s,transform .18s}
.checkmark.show{opacity:1;transform:scale(1)}
.errormark{display:inline-block;margin-left:8px;color:#fff;background:var(--danger);border-radius:50%;width:30px;height:30px;line-height:30px;text-align:center;font-weight:700;opacity:0;transform:scale(.3);transition:opacity .18s,transform .18s}
.errormark.show{opacity:1;transform:scale(1)}

/* small responsive tweaks */
@media (max-width:460px){.prompt{font-size:24px}.prog-card{min-width:135px}}

/* tiny legal disclaimer (bottom-left) */
#legalDisclaimer{
	position:fixed;
	left:8px;
	right:8px;
	bottom:12px;
	font-size:11px;
	color:var(--muted);
	background:rgba(255,255,255,0.94);
	padding:8px 10px;
	border-radius:10px;
	z-index:60;
	opacity:0.98;
	box-shadow:0 8px 20px rgba(3,18,40,0.06);
	max-width:480px;
	margin:0 auto;
	left:12px;
	right:12px;
	text-align:left;
}
@media (max-width:740px){
	#legalDisclaimer{
		left:12px;
		right:12px;
		bottom:12px;
		font-size:11px;
		padding:10px 12px;
		border-radius:12px;
		max-width:calc(100% - 24px);
	}
}

/* Mobile / small screens: improve layout and touch targets */
@media (max-width:740px){
  .app{width:calc(100% - 32px);padding:16px;margin:12vh auto 0}
  .prompt{font-size:22px}
  #answerInput{padding:12px}
  .input-practice{flex-direction:column;align-items:stretch}
  #checkBtn{width:100%;margin-top:8px}
  .quality-actions{flex-direction:column;gap:8px}
  .quality-actions button{width:100%;padding:12px}
  .progress-cards{flex-direction:row;gap:8px;overflow-x:visible;border-radius:8px}
  .prog-card{flex:1;min-width:0;padding:8px 10px}
  .reveal-details{font-size:14px}

	/* place header actions next to the mode toggle and tighten gaps */
	.controls{gap:8px}
	.header-actions{margin-left:0;display:flex;gap:6px;align-items:center}

  /* reduce space between the Check button and action buttons */
  .input-practice{margin-bottom:6px}
  .quality-actions{margin-top:6px;gap:6px}

  /* slightly reduce icon spacing */
  .checkmark{margin-left:6px}
  .errormark{margin-left:6px}

}

/* Professional mobile refinements */
@media (max-width:740px){
	/* remove large viewport offset on mobile and keep a small top gutter */
	.app{margin:0;padding:0;width:100%}

	/* make check button prominent */
	#checkBtn{
		display:inline-block;
		width:100%;
		padding:12px 14px;
		border-radius:12px;
		border:0;
		background:var(--primary);
		color:#fff;
		font-weight:800;
		box-shadow:0 10px 30px rgba(0,50,120,0.12);
		transition:transform .12s ease,box-shadow .12s ease,filter .12s;
	}
	#checkBtn:hover{ transform:translateY(-2px); filter:brightness(.98) }
	#checkBtn:active{ transform:translateY(0) }
	#checkBtn:focus{ outline:3px solid rgba(0,52,120,0.12); outline-offset:3px }

	/* style action buttons for a clean mobile look */
	.quality-actions button#tryAnotherBtn{background:#fff;border:1px solid rgba(0,52,120,0.10);color:var(--primary);box-shadow:0 6px 18px rgba(3,31,65,0.04)}
	.quality-actions button#idkBtn{background:#fff;border:1px solid rgba(220,38,38,0.12);color:var(--danger)}
}

/* Ensure page content has enough bottom spacing on small screens
   so the fixed legal disclaimer doesn't overlap content */
@media (max-width:740px){
  body{padding-bottom:96px}
}

/* Ensure footer small text is visible above the fixed legal disclaimer on mobile */
@media (max-width:740px){
	footer{padding-bottom:0}
	footer small{display:block;margin-bottom:110px}
}

/* Make export button full-width on small screens for easier tapping */
@media (max-width:740px){
	#exportCsv{display:inline-flex;width:100%;padding:12px 14px;box-sizing:border-box}
}

@media (max-width:740px){
	#downloadWordlist{display:inline-flex;width:100%;padding:12px 14px;box-sizing:border-box}
}

/* Ensure modal overlays the fixed legal disclaimer */
.modal{z-index:220}

/* Make modal text use the site's font and colors for consistency */
.modal-content{font-family:inherit;color:inherit;font-size:15px}
.modal-content h2{color:var(--primary);margin-top:0}
.modal-content p, .modal-content ul, .modal-content li, .modal-content section{color:var(--muted);line-height:1.45}

/* When a modal is open, prevent page scrolling behind it */
html.modal-open, body.modal-open{overflow:hidden;height:100%;}


/* Fix: keep progress cards readable on very small screens
	 make them horizontally scrollable and give each card a sensible min-width */
@media (max-width:420px){
	.progress-cards{flex-direction:row;overflow-x:auto;gap:8px;padding-bottom:6px}
	.prog-card{flex:0 0 115px;min-width:115px;max-height:none;padding:8px 10px}
	.prog-card .card-body{font-size:15px}
	.prog-card .card-title{font-size:11px}
}

/* Smaller override for very small screens: use 103px when <=380px */
@media (max-width:380px){
	.prog-card{flex:0 0 103px;min-width:103px}
}

