/* Tokenizer playground (Assignment 05) — modal shell + tool UI.
 * Modal rules mirror .teachable-modal / .lidar-modal; tool colors use the
 * global theme variables from style.css. */

/* ----------------------------------------------------------------------- */
/* Full-page modal overlay                                                  */
/* ----------------------------------------------------------------------- */

.tokenizer-modal {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.tokenizer-modal[hidden] {
	display: none;
}

.tokenizer-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
}

.tokenizer-modal__dialog {
	position: relative;
	z-index: 1;
	width: min(960px, 100vw);
	height: min(860px, 100vh);
	max-width: 100vw;
	max-height: 100vh;
	display: flex;
	flex-direction: column;
	background: var(--bg, #fff);
	color: var(--fg, #111);
	border: 1px solid var(--border, #dadce0);
	border-radius: 12px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
	overflow: hidden;
}

.tokenizer-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.9rem 1.25rem;
	border-bottom: 1px solid var(--border, #dadce0);
	background: var(--surface, #fff);
}

.tokenizer-modal__title {
	font-weight: 700;
}

.tokenizer-modal__close {
	appearance: none;
	border: none;
	background: transparent;
	color: var(--muted, #5f6368);
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}

.tokenizer-modal__close:hover {
	color: var(--fg, #111);
}

.tokenizer-modal__body {
	flex: 1 1 auto;
	min-height: 0;
	padding: 1.25rem;
	overflow: auto;
	display: flex;
	flex-direction: column;
}

.tokenizer-modal__footer {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.85rem 1.25rem;
	border-top: 1px solid var(--border, #dadce0);
	background: var(--surface, #fff);
}

.tokenizer-modal__spacer {
	flex: 1;
}

.tokenizer-modal__close-btn {
	appearance: none;
	border: 1px solid var(--accent, #1967d2);
	background: var(--accent, #1967d2);
	color: #fff;
	font: inherit;
	font-weight: 600;
	padding: 0.5rem 0.9rem;
	border-radius: 8px;
	cursor: pointer;
}

body.tokenizer-modal-open {
	overflow: hidden;
}

/* Open button inside assignment prompts */
.tokenizer-open {
	appearance: none;
	border: 1px solid var(--accent, #1967d2);
	background: var(--accent, #1967d2);
	color: #fff;
	font: inherit;
	font-weight: 600;
	padding: 0.45rem 0.85rem;
	border-radius: 8px;
	cursor: pointer;
	margin: 0.35rem 0.5rem 0.35rem 0;
}

.tokenizer-open:hover {
	filter: brightness(1.05);
}

a.tokenizer-standalone {
	font-weight: 600;
}

/* ----------------------------------------------------------------------- */
/* Standalone page                                                          */
/* ----------------------------------------------------------------------- */

.tk-page {
	min-height: 100vh;
	background: var(--bg, #f5f6f8);
	color: var(--fg, #202124);
	font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

.tk-page__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem 1.5rem;
	border-bottom: 1px solid var(--border, #dadce0);
	background: #fff;
}

.tk-page__bar h1 {
	margin: 0;
	font-size: 1.25rem;
}

.tk-page__main {
	max-width: 960px;
	margin: 0 auto;
	padding: 1.5rem;
}

.tk-page__intro {
	margin: 0 0 1rem;
	color: var(--muted, #5f6368);
	line-height: 1.5;
}

/* ----------------------------------------------------------------------- */
/* Simulator UI                                                             */
/* ----------------------------------------------------------------------- */

.tk-sim {
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
	flex: 1 1 auto;
	min-height: 0;
}

.tk-sim__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
}

.tk-sim__encodings {
	display: flex;
	flex-wrap: wrap;
	gap: 0.65rem 1rem;
}

.tk-radio {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.95rem;
	cursor: pointer;
}

.tk-radio input {
	accent-color: var(--accent, #1967d2);
}

.tk-sim__actions {
	display: flex;
	gap: 0.5rem;
}

.tk-btn {
	appearance: none;
	border: 1px solid #3c4043;
	background: #3c4043;
	color: #fff;
	font: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	padding: 0.4rem 0.75rem;
	border-radius: 8px;
	cursor: pointer;
}

.tk-btn--ghost {
	background: #e8eaed;
	border-color: #e8eaed;
	color: #202124;
}

.tk-btn:hover {
	filter: brightness(1.05);
}

.tk-sim__editor {
	position: relative;
	flex: 1 1 auto;
	min-height: 220px;
	border: 1px solid var(--border, #dadce0);
	border-radius: 10px;
	background: #fff;
	overflow: hidden;
}

.tk-sim__input,
.tk-sim__overlay {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	padding: 1rem;
	margin: 0;
	border: 0;
	outline: none;
	resize: none;
	font: inherit;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.98rem;
	line-height: 1.55;
	white-space: pre-wrap;
	word-break: break-word;
	overflow: auto;
	box-sizing: border-box;
}

.tk-sim__input {
	background: transparent;
	color: #202124;
	caret-color: #202124;
	z-index: 2;
}

.tk-sim__input--ghost {
	color: transparent;
	-webkit-text-fill-color: transparent;
}

.tk-sim__overlay {
	z-index: 1;
	pointer-events: none;
	color: #202124;
}

.tk-tkn {
	border-radius: 3px;
	padding: 0.05em 0;
}

.tk-sim__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1rem;
}

.tk-sim__stats {
	display: flex;
	gap: 2rem;
}

.tk-stat__label {
	display: block;
	font-size: 0.85rem;
	font-weight: 700;
}

.tk-stat__value {
	display: block;
	font-size: 1.75rem;
	font-weight: 700;
	line-height: 1.2;
	font-variant-numeric: tabular-nums;
}

.tk-sim__views {
	display: inline-flex;
	border: 1px solid var(--border, #dadce0);
	border-radius: 8px;
	overflow: hidden;
}

.tk-view {
	appearance: none;
	border: 0;
	background: #fff;
	color: #202124;
	font: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	padding: 0.4rem 0.85rem;
	cursor: pointer;
}

.tk-view.is-active {
	background: #3c4043;
	color: #fff;
}

.tk-sim__ids {
	/* Secondary panel below the still-visible highlighted editor */
	min-height: 5.5rem;
	max-height: 12rem;
	padding: 1rem;
	border: 1px solid var(--border, #dadce0);
	border-radius: 10px;
	background: #fff;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.95rem;
	line-height: 1.55;
	white-space: pre-wrap;
	word-break: break-word;
	overflow: auto;
}

.tk-sim__status {
	margin: 0;
	color: #b06000;
	font-size: 0.9rem;
}

.tk-sim__status[hidden] {
	display: none;
}

.tk-sim__footnote {
	margin: 0;
	color: var(--muted, #5f6368);
	font-size: 0.85rem;
	line-height: 1.4;
}

.tk-sim__footnote a {
	color: inherit;
}
