.rt-ex { --rt-ex-bar: 75px; --rt-ex-nav: 65px; --rt-ex-ctx: 110px; }
body:has(.rt-ex) { overflow: hidden; }
body:has(.rt-ex) #main-header { display: none; }

.rt-ex-bar {
    position: fixed; top: 0; left: 0; z-index: 4000; width: 100%; height: var(--rt-ex-bar); display: flex; justify-content: center; align-items: center;
    background: var(--rt-card-bg); border-bottom: 1px solid var(--rt-border);
}
.rt-ex-bar-in { position: relative; width: 100%; max-width: 800px; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; }
.rt-ex-meta { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; color: var(--rt-text-main); }
.rt-ex-meta i { color: var(--rt-accent); }
.rt-ex-timer { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 20px; color: #DC2626; }
.rt-ex-timer.is-low { animation: rtExPulse 1s ease-in-out infinite; }
@keyframes rtExPulse { 50% { opacity: .45; } }
.rt-ex-title { position: absolute; left: 50%; transform: translateX(-50%); font-size: 17px; font-weight: 800; letter-spacing: -.3px; color: var(--rt-text-main); white-space: nowrap; }

.rt-ex-stage {
    max-width: 800px; min-height: 100vh; min-height: 100dvh; margin: 0 auto; display: flex; align-items: center; justify-content: center;
    padding: calc(var(--rt-ex-bar) + 10px) 20px calc(var(--rt-ex-nav) + 10px); box-sizing: border-box;
}
.rt-ex-form { width: 100%; }

.rt-ex-card {
    display: none; width: 100%; max-height: calc(100dvh - var(--rt-ex-bar) - var(--rt-ex-nav) - 30px); overflow-y: auto; padding: 30px 35px;
    background: var(--rt-card-bg); border: 1px solid var(--rt-border); border-radius: 20px; box-shadow: 0 10px 30px rgba(15, 31, 46, .04); box-sizing: border-box;
}
.rt-ex-card.active { display: block; animation: rtExIn .3s ease; }
@keyframes rtExIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.rt-ex-qno-d { display: block; margin-bottom: 12px; font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--rt-accent); }
.rt-ex-qbox { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.rt-ex-qbox.has-img { justify-content: space-between; }
.rt-ex-qbox.no-img { flex-direction: column; align-items: flex-start; }
.rt-ex-qtext { flex: 1; margin: 0; font-size: 19px; font-weight: 700; line-height: 1.4; color: var(--rt-text-main); }
.rt-ex-qimg { flex-shrink: 0; width: 90px; height: 90px; padding: 6px; display: flex; align-items: center; justify-content: center; background: var(--bg); border: 1.5px solid var(--rt-border); border-radius: 14px; box-sizing: border-box; }
.rt-ex-qimg img { max-width: 100%; max-height: 100%; object-fit: contain; }

.rt-ex-options { display: flex; flex-direction: column; gap: 8px; }
.rt-ex-opt {
    position: relative; display: flex; align-items: center; gap: 12px; padding: 13px 16px; font-size: 14px; font-weight: 500; color: var(--rt-text-main);
    background: var(--rt-card-bg); border: 2px solid var(--rt-border); border-radius: 12px; cursor: pointer; transition: var(--rt-ease, all .2s ease);
}
.rt-ex-opt:hover { border-color: var(--rt-accent); }
.rt-ex-opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.rt-ex-radio { flex-shrink: 0; width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; border: 2px solid var(--rt-text-muted); border-radius: 50%; }
.rt-ex-opt:has(input:checked) { color: var(--rt-accent); background: var(--rt-tint); border-color: var(--rt-accent); }
.rt-ex-opt:has(input:checked) .rt-ex-radio { border-color: var(--rt-accent); }
.rt-ex-opt:has(input:checked) .rt-ex-radio::after { content: ''; width: 7px; height: 7px; background: var(--rt-accent); border-radius: 50%; }
.rt-ex-opt:has(input:focus-visible) { outline: 3px solid rgba(22, 163, 74, .35); outline-offset: 2px; }

.rt-ex-nav { position: fixed; bottom: 0; left: 0; z-index: 2500; width: 100%; background: var(--rt-card-bg); border-top: 1px solid var(--rt-border); }
.rt-ex-nav-in { max-width: 800px; height: var(--rt-ex-nav); margin: 0 auto; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; box-sizing: border-box; }

.rt-ex-btn {
    height: 40px; min-width: 110px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: inherit; font-size: 14px; font-weight: 700;
    text-decoration: none; border: none; border-radius: 10px; cursor: pointer; transition: var(--rt-ease, all .25s ease); box-sizing: border-box;
}
.rt-ex-btn[hidden] { display: none; }
.rt-ex-btn-ghost { color: var(--rt-text-main); background: var(--bg); border: 1px solid var(--rt-border); }
.rt-ex-btn-ghost:hover { color: var(--rt-accent); border-color: var(--rt-accent); }
.rt-ex-btn-main { margin-inline-start: auto; color: #fff; background: var(--rt-accent); }
.rt-ex-btn-main:hover { filter: brightness(1.08); box-shadow: 0 6px 16px rgba(22, 163, 74, .28); }

.rt-ex-ctx { display: none; }

.rt-res { position: fixed; inset: 0; z-index: 10000; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(8, 18, 28, .88); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.rt-res:not([hidden]) { display: flex; animation: rtExIn .35s ease; }

.rt-res-card {
    display: flex; flex-direction: column; width: 100%; max-width: 500px; height: 80vh; height: 80dvh; overflow: hidden; color: var(--rt-text-main);
    background: var(--rt-card-bg); border: 1px solid var(--rt-border); border-radius: 28px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}

.rt-res-hero {
    position: relative; flex-shrink: 0; padding: 22px 24px 22px; text-align: center; color: #fff; overflow: hidden;
    background: linear-gradient(135deg, #16A34A 0%, #15803D 55%, #166534 100%);
}
.rt-res.is-fail .rt-res-hero { background: linear-gradient(135deg, #EF4444 0%, #DC2626 55%, #991B1B 100%); }
.rt-res-hero::before, .rt-res-hero::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .08); pointer-events: none; }
.rt-res-hero::before { width: 220px; height: 220px; top: -110px; inset-inline-end: -70px; }
.rt-res-hero::after { width: 160px; height: 160px; bottom: -90px; inset-inline-start: -50px; }
.rt-res-hero > * { position: relative; z-index: 1; }

.rt-res-mark {
    position: absolute; z-index: 0; inset-inline-end: 18px; bottom: 0; width: 150px; height: 90px; pointer-events: none;
    background: rgba(255, 255, 255, .13);
    -webkit-mask: url('/assets/images/brand/watermark.svg') no-repeat right bottom / contain; mask: url('/assets/images/brand/watermark.svg') no-repeat right bottom / contain;
}
.rt-res-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; text-align: start; }
.rt-res-avatar { flex-shrink: 0; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800; color: #15803D; background: #fff; border-radius: 50%; }
.rt-res.is-fail .rt-res-avatar { color: #B91C1C; }
.rt-res-who { flex: 1; min-width: 0; }
.rt-res-who h2 { margin: 0; font-size: 16.5px; font-weight: 800; line-height: 1.3; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-res-who small { display: block; font-size: 12px; color: rgba(255, 255, 255, .82); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-res-pill { flex-shrink: 0; padding: 5px 13px; font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: #fff; background: rgba(255, 255, 255, .2); border: 1px solid rgba(255, 255, 255, .35); border-radius: 20px; }

.rt-res-score { position: relative; width: 118px; height: 118px; margin: 0 auto 12px; }
.rt-res-score svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.rt-res-score circle { fill: none; stroke-width: 9; }
.rt-res-ring-bg { stroke: rgba(255, 255, 255, .22); }
.rt-res-ring { stroke: #fff; stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset 1s cubic-bezier(.3, 0, .2, 1); }
.rt-res-score-in { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.rt-res-score-in strong { font-size: 28px; font-weight: 800; line-height: 1.1; color: #fff; }
.rt-res-score-in span { font-size: 12.5px; font-weight: 600; color: rgba(255, 255, 255, .85); }

.rt-res-line { display: none; }
.rt-res-line-track { position: relative; height: 12px; background: rgba(255, 255, 255, .25); border-radius: 12px; }
.rt-res-line-fill { position: absolute; inset-block: 0; inset-inline-start: 0; width: 0; background: #fff; border-radius: 12px; transition: width 1s cubic-bezier(.3, 0, .2, 1); }
.rt-res-line-pass { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-inline-start: -1.5px; background: rgba(255, 255, 255, .95); border-radius: 3px; box-shadow: 0 0 0 2px rgba(0, 0, 0, .18); }
.rt-res-line-cap { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11.5px; font-weight: 600; color: rgba(255, 255, 255, .85); }
.rt-res-msg { margin: 0 0 4px; font-size: 20px; font-weight: 800; line-height: 1.35; color: #fff; }
.rt-res-sub { margin: 0 auto; max-width: 340px; font-size: 13px; line-height: 1.6; color: rgba(255, 255, 255, .9); }

.rt-res-body { flex: 1; min-height: 0; padding: 18px 22px 8px; overflow-y: auto; }
.rt-res-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.rt-res-stats div { padding: 12px 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; background: var(--bg); border: 1px solid var(--rt-border); border-radius: 14px; }
.rt-res-stats i { font-size: 14px; color: var(--rt-accent); }
.rt-res-stats div:nth-child(2) i { color: #DC2626; }
.rt-res-stats div:nth-child(3) i { color: #D97706; }
.rt-res-stats div:nth-child(4) i { color: #2563EB; }
.rt-res-stats strong { font-size: 17px; font-weight: 800; color: var(--rt-text-main); }
.rt-res-stats span { font-size: 11px; font-weight: 600; color: var(--rt-text-muted); }

.rt-res-review { margin-bottom: 10px; text-align: start; background: var(--bg); border: 1px solid var(--rt-border); border-radius: 14px; }
.rt-res-review summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; font-size: 13px; font-weight: 700; color: var(--rt-text-main); cursor: pointer; list-style: none; }
.rt-res-review summary::-webkit-details-marker { display: none; }
.rt-res-review summary span { display: inline-flex; align-items: center; gap: 9px; }
.rt-res-review summary span i { color: var(--rt-accent); }
.rt-res-review summary > i { font-size: 10px; color: var(--rt-text-muted); transition: transform .25s; }
.rt-res-review[open] summary > i { transform: rotate(180deg); }
.rt-res-review ol { margin: 0; padding: 0 16px 6px; list-style: none; }
.rt-res-review li { padding: 11px 0; font-size: 12.5px; line-height: 1.55; border-top: 1px solid var(--rt-border); }
.rt-res-review li b { display: block; margin-bottom: 3px; color: var(--rt-text-main); }
.rt-res-review li span { display: block; color: var(--rt-text-muted); }
.rt-res-review li .ok { color: var(--rt-accent); font-weight: 600; }
.rt-res-review li .bad { color: #DC2626; font-weight: 600; }

.rt-res-foot { flex-shrink: 0; padding: 14px 22px 14px; background: var(--rt-card-bg); border-top: 1px solid var(--rt-border); }
.rt-res-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.rt-res-actions .rt-ex-btn { flex: 1 1 calc(50% - 5px); margin: 0; height: 46px; padding: 0 12px; border-radius: 12px; white-space: nowrap; }
.rt-res-actions .rt-ex-btn-main { flex-basis: 100%; }
.rt-res.is-fail #rtResRetry { color: #fff; background: var(--rt-accent); border-color: var(--rt-accent); }
.rt-res-date { margin: 10px 0 0; font-size: 11.5px; text-align: center; color: var(--rt-text-muted); }

@media (min-width: 769px) {
    .rt-res-card { display: grid; grid-template-columns: 5fr 6fr; grid-template-rows: minmax(0, 1fr) auto; max-width: 900px; }
    .rt-res-hero { grid-row: 1 / 3; display: flex; flex-direction: column; padding: 28px 30px; }
    .rt-res-head { margin-bottom: 0; }
    .rt-res-score { width: 150px; height: 150px; margin: auto auto 18px; }
    .rt-res-score-in strong { font-size: 36px; }
    .rt-res-msg { font-size: 23px; }
    .rt-res-sub { margin-bottom: auto; font-size: 13.5px; }
    .rt-res-body { padding: 26px 28px 10px; }
    .rt-res-foot { padding: 16px 28px 18px; }
}

@media (max-width: 768px) {
    body:has(.rt-ex) { overflow: auto; }
    .rt-ex-title { display: none; }
    .rt-ex-bar-in { max-width: 100%; padding: 0 16px; }

    .rt-ex-stage { display: block; min-height: 0; padding: calc(var(--rt-ex-bar) + var(--rt-ex-ctx) + 5px) 16px calc(var(--rt-ex-nav) + 16px); }
    .rt-ex-card { max-height: none; overflow: visible; padding: 0; background: transparent; border: none; border-radius: 0; box-shadow: none; }
    .rt-ex-inline { display: none; }

    .rt-ex-ctx { position: fixed; top: var(--rt-ex-bar); left: 0; z-index: 3000; display: block; width: 100%; padding: 6px 16px 8px; background: var(--rt-card-bg); border-bottom: 1px solid var(--rt-border); box-sizing: border-box; }
    .rt-ex-qno { display: block; margin-bottom: 2px; font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--rt-accent); }
    .rt-ex-ctx-box { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
    .rt-ex-ctx-text { flex: 1; margin: 0; font-size: 14.5px; font-weight: 600; line-height: 1.35; color: var(--rt-text-main); }
    .rt-ex-ctx-img { flex-shrink: 0; width: 55px; height: 55px; padding: 4px; display: flex; align-items: center; justify-content: center; background: var(--bg); border: 1px solid var(--rt-border); border-radius: 10px; box-sizing: border-box; }
    .rt-ex-ctx-img img { max-width: 100%; max-height: 100%; object-fit: contain; }

    .rt-ex-options { gap: 10px; margin-top: 2px; }
    .rt-ex-opt { padding: 14px 16px; }
    .rt-ex-nav-in { max-width: 100%; padding: 0 16px; }
    .rt-ex-btn { min-width: 100px; }

    .rt-res { padding: 14px; }
    .rt-res-card { border-radius: 24px; }
    .rt-res-hero { padding: 18px 16px 18px; }
    .rt-res-mark { width: 100px; height: 60px; inset-inline-end: 12px; bottom: 0; }
    .rt-res-head { margin-bottom: 14px; }
    .rt-res-score { width: 100%; height: auto; margin: 0 0 14px; }
    .rt-res-score svg { display: none; }
    .rt-res-score-in { position: static; flex-direction: row; align-items: baseline; justify-content: center; gap: 10px; margin-bottom: 12px; }
    .rt-res-score-in strong { font-size: 26px; }
    .rt-res-score-in span { font-size: 13px; }
    .rt-res-line { display: block; max-width: 320px; margin: 0 auto; padding-top: 4px; }
    .rt-res-msg { font-size: 18px; }
    .rt-res-sub { font-size: 12.5px; }
    .rt-res-body { padding: 14px 16px 6px; }
    .rt-res-stats { gap: 6px; margin-bottom: 12px; }
    .rt-res-stats div { padding: 10px 2px; }
    .rt-res-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
    .rt-res-actions .rt-ex-btn { height: 44px; font-size: 13.5px; }
}

@media (prefers-reduced-motion: reduce) {
    .rt-ex-card.active, .rt-res:not([hidden]), .rt-res-ring, .rt-ex-timer.is-low { animation: none; transition: none; }
}