/* AE Glossary — flashcards */
.aegf { max-width: 720px; padding-top: 22px; }
.aegf-head { display: flex; flex-direction: column; gap: 6px; }
.aeg-back-link { color: var(--g-navy); text-decoration: none; font-size: 14px; font-weight: 600; }
.aegf-title { margin: 0; font-size: clamp(24px, 4vw, 32px); color: var(--g-navy); font-family: var(--ae-serif, Georgia, serif); }
.aegf-title span { font-size: .55em; color: var(--g-muted); letter-spacing: .08em; text-transform: uppercase; margin-left: 8px; font-family: var(--ae-sans, sans-serif); }

.aegf-settings { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-top: 18px; padding: 14px 16px; background: var(--g-surface); border: 1px solid var(--g-line); border-radius: var(--g-radius); }
.aegf-sel { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--g-muted); }
.aegf-sel select { font-size: 14px; padding: 6px 10px; border: 1.5px solid var(--g-line); border-radius: 8px; background: #fff; color: var(--g-text); max-width: 210px; }
.aegf-seg { display: inline-flex; background: var(--g-tint); border-radius: 999px; padding: 3px; }
.aegf-seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--g-muted); cursor: pointer; }
.aegf-seg button.is-on { background: #fff; color: var(--g-navy); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.aegf-opts { display: inline-flex; gap: 14px; font-size: 13px; color: var(--g-text); }
.aegf-opts label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.aegf-opts input { accent-color: var(--g-navy); width: 16px; height: 16px; }

.aegf-progress { margin: 18px 0 14px; }
.aegf-bar { height: 8px; background: var(--g-tint); border-radius: 99px; overflow: hidden; }
.aegf-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--g-navy), var(--g-gold)); border-radius: 99px; transition: width .35s ease; }
.aegf-stats { display: flex; gap: 16px; font-size: 14px; color: var(--g-muted); margin-top: 8px; }
.aegf-stats #aegf-pos { font-weight: 700; color: var(--g-text); margin-right: auto; }
.aegf-k b { color: #2c7a83; }
.aegf-u b { color: #c0533a; }

/* card */
.aegf-stage { perspective: 1400px; }
.aegf-card { position: relative; height: clamp(430px, 72vh, 520px); transform-style: preserve-3d; transition: transform .5s cubic-bezier(.3, .7, .3, 1); cursor: pointer; outline: none; }
.aegf-card.no-anim { transition: none; }
.aegf-card.is-flipped { transform: rotateY(180deg); }
.aegf-card.swipe-r { transform: rotateY(180deg) translateX(-40px) rotate(-4deg); opacity: .6; }
.aegf-card.swipe-l { transform: rotateY(180deg) translateX(40px) rotate(4deg); opacity: .6; }
.aegf-card:focus-visible .aegf-face { box-shadow: 0 0 0 3px var(--g-gold); }
.aegf-face {
	position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
	background: var(--g-surface); border: 1px solid var(--g-line); border-radius: 22px;
	box-shadow: var(--ae-shadow-lg, 0 18px 48px rgba(16, 30, 54, .12));
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 22px 24px; text-align: center; overflow: hidden;
}
.aegf-front { border-top: 6px solid var(--g-navy); }
.aegf-back { transform: rotateY(180deg); border-top: 6px solid var(--g-gold); background: linear-gradient(180deg, #fffdf7, var(--g-surface)); }
.aegf-img { width: min(62%, 300px); aspect-ratio: 800 / 430; border-radius: 12px; overflow: hidden; background: var(--g-paper); border: 1px solid var(--g-line); flex: none; }
.aegf-img img { width: 100%; height: 100%; object-fit: cover; object-position: center bottom; display: block; } /* crops the diagram title so it doesn't give the answer away */
.aegf-main { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
.aegf-en { font-family: Georgia, "Times New Roman", serif; color: var(--g-navy); font-size: 22px; line-height: 1.2; word-break: break-word; }
.aegf-en.is-big { font-size: clamp(30px, 6.5vw, 44px); font-weight: 700; }
.aegf-en small { font-size: .5em; color: var(--g-muted); font-family: var(--ae-sans, sans-serif); font-weight: 400; }
.aegf-ja { font-size: 18px; color: var(--g-text); font-weight: 600; }
.aegf-ja.is-big { font-size: clamp(28px, 6vw, 40px); font-weight: 800; color: var(--g-text); }
.aegf-sub { display: flex; align-items: center; gap: 10px; color: var(--g-muted); font-size: 14px; }
.aegf-say { width: 44px; height: 44px; }
.aegf-say svg { width: 22px; height: 22px; }
.aegf-divider { width: 60px; height: 2px; background: var(--g-line); margin: 4px 0; }
.aegf-hint { position: absolute; bottom: 14px; left: 0; right: 0; margin: 0; font-size: 12px; color: var(--g-muted); }
.aegf-more { position: absolute; bottom: 14px; right: 20px; font-size: 13px; color: var(--g-navy); font-weight: 600; text-decoration: none; }

/* buttons */
.aegf-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 18px; }
.aegf-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; border-radius: 14px; font-size: 16px; font-weight: 700; cursor: pointer; border: 2px solid transparent; transition: transform .1s, opacity .2s; }
.aegf-btn small { font-size: 11px; font-weight: 500; opacity: .8; }
.aegf-btn:active { transform: scale(.97); }
.aegf-btn:disabled { opacity: .35; cursor: default; }
.aegf-flip { background: var(--g-navy); color: #fff; }
.aegf-ok { background: #e3f1f2; color: #1f5f66; border-color: #2c7a83; }
.aegf-again { background: #fbe9e4; color: #9a3d27; border-color: #c0533a; }
.aegf-keys { text-align: center; font-size: 12px; color: var(--g-muted); margin: 12px 0 0; }

/* result */
.aegf-done { margin-top: 20px; background: var(--g-surface); border: 1px solid var(--g-line); border-radius: 22px; padding: 28px 24px; text-align: center; box-shadow: var(--g-shadow); }
.aegf-score { font-size: 22px; color: var(--g-muted); }
.aegf-score b { font-size: 56px; color: var(--g-navy); font-family: Georgia, serif; }
.aegf-score span { display: block; font-size: 15px; font-weight: 700; color: var(--g-gold); margin-top: 2px; }
.aegf-done > p { font-size: 16px; margin: 10px 0 18px; }
.aegf-review h2 { font-size: 14px; color: #9a3d27; margin: 0 0 10px; }
.aegf-review ul { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 8px; text-align: left; }
.aegf-review a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--g-line); border-radius: 10px; text-decoration: none; color: var(--g-navy); font-weight: 600; }
.aegf-review a span[lang="ja"] { color: var(--g-muted); font-weight: 400; }
.aegf-doneact { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.aegf [hidden] { display: none !important; }

@media (max-width: 600px) {
	.aegf { padding-top: 12px; }
	.aegf-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px; }
	.aegf-sel > span { display: none; }
	.aegf-sel select { max-width: none; width: 100%; font-size: 13px; }
	.aegf-seg { grid-column: 1 / -1; justify-content: stretch; }
	.aegf-seg button { flex: 1; }
	.aegf-opts { grid-column: 1 / -1; justify-content: center; }
	.aegf-progress { margin: 12px 0 10px; }
	.aegf-card { height: clamp(340px, 54vh, 440px); }
	.aegf-face { gap: 10px; padding: 16px 16px 34px; }
	.aegf-img { width: 82%; }
	.aegf-actions { margin-top: 12px; gap: 8px; }
	.aegf-btn { min-height: 54px; font-size: 15px; }
	.aegf-keys { display: none; }
}
