* { box-sizing: border-box; margin: 0; padding: 0; }
body { min-height: 100vh; background: #c7e8ed url('assets/images/background_ocean.jpg') center / cover fixed; }
button, input { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
.hidden { display: none !important; }
.game-container { text-align: center; }
.gold-coin-img { width: 28px; height: 32px; object-fit: contain; }
/* Primera revisión: entrada y configuración de la aventura */
body { font-family: 'Segoe UI', sans-serif; color: #173b46; padding: 20px 20px 32px; background-color: #c7e8ed; }
.app-header { width: min(1080px, 100%); display: flex; align-items: center; gap: 24px; margin: 0 auto 20px; }
#gameLogo { position: static; width: 88px; flex-shrink: 0; }
.app-subject { font-weight: 700; flex: 1; }
.sound-toggle { background: #fffaf0; color: #173b46; border: 2px solid #245967; border-radius: 14px; padding: 12px 16px; min-height: 46px; font: inherit; font-weight: 700; cursor: pointer; }
.game-wrapper { width: 100%; max-width: 1080px; }
.game-container { background: #fff9eb; border: 3px solid #335d61; padding: 32px; border-radius: 28px; animation: none; box-shadow: 0 12px 35px #173b4630; }
.welcome-hero { display: flex; align-items: center; text-align: left; gap: 32px; padding: 0 24px 24px; }
.welcome-copy { flex: 1; }
.eyebrow { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.14em; font-weight: 800; color: #94611d; margin-bottom: 10px; }
#welcomeTitle { font-size: clamp(2.7rem, 6vw, 4.8rem); line-height: 1.04; letter-spacing: -0.045em; color: #153f4c; margin-bottom: 20px; }
#welcomeTitle span { color: #ad452c; }
.welcome-description { font-size: 1.12rem; line-height: 1.65; max-width: 610px; }
.welcome-captain { width: 175px; height: 245px; object-fit: contain; }
.journey-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.journey-tags span { background: #e1eeea; padding: 7px 12px; border-radius: 30px; font-size: .85rem; font-weight: 700; }
.setup-grid { display: grid; grid-template-columns: 1.12fr 1fr; gap: 22px; text-align: left; }
.setup-card { background: white; border: 2px solid #d5dfd8; border-radius: 20px; padding: 24px; }
.setup-card h2 { font-size: 1.25rem; margin-bottom: 18px; }
.difficulty-selector { display: grid; gap: 10px; margin: 0; }
.difficulty-btn { display: block; width: 100%; margin: 0; padding: 14px 16px; text-align: left; background: #f4f8f7; color: #173b46; border: 2px solid #c5d6d3; border-radius: 14px; font-family: inherit; transition: background .15s; }
.difficulty-btn span { display: block; font-size: 1rem; margin-bottom: 5px; }
.difficulty-btn small { display: block; font-weight: 400; font-size: .88rem; line-height: 1.5; }
.difficulty-btn:hover, .difficulty-btn.active { transform: none; background: #e3f2ed; border-color: #216457; }
.difficulty-btn.active { box-shadow: inset 5px 0 #216457; }
.extras-title { font-size: 1rem; margin: 22px 0 8px; }
.setting-hint { color: #52696b; font-size: .85rem; line-height: 1.5; }
.settings-container { display: grid; gap: 12px; background: none; border: 0; margin: 14px 0 0; padding: 0; color: #173b46; text-shadow: none; font-size: .95rem; }
.setting-item { min-height: 44px; cursor: pointer; }
.setting-item small { display: block; font-size: .8rem; color: #52696b; margin-top: 4px; }
#exponentsToggle, #negativeNumbersToggle { width: 22px; height: 22px; accent-color: #216457; }
.operation-order { list-style: none; counter-reset: order; display: grid; gap: 20px; }
.operation-order li { counter-increment: order; position: relative; padding-left: 45px; }
.operation-order li::before { content: counter(order); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: #e3f2ed; display: grid; place-items: center; font-weight: 800; }
.operation-order strong { display: block; font-size: .98rem; margin-bottom: 5px; }
.operation-order span { font-size: .9rem; line-height: 1.5; color: #52696b; }
.worked-example { background: #fff3ce; border: 1px solid #e4cb8c; border-radius: 14px; padding: 18px; margin-top: 24px; font-size: .9rem; line-height: 1.6; }
.worked-example p { font-size: 1.5rem; font-weight: 800; color: #924321; margin: 8px 0; }
.departure { margin-top: 24px; }
.departure .start-btn { margin: 0 0 12px; min-width: 230px; background: #b84c2d; border: 2px solid #8b381f; border-radius: 16px; color: white; font: 800 1.25rem 'Segoe UI', sans-serif; text-shadow: none; box-shadow: 0 4px 0 #8b381f; }
.departure .start-btn:hover { background: #a33d24; transform: translateY(-1px); }
.departure p, .app-footer { font-size: .85rem; line-height: 1.5; }
.app-footer { text-align: center; margin-top: 20px; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #086eaf; outline-offset: 4px; }
@media (max-width: 700px) {
 body { padding: 12px 12px 24px; }
 .app-header { gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
 #gameLogo { width: 66px; }
 .app-subject { font-size: .8rem; }
 .sound-toggle { font-size: .8rem; padding: 8px 10px; }
 .game-container { padding: 20px 14px; border-radius: 22px; }
 .welcome-hero { gap: 8px; padding: 0 4px 24px; }
 .welcome-captain { width: 100px; height: 180px; }
 .welcome-description { font-size: .95rem; line-height: 1.55; }
 .setup-grid { grid-template-columns: 1fr; gap: 16px; }
 .setup-card { padding: 18px; }
 .journey-tags span { font-size: .75rem; }
 .question-container { padding: 38px 12px 20px; }
 .expression { font-size: 1.45rem; padding: 12px 6px; overflow-wrap: anywhere; }
 .question { font-size: 1.3rem; }
 .options { gap: 10px; }
 .option { padding: 14px 8px; }
 .title { font-size: 2rem; }
}
@media (max-width: 400px) {
 .welcome-captain { width: 72px; height: 145px; }
 #welcomeTitle { font-size: 2.55rem; }
 .app-subject { max-width: 145px; }
 .sound-toggle { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) {
 *, *::before, *::after { animation: none !important; transition: none !important; }
}
/* Partie, aides et bilan */
.audio-controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.sound-toggle { font-size: .85rem; }
.game-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; text-align: left; }
.game-heading h1, #endTitle { font-size: clamp(1.6rem, 4vw, 2.3rem); color: #153f4c; }
.game-heading .eyebrow { margin-bottom: 5px; }
.secondary-btn, .text-btn { min-height: 46px; border: 2px solid #97b8b2; border-radius: 12px; padding: 10px 16px; color: #174c45; background: #eff6f3; font-weight: 700; line-height: 1.4; }
.secondary-btn:hover { background: #deede7; }
.text-btn { background: transparent; border-color: transparent; text-decoration: underline; text-underline-offset: 4px; }
.text-btn:hover { background: #f7edda; }
.score-board { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 22px 0 14px; font-weight: 700; }
.score-display { display: flex; align-items: center; gap: 8px; }
#difficulty { background: #e3f2ed; padding: 7px 14px; border-radius: 30px; font-size: .9rem; }
.progress-bar { height: 12px; border-radius: 12px; background: #d9e4df; overflow: hidden; }
.progress-fill { height: 100%; background: #227363; transition: width .25s ease; }
.question-container { position: relative; max-width: 760px; margin: 26px auto 0; padding: 28px; border: 2px solid #dccba8; border-radius: 20px; background: linear-gradient(#fffaf1ed,#fffaf1ed), url('assets/images/scroll_question.png') center / cover; }
.question { font-size: 1.1rem; font-weight: 600; }
.expression { font-size: clamp(1.5rem,4vw,2.4rem); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.6; padding: 18px 8px; margin: 12px 0 20px; color: #843c25; overflow-wrap: anywhere; }
.options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.option { min-height: 68px; padding: 14px 12px; border: 2px solid #316a77; border-radius: 14px; font-weight: 800; font-size: 1.5rem; background: #edf6f6; color: #174954; box-shadow: 0 3px 0 #bdd1d3; }
.option:hover:not(:disabled) { background: #d6ebeb; border-color: #184d58; }
.option.correct { background: #d6efdf; border-color: #2a754a; color: #185232; box-shadow: none; }
.option.correct::after { content: ' ✓'; }
.option.incorrect { background: #fae9e1; border-color: #ba6e4d; color: #833f24; box-shadow: none; }
.option.incorrect::after { content: ' ↻'; }
.help-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.help-actions button:disabled { opacity: .5; }
.hint-text { margin-top: 18px; padding: 16px; background: #fff0ba; border: 1px solid #d8b85c; border-radius: 12px; text-align: left; line-height: 1.65; }
.feedback { margin-top: 20px; line-height: 1.6; font-size: 1rem; border-radius: 12px; text-align: left; }
.feedback:empty { display: none; }
.feedback.correct { background: #e1f2e6; color: #215336; padding: 16px; }
.feedback.retry { background: #fff0d9; color: #754223; padding: 16px; }
.feedback.reviewed { background: #e6eff5; color: #24516c; padding: 16px; }
.solution-panel { margin-top: 20px; text-align: left; border-top: 1px solid #d9cbaa; padding-top: 20px; }
.solution-panel h2 { font-size: 1.1rem; margin-bottom: 16px; }
.solution-panel ol, .review-section ol { padding-left: 26px; }
.solution-panel li, .review-section li { padding-left: 5px; margin: 12px 0; }
.solution-panel strong, .review-section li strong { display: block; font-size: 1.1rem; line-height: 1.6; }
.solution-panel li span, .review-section li span { display: block; font-size: .85rem; line-height: 1.6; color: #52696b; }
.start-btn, .next-btn { min-height: 50px; background: #b84c2d; border: 2px solid #8b381f; border-radius: 14px; padding: 13px 24px; color: #fff; font-weight: 800; box-shadow: 0 3px 0 #8b381f; }
.start-btn:hover, .next-btn:hover { background: #9f3d24; }
.next-btn { margin-top: 24px; }
.treasure-chest-img { display: block; width: 160px; height: 180px; object-fit: contain; margin: 12px auto; }
.final-score { font-size: clamp(1.3rem,4vw,1.9rem); font-weight: 600; margin: 12px 0; }
#finalMessage { line-height: 1.7; max-width: 620px; margin: auto; }
.result-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; max-width: 760px; margin: 24px auto; }
.result-grid div { border: 1px solid #c7d8d0; background: #edf5ef; border-radius: 16px; padding: 16px 12px; }
.result-grid strong { display: block; font-size: 2rem; }
.result-grid span { display: block; font-size: .85rem; line-height: 1.5; margin-top: 4px; }
.end-buttons-container { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin: 24px 0; }
.review-section { text-align: left; margin: 32px auto 0; max-width: 760px; }
.review-section h2 { font-size: 1.3rem; margin-bottom: 10px; }
.review-section > p { font-size: .95rem; margin-bottom: 16px; }
.review-section details { border: 1px solid #c7d8d0; border-radius: 12px; background: #fff; margin-top: 10px; padding: 14px; }
.review-section summary { cursor: pointer; font-weight: 600; font-size: .95rem; line-height: 1.7; overflow-wrap: anywhere; }
dialog { border: 2px solid #335d61; border-radius: 20px; padding: 28px; width: min(500px,calc(100% - 32px)); margin: auto; color: #173b46; background: #fff9eb; box-shadow: 0 12px 50px #102f4955; }
dialog::backdrop { background: #102f4977; }
dialog h2 { font-size: 1.5rem; margin-bottom: 14px; }
dialog p { line-height: 1.6; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 24px; }
.setting-item:has(input:disabled) { opacity: .65; cursor: default; }
:focus-visible { outline: 3px solid #086eaf; outline-offset: 4px; }
h1:focus { outline: none; }
@media (max-width: 700px) {
 .audio-controls { margin-left: auto; }
 .app-subject { display: none; }
 .game-heading { align-items: flex-start; }
 .game-heading .secondary-btn { font-size: .8rem; padding: 8px 10px; }
 .question-container { padding: 20px 14px; margin-top: 20px; }
 .result-grid { gap: 8px; }
 .result-grid div { padding: 12px 8px; }
 .result-grid span { font-size: .75rem; }
}
@media (max-width: 400px) {
 .sound-toggle { font-size: .75rem; padding: 7px 8px; }
 .audio-controls { gap: 5px; }
 .game-heading { gap: 8px; }
 .result-grid { grid-template-columns: 1fr; }
 .result-grid div { display: flex; align-items: center; gap: 12px; text-align: left; }
 .result-grid strong { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) { .progress-fill { transition: none; } }
/* Expresiones completas: pista y cadena de equivalencias. */
.solution-panel .solution-chain, .review-section .solution-chain { list-style: none; padding: 0; }
.solution-chain li { padding: 0; margin: 16px 0; }
.chain-line { display: grid; grid-template-columns: 22px minmax(0,1fr); gap: 8px; align-items: baseline; }
.chain-expression, .chain-equals { font-weight: 750; font-size: clamp(1.1rem,3.5vw,1.45rem); line-height: 1.9; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.chain-expression mark { color: #743415; background: #ffe5a0; padding: 3px 0; border-bottom: 3px solid #a8581f; border-radius: 3px; }
.chain-explanation { margin: 4px 0 0 30px; color: #52696b; font-size: .85rem; line-height: 1.6; }
.chain-final { color: #215336; border-top: 1px solid #c7d8d0; padding-top: 10px !important; }
.hint-expression { display: block; margin-top: 12px; }
.solution-chain .chain-expression > span { display: inline; font-size: inherit; line-height: inherit; color: inherit; }

.welcome-chain { margin: 12px 0; }
.worked-example .example-guidance { font-size: .88rem; font-weight: 400; color: #52696b; line-height: 1.6; margin: 12px 0 0; }
/* Portada compacta */
.game-wrapper { margin-inline: auto; }
#startScreen { max-width: 900px; margin-inline: auto; }
#startScreen .welcome-hero { position: relative; padding: 22px 30px; gap: 24px; border-radius: 22px; background: linear-gradient(115deg,#dfeee8,#eaf4ef 65%,#c9e7e7); margin-bottom: 24px; overflow: hidden; }
#startScreen .welcome-hero::after { content: ''; position: absolute; width: 250px; height: 250px; border: 1px solid #83b6ae55; border-radius: 50%; right: -50px; top: -40px; pointer-events: none; }
#startScreen .welcome-copy { position: relative; z-index: 1; min-width: 0; }
#startScreen #welcomeTitle { font-size: clamp(2.5rem,5vw,3.7rem); margin-bottom: 12px; }
#startScreen .eyebrow { font-size: .75rem; margin-bottom: 8px; }
#startScreen .welcome-description { font-size: 1rem; line-height: 1.5; max-width: 450px; }
#startScreen .welcome-captain { position: relative; z-index: 1; width: 120px; height: 165px; flex-shrink: 0; }
#startScreen .journey-tags { margin-top: 14px; gap: 6px; }
#startScreen .journey-tags span { font-size: .75rem; background: #ffffff9c; padding: 5px 10px; }
#startScreen .setup-grid { display: block; }
#startScreen .setup-card { padding: 0; border: 0; background: transparent; }
#startScreen .setup-card h2 { font-size: 1.1rem; margin-bottom: 12px; }
#startScreen .difficulty-selector { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
#startScreen .difficulty-btn { position: relative; min-height: 132px; padding: 15px 16px 13px; background: #fff; border: 2px solid #d4dfda; text-align: left; border-radius: 16px; }
#startScreen .difficulty-btn:hover { background: #f0f7f3; }
#startScreen .difficulty-btn.active { background: #eaf5ef; border-color: #246856; box-shadow: 0 0 0 1px #246856; }
#startScreen .difficulty-btn.active::after { content: '✓'; position: absolute; right: 12px; top: 12px; width: 22px; height: 22px; background: #246856; color: #fff; border-radius: 50%; text-align: center; font-size: .85rem; line-height: 22px; }
#startScreen .difficulty-btn .adventure-icon { font-size: 1.5rem; margin-bottom: 6px; }
#startScreen .difficulty-btn .adventure-name { font-size: .98rem; margin-bottom: 3px; }
#startScreen .difficulty-btn small { font-size: .8rem; }
#startScreen .difficulty-btn .adventure-level { font-size: .67rem; text-transform: uppercase; letter-spacing: .07em; margin: 10px 0 0; color: #4f6f64; }
#startScreen .extras-title { margin: 22px 0 6px; display: flex; align-items: center; gap: 10px; font-size: .95rem; }
.optional-label { font-size: .7rem; font-weight: 400; padding: 3px 8px; background: #eaece7; color: #52665c; border-radius: 20px; }
#startScreen .setting-hint { font-size: .78rem; }
#startScreen .settings-container { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 10px; }
#startScreen .setting-item { position: relative; display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 74px; padding: 12px 14px; border: 1px solid #d1dcd5; border-radius: 14px; background: #fff; transition: border-color .15s,background .15s; }
#startScreen .setting-item input { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; }
#startScreen .setting-item:has(input:focus-visible) { outline: 3px solid #086eaf; outline-offset: 4px; }
#startScreen .setting-item:has(input:checked:not(:disabled)) { background: #eaf5ef; border-color: #246856; }
#startScreen .setting-item:has(input:disabled) { opacity: .6; background: #eeeee8; }
.challenge-icon { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; font-size: 1.2rem; font-weight: 800; color: #95602f; background: #fff0d3; border-radius: 10px; }
.challenge-copy { flex: 1; min-width: 0; font-size: .88rem; font-weight: 700; }
#startScreen .challenge-copy small { font-size: .74rem; font-weight: 400; margin-top: 3px; }
.toggle-track { position: relative; width: 40px; height: 24px; flex-shrink: 0; background: #80958b; border-radius: 20px; }
.toggle-track::before { content: ''; position: absolute; width: 18px; height: 18px; top: 3px; left: 3px; background: #fff; border-radius: 50%; transition: transform .15s; }
.setting-item input:checked:not(:disabled) ~ .toggle-track { background: #246856; }
.setting-item input:checked:not(:disabled) ~ .toggle-track::before { transform: translateX(16px); }
#startScreen .departure { margin-top: 24px; }
#startScreen .departure .start-btn { width: min(100%,340px); min-height: 54px; margin-bottom: 10px; }
#startScreen .departure p { font-size: .78rem; color: #52696b; }
.order-disclosure { margin: 18px auto 0; text-align: left; }
.order-disclosure > summary { list-style: none; display: flex; align-items: center; justify-content: center; gap: 8px; width: fit-content; min-height: 44px; margin: auto; padding: 8px 14px; font-size: .85rem; font-weight: 650; cursor: pointer; color: #365c55; border-radius: 10px; }
.order-disclosure > summary::-webkit-details-marker { display: none; }
.order-disclosure > summary:hover { background: #eaf0e9; }
.disclosure-arrow { transition: transform .15s; }
.order-disclosure[open] .disclosure-arrow { transform: rotate(180deg); }
.order-disclosure-content { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; margin-top: 12px; padding: 22px; background: #fff; border: 1px solid #d4dfda; border-radius: 16px; }
.order-disclosure .operation-order { gap: 16px; }
.order-disclosure .worked-example { margin: 0; align-self: start; }
@media (max-width: 700px) {
 #startScreen .welcome-hero { padding: 18px; gap: 12px; margin-bottom: 20px; }
 #startScreen .welcome-captain { width: 90px; height: 140px; }
 #startScreen .welcome-description { font-size: .9rem; }
 #startScreen .difficulty-selector { gap: 8px; }
 #startScreen .difficulty-btn { padding: 12px 10px; }
 #startScreen .difficulty-btn .adventure-name { font-size: .85rem; }
 #startScreen .difficulty-btn small { font-size: .72rem; }
 #startScreen .difficulty-btn.active::after { right: 7px; top: 9px; width: 18px; height: 18px; line-height: 18px; font-size: .7rem; }
 #startScreen .settings-container { gap: 8px; }
 #startScreen .setting-item { gap: 8px; padding: 10px; }
 .challenge-icon { width: 28px; height: 32px; font-size: 1rem; }
 .challenge-copy { font-size: .8rem; }
 .order-disclosure-content { grid-template-columns: 1fr; padding: 18px; }
}
@media (max-width: 480px) {
 #startScreen .welcome-hero { padding: 16px 14px; }
 #startScreen .welcome-captain { width: 68px; height: 112px; }
 #startScreen #welcomeTitle { font-size: 2.35rem; }
 #startScreen .welcome-description { font-size: .83rem; }
 #startScreen .journey-tags { margin-top: 10px; }
 #startScreen .journey-tags span { font-size: .65rem; padding: 4px 7px; }
 #startScreen .difficulty-selector { grid-template-columns: 1fr; gap: 8px; }
 #startScreen .difficulty-btn { display: grid; grid-template-columns: 34px 1fr auto; column-gap: 10px; min-height: 62px; padding: 10px 34px 10px 12px; align-items: center; }
 #startScreen .difficulty-btn .adventure-icon { grid-row: 1 / 3; margin: 0; font-size: 1.4rem; }
 #startScreen .difficulty-btn .adventure-name { grid-column: 2; margin: 0; font-size: .9rem; }
 #startScreen .difficulty-btn small { grid-column: 2; }
 #startScreen .difficulty-btn .adventure-level { grid-column: 3; grid-row: 1 / 3; margin: 0; font-size: .6rem; }
 #startScreen .difficulty-btn.active::after { top: 20px; }
 #startScreen .settings-container { grid-template-columns: 1fr; }
 #startScreen .setting-item { min-height: 60px; padding: 10px 14px; }
 #startScreen .extras-title { margin-top: 18px; }
}
/* Tripulación de robots piratas: adornos fuera del área de cálculo. */
#startScreen .difficulty-btn { overflow: hidden; padding-top: 96px; }
#startScreen .difficulty-btn .adventure-art { position: absolute; inset: 0 0 auto; display: block; width: 100%; height: 80px; object-fit: cover; object-position: 65% 42%; border-bottom: 1px solid #d4dfda; }
#startScreen .difficulty-btn .adventure-icon { display: none; }
#startScreen .difficulty-btn.active::after { z-index: 1; box-shadow: 0 0 0 3px white; }
#startScreen .welcome-captain { width: 128px; height: 172px; }
.voyage-banner { position: relative; height: 106px; margin: 20px 0 0; border-radius: 16px; overflow: hidden; background: #d8ecea; }
.voyage-banner img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 62% 35%; }
.voyage-banner::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg,#103e50d9,transparent 65%); }
.voyage-banner > span { position: absolute; z-index: 1; left: 22px; top: 50%; transform: translateY(-50%); color: white; font-weight: 750; font-size: 1.1rem; text-shadow: 0 1px 3px #123e4a; }
.hint-text::before { content: ''; float: left; width: 44px; height: 58px; margin: 0 12px 5px 0; background: url('assets/images/robots-piratas/kali-capitana.png') center / contain no-repeat; }
.hint-expression { clear: both; }
.treasure-chest-img.robot-treasure { width: min(100%,340px); height: auto; max-height: 220px; object-fit: contain; }
@media (max-width:700px) {
 #startScreen .welcome-captain { width: 95px; height: 140px; }
 #startScreen .difficulty-btn { padding-top: 90px; }
 #startScreen .difficulty-btn .adventure-art { height: 76px; }
 .voyage-banner { height: 88px; }
}
@media (max-width:480px) {
 #startScreen .welcome-captain { width: 72px; height: 116px; }
 #startScreen .difficulty-btn { grid-template-columns: 1fr auto; min-height: 72px; padding: 11px 34px 11px 94px; }
 #startScreen .difficulty-btn .adventure-art { width: 80px; height: 100%; inset: 0 auto 0 0; border-bottom: 0; border-right: 1px solid #d4dfda; object-position: 70% center; }
 #startScreen .difficulty-btn .adventure-name, #startScreen .difficulty-btn small { grid-column: 1; }
 #startScreen .difficulty-btn .adventure-level { grid-column: 2; }
 #startScreen .difficulty-btn.active::after { top: 26px; }
 .voyage-banner { height: 76px; }
 .voyage-banner > span { font-size: .9rem; left: 14px; }
}
@media (max-width:360px) { #startScreen .difficulty-btn .adventure-level { display: none; } }
.auto-advance-setting { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 20px auto 0; font-size: .85rem; cursor: pointer; }
.auto-advance-setting input { width: 22px; height: 22px; accent-color: #246856; }
.auto-advance-setting small { flex-basis: 100%; color: #52696b; font-size: .76rem; line-height: 1.5; }
.success-actions { margin-top: 12px; }
#autoAdvanceNotice { display: block; margin-top: 8px; font-size: .8rem; color: #52696b; line-height: 1.6; }
#startScreen .welcome-captain.welcome-scene { width: 42%; height: 185px; object-fit: cover; object-position: 65% center; border-radius: 16px; box-shadow: 0 6px 18px #173b4620; }
.farewell-robot { float: right; width: 80px; height: 108px; object-fit: contain; margin: 0 0 12px 16px; }
.dialog-actions { clear: both; }
@media (max-width:700px) { #startScreen .welcome-captain.welcome-scene { width: 40%; height: 150px; } }
@media (max-width:480px) {
 #startScreen .welcome-hero { flex-direction: column-reverse; align-items: stretch; gap: 16px; }
 #startScreen .welcome-captain.welcome-scene { width: 100%; height: 140px; object-position: 60% 48%; }
 #startScreen .welcome-copy { text-align: left; }
 .farewell-robot { width: 64px; height: 88px; margin-left: 10px; }
}
/* Travesía y tesoro */
.treasure-dock { display: flex; align-items: center; gap: 14px; position: relative; }
.mini-chest { position: relative; width: 66px; height: 56px; flex-shrink: 0; margin-top: 5px; }
.chest-lid { position: absolute; z-index: 2; top: 0; width: 100%; height: 22px; border: 3px solid #865025; border-radius: 24px 24px 4px 4px; background: linear-gradient(90deg,#edbc55 12%,#9f5826 12%,#c37b39 80%,#edbc55 80%); transform-origin: center bottom; }
.chest-box { position: absolute; bottom: 0; width: 100%; height: 36px; overflow: hidden; border: 3px solid #865025; border-radius: 4px 4px 8px 8px; background: linear-gradient(90deg,#edbc55 12%,#804820 12%,#a25c2a 80%,#edbc55 80%); }
.chest-lock { position: absolute; top: 12px; left: 44%; width: 9px; height: 12px; background: #ffe08a; border: 1px solid #9e7024; border-radius: 2px; }
.chest-coins { position: absolute; inset: 0; }
.chest-coin { position: absolute; width: 10px; height: 10px; border: 1px solid #a77419; border-radius: 50%; background: #ffdb66; box-shadow: inset 1px 1px #fff3b2; }
.reward-coin { position: absolute; right: 8px; top: -10px; z-index: 4; width: 34px; height: 40px; object-fit: contain; pointer-events: none; animation: coin-to-chest .85s ease-in both; }
.coin-arrived { animation: chest-bounce .4s .7s ease-out; }
@keyframes coin-to-chest { 0% { opacity: 1; transform: translate(-160px,45px) scale(.8) rotate(-25deg); } 55% { opacity:1; transform: translate(-50px,-45px) scale(1.15) rotate(15deg); } 100% { opacity:0; transform: translate(0,20px) scale(.2); } }
@keyframes chest-bounce { 50% { transform: translateY(-5px) scale(1.08); } }
.route-heading { display: flex; justify-content: space-between; gap: 12px; font-size: .78rem; font-weight: 650; color: #52696b; margin: 14px 0 6px; }
.voyage-map { position: relative; height: 100px; border: 1px solid #c1dcd7; border-radius: 18px; background: radial-gradient(ellipse at 15% 70%,#ffffff80 0 10%,transparent 11%),linear-gradient(150deg,#e6f4ee,#c5e6e9); padding: 0 36px; overflow: hidden; }
.route-track { position: relative; top: 60px; height: 3px; margin-right: 4px; background: repeating-linear-gradient(90deg,#81b6b3 0 5px,transparent 5px 10px); }
.route-fill { height: 3px; background: #277566; transition: width .6s ease; }
.route-stops { position: absolute; inset: -10px 0 auto; display: grid; grid-template-columns: repeat(10,1fr);  }
.route-stop { justify-self: end; display: grid; place-items: center; width: 20px; height: 20px; font-size: .65rem; border: 1px solid #7baea6; border-radius: 50%; color: #335f59; background: #f7fcf8; }
.route-stop.visited { color: white; background: #277566; border-color: #277566; }
.route-ship { position: absolute; bottom: 13px; width: 42px; height: 48px; object-fit: contain; transform: translateX(-50%); transition: left .6s ease; filter: drop-shadow(0 3px 2px #326f7525); }
.route-island { position: absolute; right: -28px; top: -51px; font-size: 26px; }
.crew-message { display: flex; align-items: center; gap: 12px; min-height: 66px; max-width: 760px; margin: 12px auto 0; padding: 8px 14px; text-align: left; border: 1px solid #d6e4d8; border-radius: 14px; background: #f1f6ea; }
.crew-message img { width: 44px; height: 48px; object-fit: contain; border-radius: 8px; flex-shrink: 0; }
.crew-message p { font-size: .85rem; line-height: 1.5; }
.final-chest-wrap { height: 100px; display: grid; place-items: center; margin: 18px 0; }
.final-chest { width: 116px; height: 82px; }
.final-chest .chest-box { height: 54px; }
.final-chest .chest-lid { height: 38px; animation: open-treasure .85s .2s ease-out both; }
.final-chest .chest-coin { width: 17px; height: 17px; }
.final-chest .chest-lock { width: 14px; height: 17px; top: 25px; }
.treasure-sparkles { position: absolute; top: -18px; left: -14px; width: 145px; color: #a36d05; font-size: 26px; letter-spacing: 8px; animation: treasure-reveal .8s .5s both; }
@keyframes open-treasure { from { transform: translateY(14px) rotateX(0); } to { transform: translateY(-20px) rotateX(-35deg); } }
@keyframes treasure-reveal { from { opacity:0; transform: scale(.7); } to { opacity:1; transform: scale(1); } }
@media(max-width:480px) { .treasure-dock { gap: 8px; } .voyage-map { padding-inline: 25px; } .route-stop { width:16px; height:16px; font-size:.6rem; } .route-stops { top:-7px; } .route-island { right:-20px; font-size:22px; } .crew-message p { font-size:.79rem; } #difficulty { font-size:.72rem; padding:6px 10px; } }
@media(prefers-reduced-motion:reduce) { .reward-coin { display:none; } .route-fill,.route-ship { transition:none; } .final-chest .chest-lid { transform: translateY(-20px); } }
/* Avisos de la tripulación y resultado compacto. */
.crew-message { position: fixed; z-index: 150; left: 50%; top: 26%; transform: translateX(-50%); width: min(460px,calc(100vw - 32px)); min-height: 140px; padding: 22px 36px 22px 20px; gap: 18px; background: #fff8e8; border: 3px solid #287367; box-shadow: 0 18px 70px #173b4655; border-radius: 24px; margin: 0; animation: crew-popup 4s ease both; pointer-events: none; }
.crew-message img { width: 90px; height: 104px; border-radius: 14px; }
.crew-message p { font-size: 1.08rem; font-weight: 650; line-height: 1.6; }
.close-crew { position: absolute; top: 2px; right: 2px; width: 44px; height: 44px; border: 0; background: transparent; font-size: 1.5rem; color: #365c55; pointer-events: auto; }
@keyframes crew-popup { 0% { opacity: 0; translate: 0 12px; visibility: visible; } 8%,88% { opacity: 1; translate: 0 0; visibility: visible; } 100% { opacity: 0; translate: 0 -8px; visibility: hidden; } }
.illustrated-chest { width: 88px; height: 74px; margin: 0; }
.illustrated-chest > img { display: block; width: 100%; height: 100%; object-fit: contain; }
#endScreen { max-width: 760px; margin: auto; }
#endScreen #endTitle { font-size: clamp(1.5rem,4vw,2rem); }
#endScreen .robot-treasure { display: none; }
#endScreen .final-chest-wrap { height: 110px; margin: 8px 0; }
.final-chest-art { width: 150px; height: 110px; object-fit: contain; animation: chest-reveal .7s ease-out; }
@keyframes chest-reveal { from { opacity: .3; transform: translateY(8px) scale(.85); } to { opacity:1; transform: translateY(0) scale(1); } }
#endScreen .final-score { font-size: 1.4rem; margin: 8px 0; }
#endScreen #finalMessage { font-size: .9rem; line-height: 1.5; }
#endScreen .result-grid { margin: 16px auto; gap: 8px; }
#endScreen .result-grid div { padding: 10px; }
#endScreen .result-grid strong { font-size: 1.5rem; }
#endScreen .result-grid span { font-size: .76rem; }
#endScreen .end-buttons-container { margin: 16px 0; gap: 10px; }
#endScreen .review-section { margin-top: 18px; border-top: 1px solid #d2dcd4; padding-top: 12px; }
#endScreen .review-section > summary { min-height: 44px; font-size: .9rem; color: #285e54; cursor: pointer; font-weight: 700; }
#endScreen .review-section > p { margin-top: 10px; }
@media(max-width:480px) { .crew-message { top: 20%; padding: 18px 32px 18px 14px; gap:12px; } .crew-message img { width:64px; height:90px; } .crew-message p { font-size: .95rem; } .illustrated-chest { width:72px; height:64px; } }
@media(max-width:400px) { #endScreen .result-grid { grid-template-columns: 1fr; } #endScreen .result-grid div { padding: 6px 12px; } #endScreen .result-grid strong { font-size: 1.15rem; } }
@media(prefers-reduced-motion:reduce) { .crew-message { animation: crew-popup 4s step-end both !important; } @keyframes crew-popup { 0%,99% { opacity:1; visibility:visible; } 100% { opacity:0; visibility:hidden; } } }
