/* class3-math-GM-ch13-common.css
   Class 3, Topic 13 "Time Goes On": look shared by ALL tiers (pictures, hints, the single-line answer chips,
   phone / tablet / desktop sizing). Popups carry the class "tg-overlay" (ids start with "tg").
   The popup frame itself (overlay, modal, stars, buttons) comes from the shared quiz css.
   Tier files add only their own small bits (class3-math-GM-ch13-t1.css, -t2.css ...). */

.quiz-overlay.tg-overlay .quiz-modal { -webkit-tap-highlight-color: transparent !important; overscroll-behavior: contain !important; }

/* ---------------- the picture card: matt paper, soft inner edge ---------------- */
.tg-overlay .tg-stage {
    margin: 6px auto 12px !important;
    width: 100% !important;
    max-width: 600px !important;
    padding: 10px 10px 12px !important;
    border-radius: 24px !important;
    background: linear-gradient(180deg, #FFFAEB 0%, #EEF7FF 100%) !important;
    box-shadow: inset 0 0 0 1.5px rgba(122, 104, 214, .16), 0 8px 18px rgba(60, 58, 110, .10) !important;
    box-sizing: border-box !important;
}
.tg-overlay .tg-svg {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-height: 340px !important;
    overflow: visible !important;
    font-family: "Nunito", "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}
.tg-overlay .tg-hint {
    margin-top: 6px !important;
    text-align: center !important;
    font-size: 13.5px !important;
    line-height: 1.35 !important;
    font-weight: 700 !important;
    color: #5A4FA0 !important;
}
.tg-overlay .tg-speak {
    display: inline-flex !important; align-items: center !important; gap: 4px !important;
    margin-left: 6px !important; padding: 5px 12px !important; min-height: 32px !important;
    border: 0 !important; border-radius: 999px !important;
    font: inherit !important; font-size: 13px !important; font-weight: 800 !important; color: #fff !important;
    background: linear-gradient(180deg, #7CC6FF, #3F8FE0) !important;
    box-shadow: 0 3px 8px rgba(47, 134, 214, .35) !important;
    cursor: pointer !important; touch-action: manipulation !important;
}
.tg-overlay .tg-speak:active { transform: scale(.95) !important; }

/* little animations: Hoppy bobs, "?" tiles glow, the picked card pops */
.tg-overlay .tg-pulse { animation: tgPulse 1.8s ease-in-out infinite !important; }
.tg-overlay .tg-hop { animation: tgBob 1.6s ease-in-out infinite !important; }
@keyframes tgPulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes tgBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* ---------------- the 4 answer chips: ONE line, always ---------------- */
.tg-overlay .tg-picker,
.tg-overlay [id$="Options"] {
    display: flex !important; flex-wrap: nowrap !important; grid-template-columns: none !important;
    justify-content: center !important; align-items: stretch !important;
    gap: 8px !important; width: 100% !important; max-width: 620px !important;
    margin: 8px auto 6px !important; padding: 0 !important; box-sizing: border-box !important;
}
.tg-overlay .tg-opt {
    position: relative !important;
    flex: 1 1 0 !important; width: auto !important; min-width: 0 !important; max-width: none !important;
    box-sizing: border-box !important; min-height: 60px !important; margin: 0 !important; padding: 8px 2px !important;
    display: flex !important; flex-direction: column !important; align-items: center !important; justify-content: center !important; gap: 2px !important;
    text-align: center !important; white-space: nowrap !important; overflow: hidden !important;
    border: 2px solid #CFC6F5 !important; border-radius: 16px !important;
    background: linear-gradient(180deg, #FFFFFF 0%, #F3EEFF 100%) !important;
    color: #2A2858 !important;
    font-family: "Nunito", "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important;
    font-weight: 800 !important; font-size: clamp(15px, 4.6vw, 24px) !important; line-height: 1.1 !important;
    box-shadow: 0 3px 0 #CFC6F5, 0 6px 12px rgba(60, 58, 110, .10) !important;
    cursor: pointer !important; touch-action: manipulation !important; -webkit-tap-highlight-color: transparent !important;
    transition: transform .08s ease, box-shadow .08s ease, background .15s ease;
}
/* longer words get a smaller (but still readable) size so the whole word stays inside the chip */
.tg-overlay .tg-opt.tg-sm { font-size: clamp(11.5px, 3.45vw, 21px) !important; }
.tg-overlay .tg-opt.tg-md { font-size: clamp(10.5px, 3.3vw, 19px) !important; letter-spacing: -.25px !important; }
.tg-overlay .tg-opt.tg-xs { font-size: clamp(10.5px, 3.05vw, 18px) !important; letter-spacing: -.35px !important; }
/* two-word names wrap onto two lines INSIDE the chip (the 4 chips stay on one row) */
.tg-overlay .tg-opt.tg-wrap { white-space: normal !important; font-size: clamp(12px, 3.6vw, 19px) !important; line-height: 1.12 !important; }
/* picture chips: a small icon above a short name */
.tg-overlay .tg-opt.tg-rich { min-height: 78px !important; padding-top: 6px !important; padding-bottom: 6px !important; font-size: clamp(11px, 3.2vw, 16px) !important; }
.tg-overlay .tg-opt .tg-chip-ic { width: clamp(30px, 9vw, 46px) !important; height: clamp(30px, 9vw, 46px) !important; flex: 0 0 auto !important; display: block !important; }
.tg-overlay .tg-opt .tg-chip-tx { display: block !important; max-width: 100% !important; white-space: normal !important; overflow-wrap: break-word !important; text-align: center !important; line-height: 1.1 !important; }
.tg-overlay .tg-opt:active:not(:disabled) { transform: translateY(2px) scale(.97) !important; box-shadow: 0 1px 0 #CFC6F5, 0 2px 6px rgba(60, 58, 110, .12) !important; }
.tg-overlay .tg-opt:disabled { cursor: default !important; }
.tg-overlay .tg-opt:disabled:not(.is-correct):not(.is-wrong) { opacity: .55 !important; }
.tg-overlay .tg-opt.is-correct {
    background: linear-gradient(180deg, #DDFBE8 0%, #9BEBB9 100%) !important; border-color: #2FB36A !important; color: #145A36 !important;
    box-shadow: 0 3px 0 #2FB36A, 0 6px 12px rgba(47, 179, 106, .25) !important; animation: tgPop .35s ease !important;
}
.tg-overlay .tg-opt.is-wrong {
    background: linear-gradient(180deg, #FFE6E1 0%, #FFB8AA 100%) !important; border-color: #E5604D !important; color: #8A2616 !important;
    box-shadow: 0 3px 0 #E5604D, 0 6px 12px rgba(229, 96, 77, .22) !important; animation: tgShake .32s ease !important;
}
@keyframes tgPop { 0% { transform: scale(.94); } 60% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes tgShake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* ---------------- phones ---------------- */
@media (max-width: 480px) {
    .tg-overlay .tg-stage { border-radius: 20px !important; padding: 8px 6px 10px !important; margin-bottom: 10px !important; }
    .tg-overlay .tg-hint { font-size: 12.5px !important; }
    .tg-overlay .tg-picker, .tg-overlay [id$="Options"] { gap: 6px !important; }
    .tg-overlay .tg-opt { min-height: 58px !important; border-radius: 14px !important; }
    .tg-overlay .tg-opt.tg-rich { min-height: 76px !important; }
}
@media (max-width: 340px) {
    .tg-overlay .tg-picker, .tg-overlay [id$="Options"] { gap: 4px !important; }
}
/* ---------------- tablets and desktops ---------------- */
@media (min-width: 700px) {
    .tg-overlay .tg-stage { padding: 14px 14px 16px !important; }
    .tg-overlay .tg-svg { max-height: 400px !important; }
    .tg-overlay .tg-hint { font-size: 15px !important; }
    .tg-overlay .tg-picker, .tg-overlay [id$="Options"] { gap: 12px !important; }
    .tg-overlay .tg-opt { min-height: 68px !important; }
    .tg-overlay .tg-opt.tg-rich { min-height: 92px !important; }
    .tg-overlay .tg-opt:hover:not(:disabled) { background: linear-gradient(180deg, #FFFFFF 0%, #E9E0FF 100%) !important; }
}
@media (prefers-reduced-motion: reduce) {
    .tg-overlay .tg-pulse, .tg-overlay .tg-hop, .tg-overlay .tg-opt.is-correct, .tg-overlay .tg-opt.is-wrong { animation: none !important; }
}

/* ---------------- drag and drop (every tier): cards, a bank, places / baskets, then the Check button ---------------- */
.tg-overlay .tg-picker:empty { display: none !important; }
.tg-overlay [id$="ActionRow"] { justify-content: center !important; margin: 8px 0 !important; }
.tg-overlay .tg-dnd { width: 100%; max-width: 640px; margin: 4px auto 8px; box-sizing: border-box; font-family: "Nunito", "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.tg-overlay .tg-bank {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-height: 66px; padding: 10px 8px; margin: 0 0 10px;
    border-radius: 18px; border: 2.5px dashed #F2C94C; background: linear-gradient(180deg, #FFFBEA, #FFF3C9); box-sizing: border-box;
}
.tg-overlay .tg-bank:empty { min-height: 40px; padding: 4px 8px; }
.tg-overlay .tg-bank:empty::after { content: "All cards are placed. Press Check!"; color: #8A6D00; font-weight: 800; font-size: 14px; align-self: center; }
.tg-overlay .tg-zones { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 8px; }
.tg-overlay .tg-zone {
    display: flex; flex-direction: column; align-items: stretch; min-height: 84px; padding: 6px; box-sizing: border-box;
    border-radius: 16px; border: 2.5px dashed #AE92FF; background: linear-gradient(180deg, #FFFFFF, #F3EEFF);
    transition: background .12s ease, border-color .12s ease, transform .12s ease;
}
.tg-overlay .tg-zt { display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center; font-weight: 800; font-size: 13px; line-height: 1.15; color: #5A4FA0; margin-bottom: 4px; }
.tg-overlay .tg-zt small { font-weight: 700; color: #7A72B8; font-size: 11px; display: block; }
.tg-overlay .tg-zt .tg-ci { width: 28px; height: 28px; flex: 0 0 auto; }
.tg-overlay .tg-zc { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 6px; min-height: 48px; }
.tg-overlay .tg-bank .tg-over, .tg-overlay .tg-zone.tg-over, .tg-overlay .tg-bank.tg-over { background: #E9F7FF; border-color: #3F8FE0; transform: scale(1.015); }
.tg-overlay .tg-has-sel .tg-zone, .tg-overlay .tg-has-sel .tg-bank { border-color: #3F8FE0; }
.tg-overlay .tg-card {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 74px; max-width: 100%; padding: 6px 8px; box-sizing: border-box;
    border-radius: 14px; border: 2px solid #CFC6F5; background: linear-gradient(180deg, #FFFFFF 0%, #F3EEFF 100%); color: #2A2858;
    box-shadow: 0 3px 0 #CFC6F5, 0 5px 10px rgba(60, 58, 110, .10); font-weight: 800; font-size: 14px; line-height: 1.12; text-align: center;
    cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.tg-overlay .tg-card .tg-ci { width: 40px; height: 40px; display: block; }
.tg-overlay .tg-card .tg-ct small { display: block; font-size: 10.5px; font-weight: 700; color: #6B64A8; }
.tg-overlay .tg-card.tg-lift { opacity: .3; }
.tg-overlay .tg-card.tg-sel { border-color: #3F8FE0; box-shadow: 0 0 0 3px rgba(63, 143, 224, .35), 0 3px 0 #3F8FE0; transform: translateY(-2px); }
.tg-overlay .tg-card.tg-fixed { cursor: default; background: linear-gradient(180deg, #F2F1FB, #E4E1F5); border-style: dashed; box-shadow: none; }
.tg-overlay .tg-card.tg-ok { background: linear-gradient(180deg, #DDFBE8 0%, #9BEBB9 100%); border-color: #2FB36A; color: #145A36; box-shadow: 0 3px 0 #2FB36A; }
.tg-overlay .tg-card.tg-bad { background: linear-gradient(180deg, #FFE6E1 0%, #FFB8AA 100%); border-color: #E5604D; color: #8A2616; box-shadow: 0 3px 0 #E5604D; animation: tgShake .32s ease; }
.tg-ghost { position: fixed !important; z-index: 2147483000 !important; pointer-events: none !important; margin: 0 !important; opacity: .95; transform: scale(1.08) rotate(-2deg); box-shadow: 0 12px 22px rgba(60, 58, 110, .30) !important; }
@media (max-width: 480px) {
    .tg-overlay .tg-zones { grid-template-columns: repeat(var(--colsm, var(--cols, 2)), minmax(0, 1fr)); }
    .tg-overlay .tg-card { min-width: 66px; font-size: 13px; padding: 5px 6px; }
    .tg-overlay .tg-card .tg-ci { width: 34px; height: 34px; }
}
@media (min-width: 700px) { .tg-overlay .tg-card { font-size: 16px; min-width: 90px; } .tg-overlay .tg-card .tg-ci { width: 48px; height: 48px; } }
@media (prefers-reduced-motion: reduce) { .tg-overlay .tg-card.tg-bad { animation: none; } }

/* ---------------- the calendar page (Tier 5 onward) ---------------- */
.tg-overlay .tg-cell rect { transition: fill .15s ease, stroke .15s ease; }
.tg-overlay .tg-calroot[data-mode="cell"] .tg-cell, .tg-overlay .tg-calroot[data-mode="head"] .tg-hd, .tg-overlay .tg-calroot[data-mode="title"] .tg-ttl,
.tg-overlay .tg-calroot[data-mode="any"] .tg-cell, .tg-overlay .tg-calroot[data-mode="any"] .tg-hd, .tg-overlay .tg-calroot[data-mode="any"] .tg-ttl,
.tg-overlay .tg-row-hit, .tg-overlay .tg-col-hit { cursor: pointer; }
.tg-overlay .tg-calroot:not([data-mode="cell"]):not([data-mode="any"]) .tg-cell { pointer-events: none; }
.tg-overlay .tg-calroot:not([data-mode="head"]):not([data-mode="any"]) .tg-hd { pointer-events: none; }
.tg-overlay .tg-calroot:not([data-mode="title"]):not([data-mode="any"]) .tg-ttl { pointer-events: none; }
.tg-overlay .tg-cell.hl rect { fill: #FFE27A; stroke: #E5A100; stroke-width: 2.6; }
.tg-overlay .tg-cell.to rect { fill: #FFB8AA; stroke: #E5604D; stroke-width: 2.6; }
.tg-overlay .tg-cell.on rect, .tg-overlay .tg-cell.ok rect, .tg-overlay .tg-cell.hop rect { fill: #9BEBB9; stroke: #2FB36A; stroke-width: 2.6; }
.tg-overlay .tg-cell.bad rect { fill: #FFB8AA; stroke: #E5604D; stroke-width: 2.6; }
.tg-overlay .tg-hd.on rect, .tg-overlay .tg-hd.ok rect { fill: #9BEBB9; stroke: #2FB36A; }
.tg-overlay .tg-hd.bad rect { fill: #FFB8AA; stroke: #E5604D; }
.tg-overlay .tg-ttl.on rect, .tg-overlay .tg-ttl.ok rect { fill: #9BEBB9; stroke: #2FB36A; }
.tg-overlay .tg-band { fill: #3F8FE0; fill-opacity: .20; stroke: #3F8FE0; stroke-opacity: .5; stroke-width: 1.6; }
.tg-overlay .tg-frog { transition: transform .35s cubic-bezier(.3, 1.6, .5, 1); pointer-events: none; }
.tg-overlay .tg-calcap { text-align: center; font-weight: 900; font-size: 17px; color: #3E3480; margin: 4px 0 6px; }
.tg-overlay .tg-calhead { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 4px; }
.tg-overlay .tg-calhead span { text-align: center; padding: 4px 0; border-radius: 9px; font-weight: 800; font-size: 12.5px; color: #2A2858; background: linear-gradient(180deg, #CBE9FF, #69BBFF); }
.tg-overlay .tg-calhead span:first-child { background: linear-gradient(180deg, #FFD6CD, #FF917F); }
.tg-overlay .tg-dnd.tg-cal .tg-zones { gap: 4px; }
.tg-overlay .tg-dnd.tg-cal .tg-zone { min-height: 42px; padding: 2px; border-width: 2px; border-radius: 10px; }
.tg-overlay .tg-dnd.tg-cal .tg-zone.tg-inert { border-color: transparent; background: transparent; }
.tg-overlay .tg-dnd.tg-cal .tg-zt { display: none; }
.tg-overlay .tg-dnd.tg-cal .tg-zc { min-height: 0; align-content: stretch; }
.tg-overlay .tg-dnd.tg-cal .tg-card { min-width: 0; width: 100%; padding: 6px 0; font-size: 16px; border-radius: 9px; box-shadow: 0 2px 0 #CFC6F5; }
.tg-overlay .tg-dnd.tg-cal .tg-bank .tg-card { width: auto; min-width: 46px; padding: 6px 8px; }
.tg-overlay .tg-dnd.tg-cal .tg-card.tg-fixed { background: #fff; border-style: solid; border-color: #C9CFF0; box-shadow: none; color: #2A2858; }
.tg-overlay .tg-dnd.tg-cal .tg-card.tg-ok { color: #145A36; }
.tg-overlay .tg-numrow { display: flex; justify-content: center; gap: 8px; margin: 8px 0 2px; flex-wrap: wrap; }
.tg-overlay .tg-num { width: 54px; height: 46px; text-align: center; font: inherit; font-weight: 800; font-size: 18px; color: #2A2858; border: 2px solid #CFC6F5; border-radius: 12px; background: #fff; box-sizing: border-box; }
.tg-overlay .tg-num:focus { outline: none; border-color: #3F8FE0; box-shadow: 0 0 0 3px rgba(63, 143, 224, .25); }
.tg-overlay .tg-numlab { text-align: center; font-weight: 800; font-size: 14px; color: #5A4FA0; margin-top: 6px; }
.tg-overlay .tg-live { text-align: center; font-weight: 800; font-size: 15px; color: #145A36; min-height: 22px; margin-top: 4px; }

/* ---------------- choice buttons (reflection questions in several tiers): a label, then buttons where one is "on" ---------------- */
.tg-overlay .tg-fav-lab { margin: 10px 0 6px; font-weight: 800; font-size: 14px; color: #5A4FA0; text-align: center; }
.tg-overlay .tg-fav-days { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tg-overlay .tg-fav-whys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tg-overlay .tg-dbtn, .tg-overlay .tg-rbtn {
    min-height: 48px; padding: 6px 4px; border-radius: 14px; border: 2px solid #CFC6F5; cursor: pointer; touch-action: manipulation;
    font: inherit; font-weight: 800; font-size: clamp(12px, 3.5vw, 16px); line-height: 1.15; color: #2A2858; -webkit-tap-highlight-color: transparent;
    background: linear-gradient(180deg, #FFFFFF, #F3EEFF); box-shadow: 0 3px 0 #CFC6F5;
}
.tg-overlay .tg-dbtn { border-color: var(--c, #CFC6F5); box-shadow: 0 3px 0 var(--c, #CFC6F5); }
.tg-overlay .tg-dbtn.on, .tg-overlay .tg-rbtn.on { background: linear-gradient(180deg, #DDFBE8, #9BEBB9); border-color: #2FB36A; box-shadow: 0 3px 0 #2FB36A; color: #145A36; }
.tg-overlay .tg-dbtn:active, .tg-overlay .tg-rbtn:active { transform: translateY(2px); }

/* probe: lets the common js know this file really loaded */
.tg-probe { --tg-loaded: 1; }
