/* ==========================================================================
   Flashcard Quizmaker
   Identity: paper + ink study tool. Signature = the physical flip card.
   Accent indigo for actions; a highlighter yellow only marks the "answer".
   ========================================================================== */

:root {
	--ink: #1b2130;
	--ink-soft: #3a4356;
	--muted: #6b7388;
	--paper: #eceef5;
	--surface: #ffffff;
	--surface-2: #f6f7fb;
	--line: #e0e3ee;
	--accent: #5a54e0;
	--accent-press: #463fce;
	--accent-tint: #ecebfb;
	--highlight: #ffd35c;
	--danger: #cf3b53;
	--success: #1f9d72;

	--radius: 16px;
	--radius-sm: 10px;
	--shadow: 0 1px 2px rgba(27, 33, 48, .06), 0 10px 30px -12px rgba(27, 33, 48, .18);
	--shadow-lift: 0 18px 50px -18px rgba(27, 33, 48, .34);

	--font-display: "Fraunces", Georgia, "Times New Roman", serif;
	--font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

	--maxw: 1040px;
}

* { box-sizing: border-box; }

body.fq-theme {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* ---- Top bar ---------------------------------------------------------- */
.fq-topbar {
	background: var(--surface);
	border-bottom: 1px solid var(--line);
	position: sticky;
	top: 0;
	z-index: 50;
}
.fq-topbar__inner {
	max-width: var(--maxw);
	margin: 0 auto;
	padding: 14px 22px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}
.fq-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; }
.fq-brand:hover { text-decoration: none; }
.fq-brand__mark {
	width: 22px; height: 28px; border-radius: 5px;
	background: var(--accent);
	box-shadow: 5px 4px 0 -1px var(--highlight);
	display: inline-block;
}
.fq-brand__name { font-family: var(--font-display); font-size: 1.18rem; letter-spacing: -.01em; }
.fq-nav { display: flex; align-items: center; gap: 18px; }
.fq-nav a { color: var(--ink-soft); font-weight: 500; font-size: .95rem; }
.fq-nav a:hover { color: var(--ink); text-decoration: none; }
.fq-nav__out { color: var(--muted) !important; }

/* ---- Shell ------------------------------------------------------------ */
.fq-shell { min-height: calc(100vh - 64px - 56px); }
.fq-main {
	max-width: var(--maxw);
	margin: 0 auto;
	padding: 40px 22px 64px;
}

/* ---- Eyebrow / headings ---------------------------------------------- */
.fq-eyebrow {
	margin: 0 0 6px;
	font-size: .74rem;
	font-weight: 600;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--accent);
}

/* ---- Buttons ---------------------------------------------------------- */
.fq-btn {
	display: inline-flex; align-items: center; justify-content: center;
	gap: 6px;
	font-family: var(--font-body);
	font-size: .95rem; font-weight: 600;
	line-height: 1;
	padding: 12px 18px;
	border-radius: var(--radius-sm);
	border: 1px solid transparent;
	cursor: pointer;
	transition: transform .08s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
	text-decoration: none;
}
.fq-btn:hover { text-decoration: none; }
.fq-btn:active { transform: translateY(1px); }
.fq-btn--primary { background: var(--accent); color: #fff; }
.fq-btn--primary:hover { background: var(--accent-press); color: #fff; }
.fq-btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.fq-btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.fq-btn--block { width: 100%; }
.fq-btn--sm { padding: 8px 12px; font-size: .85rem; }
.fq-btn:disabled { opacity: .55; cursor: default; transform: none; }

/* ---- Forms ------------------------------------------------------------ */
.fq-form { display: grid; gap: 16px; }
.fq-field { display: grid; gap: 7px; }
.fq-field > span { font-size: .85rem; font-weight: 600; color: var(--ink-soft); }
.fq-field input[type="email"],
.fq-field input[type="password"],
.fq-field input[type="text"],
.fq-field textarea {
	width: 100%;
	font: inherit;
	color: var(--ink);
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	padding: 11px 13px;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.fq-field textarea { resize: vertical; }
.fq-field input:focus,
.fq-field textarea:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-tint);
}
.fq-hint { color: var(--muted); font-size: .8rem; }

/* ---- Notices ---------------------------------------------------------- */
.fq-notice {
	border-radius: var(--radius-sm);
	padding: 11px 14px;
	font-size: .9rem;
	margin-bottom: 4px;
}
.fq-notice--error { background: #fdeaed; color: #9a1f33; }
.fq-notice--success { background: #e7f6ef; color: #0f6b4b; }

/* ---- Auth ------------------------------------------------------------- */
.fq-auth {
	min-height: 70vh;
	display: flex; align-items: center; justify-content: center;
	padding: 24px 0;
}
.fq-auth__card {
	width: 100%; max-width: 420px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 34px 32px;
	display: grid; gap: 16px;
}
.fq-auth__title { font-family: var(--font-display); font-weight: 600; font-size: 1.7rem; letter-spacing: -.02em; margin: 0 0 4px; }
.fq-auth__switch { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }

/* ---- Empty state ------------------------------------------------------ */
.fq-empty {
	background: var(--surface);
	border: 1px dashed var(--line);
	border-radius: var(--radius);
	padding: 40px 28px;
	text-align: center;
	color: var(--muted);
	display: grid; gap: 16px; justify-items: center;
}

/* ---- Dashboard -------------------------------------------------------- */
.fq-dash__head {
	display: flex; align-items: flex-end; justify-content: space-between;
	gap: 16px; margin-bottom: 28px;
}
.fq-dash__title { font-family: var(--font-display); font-weight: 600; font-size: 2rem; letter-spacing: -.02em; margin: 2px 0 0; }

.fq-decks {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 22px;
}
/* Deck tile reads like a small stack of cards (stacked-paper edges). */
.fq-deck {
	position: relative;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	transition: transform .12s ease, box-shadow .12s ease;
}
.fq-deck::before,
.fq-deck::after {
	content: "";
	position: absolute;
	left: 8px; right: 8px;
	height: 14px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	z-index: -1;
}
.fq-deck::before { bottom: -6px; }
.fq-deck::after { bottom: -11px; left: 16px; right: 16px; opacity: .7; }
.fq-deck:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.fq-deck__body { display: block; padding: 22px 20px 16px; color: var(--ink); }
.fq-deck__body:hover { text-decoration: none; }
.fq-deck__count { font-size: .76rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.fq-deck__name { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; line-height: 1.2; margin: 8px 0 18px; letter-spacing: -.01em; }
.fq-deck__cue { color: var(--accent); font-weight: 600; font-size: .9rem; }
.fq-deck__tools { display: flex; gap: 8px; padding: 0 16px 16px; }

/* ---- Editor ----------------------------------------------------------- */
.fq-editor { max-width: 760px; margin: 0 auto; }
.fq-editor__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.fq-back { color: var(--muted); font-weight: 600; font-size: .9rem; }
.fq-back:hover { color: var(--ink); text-decoration: none; }
.fq-editor__status { font-size: .88rem; font-weight: 600; color: var(--muted); min-height: 1.2em; }
.fq-editor__status.is-success { color: var(--success); }
.fq-editor__status.is-error { color: var(--danger); }
.fq-field--title { margin-bottom: 24px; }
.fq-field--title input { font-family: var(--font-display); font-size: 1.3rem; }

.fq-cards { display: grid; gap: 16px; }
.fq-card-edit {
	position: relative;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 20px 20px 18px 52px;
}
.fq-card-edit__num {
	position: absolute; top: 18px; left: 16px;
	width: 26px; height: 26px;
	display: flex; align-items: center; justify-content: center;
	background: var(--accent-tint); color: var(--accent);
	border-radius: 8px; font-weight: 700; font-size: .85rem;
	font-variant-numeric: tabular-nums;
}
.fq-card-edit__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.fq-card-edit__remove {
	margin-top: 14px;
	background: none; border: none; cursor: pointer;
	color: var(--muted); font: inherit; font-size: .82rem; font-weight: 600;
	padding: 0;
}
.fq-card-edit__remove:hover { color: var(--danger); }

.fq-atype { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; margin-bottom: 9px; }
.fq-atype__btn {
	border: none; background: none; cursor: pointer;
	font: inherit; font-size: .82rem; font-weight: 600; color: var(--muted);
	padding: 6px 14px; border-radius: 7px;
}
.fq-atype__btn.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(27,33,48,.12); }

.fq-upload {
	display: flex; align-items: center; justify-content: center;
	border: 1.5px dashed var(--line); border-radius: var(--radius-sm);
	padding: 22px 14px; text-align: center; cursor: pointer;
	color: var(--muted); font-size: .85rem; font-weight: 500;
}
.fq-upload:hover { border-color: var(--accent); color: var(--accent); }
.fq-upload input[type="file"] { display: none; }
.fq-aimg__preview { position: relative; }
.fq-aimg__preview img { border-radius: var(--radius-sm); border: 1px solid var(--line); max-height: 180px; width: auto; cursor: zoom-in; }
.fq-upload.is-dragover { border-color: var(--accent); background: var(--accent-tint); color: var(--accent); }
.fq-aimg__clear {
	margin-top: 8px;
	background: none; border: none; cursor: pointer;
	color: var(--muted); font: inherit; font-size: .8rem; font-weight: 600; padding: 0;
}
.fq-aimg__clear:hover { color: var(--danger); }

.fq-editor__actions { display: flex; align-items: center; gap: 12px; margin-top: 26px; }
.fq-spacer { flex: 1; }

/* ---- Share panel (editor) --------------------------------------------- */
.fq-share {
	background: var(--surface-2);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 16px 18px;
	margin-bottom: 24px;
}
.fq-share__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fq-share__label { font-size: .85rem; font-weight: 600; color: var(--ink-soft); }
.fq-share__panel { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.fq-share__panel input {
	flex: 1; min-width: 200px;
	font: inherit; font-size: .9rem; color: var(--ink-soft);
	background: var(--surface); border: 1px solid var(--line);
	border-radius: var(--radius-sm); padding: 9px 11px;
}
.fq-share__hint { margin: 10px 0 0; color: var(--muted); font-size: .82rem; }

/* ---- Shared (public) player chrome ------------------------------------ */
.fq-play__head--shared { justify-content: center; gap: 14px; }
.fq-shared-badge {
	font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
	color: var(--accent); background: var(--accent-tint);
	padding: 5px 10px; border-radius: 999px; white-space: nowrap;
}
.fq-shared-spacer { width: 1px; }
.fq-shared-foot { text-align: center; color: var(--muted); font-size: .9rem; margin-top: 24px; }

/* ---- Player: the study card (signature) ------------------------------- */
.fq-play { max-width: 640px; margin: 0 auto; text-align: center; perspective: 1600px; }
.fq-play__head {
	display: flex; align-items: center; justify-content: space-between;
	gap: 12px; margin-bottom: 8px; text-align: left;
}
.fq-play__title { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; letter-spacing: -.01em; margin: 0; flex: 1; text-align: center; }
.fq-play__progress { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; margin: 6px 0 18px; letter-spacing: .04em; }

/* A single solid card with a definite height: the image always fits inside,
   and the brief rotate gives it the feel of flipping over. */
.fq-card {
	position: relative;
	width: 100%;
	height: clamp(340px, 66vh, 620px);
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 22px;
	box-shadow: var(--shadow-lift);
	padding: 46px 24px 40px;
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	cursor: pointer;
	outline: none;
	transition: transform .17s ease;
	transform-style: preserve-3d;
}
.fq-card.is-flipping { transform: rotateY(90deg); }
.fq-card__tag {
	position: absolute; top: 18px; left: 20px;
	font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
	color: var(--muted);
}
.fq-card.is-answer .fq-card__tag { color: var(--ink); }
/* highlighter swipe under the Answer label — the one spot of yellow */
.fq-card.is-answer .fq-card__tag::after {
	content: ""; position: absolute; left: -2px; right: -4px; bottom: 1px; height: 7px;
	background: var(--highlight); z-index: -1; border-radius: 2px;
}
.fq-card__content { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: auto; }
.fq-card__text { font-family: var(--font-display); font-size: 1.55rem; line-height: 1.3; letter-spacing: -.01em; white-space: pre-wrap; word-break: break-word; }

/* Answer image: scales to fit fully inside the card, never overflows. */
.fq-img-wrap { position: relative; height: 100%; max-width: 100%; display: flex; align-items: center; justify-content: center; }
.fq-card__img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto; height: auto;
	border-radius: 10px;
}
.fq-zoom-btn {
	position: absolute; top: 8px; right: 8px;
	width: 34px; height: 34px; border-radius: 9px;
	border: none; cursor: pointer;
	background: rgba(27, 33, 48, .62); color: #fff;
	font-size: 1.05rem; line-height: 1;
	display: flex; align-items: center; justify-content: center;
	transition: background .15s ease;
}
.fq-zoom-btn:hover { background: rgba(27, 33, 48, .85); }
.fq-flip__hint { position: absolute; bottom: 16px; font-size: .78rem; color: var(--muted); }

/* ---- Lightbox (open + zoom any image) --------------------------------- */
.fq-lightbox {
	position: fixed; inset: 0; z-index: 1000;
	background: rgba(15, 18, 28, .93);
	display: flex; align-items: center; justify-content: center;
	cursor: zoom-out; touch-action: none; overflow: hidden;
}
.fq-lightbox[hidden] { display: none; }
.fq-lightbox__img {
	max-width: 94vw; max-height: 92vh;
	transform-origin: center center;
	will-change: transform;
	user-select: none; -webkit-user-drag: none;
	cursor: grab;
}
.fq-lightbox.is-zoomed .fq-lightbox__img { cursor: grab; }
.fq-lightbox__close {
	position: fixed; top: 16px; right: 18px;
	width: 44px; height: 44px; border-radius: 50%;
	border: none; cursor: pointer;
	background: rgba(255, 255, 255, .15); color: #fff;
	font-size: 1.5rem; line-height: 1;
	display: flex; align-items: center; justify-content: center;
}
.fq-lightbox__close:hover { background: rgba(255, 255, 255, .28); }
.fq-lightbox__hint {
	position: fixed; bottom: 18px; left: 0; right: 0;
	text-align: center; color: rgba(255, 255, 255, .72); font-size: .82rem;
}

.fq-play__controls { display: flex; gap: 10px; justify-content: center; margin-top: 26px; }

/* ---- Hero ------------------------------------------------------------- */
.fq-home { max-width: var(--maxw); }
.fq-hero { padding: 30px 0 20px; max-width: 720px; }
.fq-hero__title { font-family: var(--font-display); font-weight: 600; font-size: clamp(2.4rem, 6vw, 3.8rem); line-height: 1.04; letter-spacing: -.03em; margin: 6px 0 18px; }
.fq-hero__lead { font-size: 1.12rem; color: var(--ink-soft); max-width: 30em; margin: 0 0 26px; }
.fq-hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }

.fq-hero__demo { position: relative; height: 220px; margin-top: 56px; max-width: 340px; }
.fq-demo-card {
	position: absolute; inset: 0;
	background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
	box-shadow: var(--shadow);
}
.fq-demo-card--3 { transform: rotate(-6deg) translateY(10px); opacity: .55; }
.fq-demo-card--2 { transform: rotate(3deg) translateY(4px); opacity: .8; }
.fq-demo-card--1 {
	box-shadow: var(--shadow-lift);
	padding: 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
}
.fq-demo-card--1 p { font-family: var(--font-display); font-size: 1.5rem; margin: 0; text-align: center; letter-spacing: -.01em; }

/* ---- Footer ----------------------------------------------------------- */
.fq-footer { border-top: 1px solid var(--line); background: var(--surface); }
.fq-footer__inner {
	max-width: var(--maxw); margin: 0 auto; padding: 18px 22px;
	display: flex; justify-content: space-between; align-items: center;
	color: var(--muted); font-size: .85rem;
}
.fq-footer__tag { font-family: var(--font-display); }

/* ---- Focus visibility ------------------------------------------------- */
.fq-btn:focus-visible,
.fq-card:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
	outline: 3px solid var(--accent-tint);
	outline-offset: 2px;
}

/* ---- Responsive ------------------------------------------------------- */
@media (max-width: 620px) {
	.fq-card-edit__grid { grid-template-columns: 1fr; }
	.fq-dash__head { flex-direction: column; align-items: flex-start; }
	.fq-card__text { font-size: 1.25rem; }
	.fq-editor__actions { flex-wrap: wrap; }
	.fq-spacer { flex-basis: 100%; height: 0; }
}

/* ---- Reduced motion --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.fq-card { transition: none; }
	.fq-deck, .fq-btn { transition: none; }
}
