/* تجربة الاستخدام الثالثة: طبقة تنظيمية تحافظ على الهوية البحرية وتقلل مسارات التحكم الظاهرة. */

.landing-library-entry {
    position: relative;
    width: 100%;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(34, 211, 238, .24);
    background: linear-gradient(110deg, rgba(8, 47, 73, .72), rgba(15, 23, 42, .82));
    color: #fff;
    text-align: right;
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.landing-library-entry:hover { transform: translateY(-2px); border-color: rgba(251, 191, 36, .58); background: linear-gradient(110deg, rgba(14, 71, 93, .82), rgba(15, 23, 42, .9)); }
.landing-library-entry-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: rgba(6, 182, 212, .14); font-size: 24px; }
.landing-library-entry strong, .landing-library-entry small { display: block; }
.landing-library-entry strong { font-size: 15px; }
.landing-library-entry small { margin-top: 3px; color: #94a3b8; font-size: 10px; font-weight: 700; }
.landing-library-entry b { color: #fbbf24; font-size: 11px; white-space: nowrap; }
.landing-library-entry > i { position: absolute; top: -7px; left: -7px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #ef4444; font-size: 10px; font-style: normal; font-weight: 900; line-height: 22px; text-align: center; }

.play-primary-tools { display: flex; align-items: center; gap: 8px; }
.play-home-button,
.play-presenter-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid rgba(103, 232, 249, .3);
    color: #e2e8f0;
    background: rgba(15, 23, 42, .82);
    font-size: 12px;
    font-weight: 900;
}
.play-presenter-button { color: #082f49; background: linear-gradient(135deg, #fbbf24, #f59e0b); border-color: #fde68a; }
.play-home-button:hover { background: rgba(14, 116, 144, .72); color: #fff; }
.play-presenter-button:hover { filter: brightness(1.08); }
.play-save-state { position: relative; display: inline-flex; align-items: center; gap: 5px; min-height: 42px; padding: 0 9px; color: #64748b; }
.play-save-state i { font-style: normal; }
.play-save-state small { max-width: 82px; font-size: 9px; font-weight: 800; line-height: 1.2; }
.play-save-state #shares-badge { position: absolute; top: -5px; right: 0; min-width: 18px; height: 18px; border-radius: 99px; background: #ef4444; color: #fff; font-size: 9px; line-height: 18px; text-align: center; }

.round-launch-gate-card {
    width: min(680px, 92vw);
    padding: 30px;
    border-radius: 28px;
    border: 1px solid rgba(34, 211, 238, .3);
    background: radial-gradient(circle at 95% 0, rgba(6, 182, 212, .14), transparent 35%), #0b1427;
    box-shadow: 0 28px 80px rgba(0, 0, 0, .5);
    text-align: right;
}
.round-launch-gate-icon { float: right; display: grid; place-items: center; width: 68px; height: 68px; margin-left: 18px; border-radius: 22px; background: rgba(8, 145, 178, .16); font-size: 34px; }
.round-launch-gate-copy small { color: #22d3ee; font-weight: 900; }
.round-launch-gate-copy h2 { margin: 4px 0 6px; color: #fff; font-size: 28px; font-weight: 950; }
.round-launch-gate-copy p { color: #94a3b8; font-size: 13px; font-weight: 700; }
.round-launch-gate-stats { clear: both; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding-top: 24px; }
.round-launch-gate-stats > div { display: flex; align-items: baseline; gap: 9px; padding: 15px; border-radius: 16px; border: 1px solid rgba(16, 185, 129, .24); background: rgba(6, 78, 59, .15); }
.round-launch-gate-stats strong { color: #6ee7b7; font-size: 26px; }
.round-launch-gate-stats span { color: #cbd5e1; font-size: 11px; font-weight: 800; }
.round-launch-gate-stats .is-warning { border-color: rgba(251, 191, 36, .25); background: rgba(120, 53, 15, .14); }
.round-launch-gate-stats .is-warning strong { color: #fbbf24; }
.round-launch-gate-note { display: flex; gap: 11px; align-items: center; margin: 15px 0 20px; padding: 13px; border-radius: 14px; background: rgba(30, 41, 59, .7); }
.round-launch-gate-note > span { color: #22d3ee; font-size: 22px; }
.round-launch-gate-note strong, .round-launch-gate-note small { display: block; }
.round-launch-gate-note strong { color: #e2e8f0; font-size: 12px; }
.round-launch-gate-note small { margin-top: 2px; color: #94a3b8; font-size: 10px; font-weight: 700; }
.round-launch-gate-actions { display: grid; grid-template-columns: 1fr 1fr auto; gap: 9px; }
.round-launch-gate-actions button { min-height: 45px; padding: 0 16px; border-radius: 13px; font-size: 12px; font-weight: 900; }
.round-launch-gate-actions .is-primary { color: #fff; background: linear-gradient(135deg, #0891b2, #2563eb); }
.round-launch-gate-actions .is-trial { color: #fef3c7; border: 1px solid rgba(251, 191, 36, .4); background: rgba(146, 64, 14, .25); }
.round-launch-gate-actions .is-cancel { color: #94a3b8; background: rgba(30, 41, 59, .8); }

.setup-optional { border: 1px solid rgba(51, 65, 85, .8); border-radius: 15px; background: rgba(15, 23, 42, .48); }
.setup-optional > summary { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 13px 15px; cursor: pointer; list-style: none; }
.setup-optional > summary::-webkit-details-marker { display: none; }
.setup-optional > summary strong, .setup-optional > summary small { display: block; }
.setup-optional > summary strong { color: #e2e8f0; font-size: 12px; }
.setup-optional > summary small { margin-top: 2px; color: #64748b; font-size: 9px; font-weight: 700; }
.setup-optional > summary b { color: #22d3ee; font-size: 17px; }
.setup-optional[open] > summary b { transform: rotate(45deg); }
.setup-optional > div { padding-inline: 15px; padding-bottom: 15px; }

.treasure-unavailable { position: relative; filter: grayscale(.72) brightness(.54); cursor: pointer !important; }
.treasure-unavailable:hover { filter: grayscale(.35) brightness(.7); }
.treasure-unavailable-label { position: absolute; inset-inline: 5px; bottom: 5px; z-index: 3; padding: 4px 5px; border-radius: 8px; border: 1px solid rgba(251, 191, 36, .45); background: rgba(15, 23, 42, .9); color: #fde68a; font-size: clamp(7px, .62vw, 10px); font-weight: 900; text-align: center; }

/* درج المقدّم: يظهر فوق الساحة من اليمين، وتبقى الساحة مرئية للسياق. */
#controlPanelModal { position: fixed; inset: 0; z-index: 88; align-items: stretch; justify-content: flex-start; padding: 0; background: rgba(2, 6, 23, .42); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
#controlPanelModal .modal-card { position: absolute; top: 0; right: 0; width: min(440px, 38vw); max-width: none; height: 100vh; max-height: none; overflow-y: auto; border-radius: 24px 0 0 24px; transform: translateX(105%); transition: transform .24s ease; }
#controlPanelModal.active .modal-card { transform: translateX(0); }
.presenter-drawer-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 16px; }
.presenter-drawer-links button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 5px; border-radius: 11px; border: 1px solid #334155; color: #cbd5e1; background: #111c31; font-size: 9px; font-weight: 900; }
.presenter-drawer-links button:hover { border-color: rgba(34, 211, 238, .45); color: #fff; }
.presenter-drawer-links span { font-size: 17px; }

/* مكتبة موحدة بدل ثلاث نوافذ ومسارات منفصلة. */
.round-library-modal { position: fixed; inset: 0; z-index: 92; display: grid; place-items: center; padding: 24px; background: rgba(2, 6, 23, .86); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.round-library-modal.hidden { display: none; }
.round-library-shell { display: flex; flex-direction: column; width: min(1220px, 96vw); height: min(850px, 92vh); overflow: hidden; border-radius: 28px; border: 1px solid rgba(34, 211, 238, .27); background: radial-gradient(circle at 92% 0, rgba(6, 182, 212, .11), transparent 28%), #0b1427; box-shadow: 0 30px 100px rgba(0, 0, 0, .55); }
.round-library-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 26px 15px; }
.round-library-title { display: flex; align-items: center; gap: 13px; }
.round-library-title > span { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 16px; background: rgba(6, 182, 212, .13); font-size: 27px; }
.round-library-title small { color: #22d3ee; font-size: 10px; font-weight: 900; }
.round-library-title h2 { margin: 1px 0; color: #fff; font-size: 27px; font-weight: 950; }
.round-library-title p { color: #64748b; font-size: 10px; font-weight: 700; }
.round-library-header > button { width: 42px; height: 42px; border-radius: 13px; color: #94a3b8; background: #162238; font-size: 17px; font-weight: 900; }
.round-library-header > button:hover { color: #fff; background: #26364f; }
.round-library-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 26px 14px; padding: 6px; border-radius: 17px; background: rgba(2, 6, 23, .58); }
.round-library-tabs button { position: relative; display: grid; grid-template-columns: 30px auto; grid-template-rows: auto auto; align-items: center; justify-content: center; column-gap: 9px; min-height: 58px; border-radius: 13px; color: #94a3b8; text-align: right; }
.round-library-tabs button > span { grid-row: 1 / 3; font-size: 20px; }
.round-library-tabs strong { align-self: end; color: #cbd5e1; font-size: 12px; }
.round-library-tabs small { align-self: start; font-size: 9px; font-weight: 700; }
.round-library-tabs button.is-active { color: #67e8f9; background: linear-gradient(135deg, rgba(8, 145, 178, .25), rgba(30, 64, 175, .18)); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .25); }
.round-library-tabs button.is-active strong { color: #fff; }
.round-library-tabs i { position: absolute; top: 5px; left: 7px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: #ef4444; color: #fff; font-size: 9px; font-style: normal; font-weight: 900; line-height: 20px; text-align: center; }
.round-library-panels { flex: 1; min-height: 0; padding: 0 26px 24px; }
.round-library-panel { position: static !important; inset: auto !important; z-index: auto !important; min-height: 0; height: 100%; padding: 0 !important; background: transparent !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; align-items: stretch !important; justify-content: stretch !important; }
.round-library-panel.is-active { display: flex !important; }
.round-library-panel > div { width: 100% !important; max-width: none !important; height: 100% !important; padding: 18px !important; border-radius: 18px !important; border-color: rgba(51, 65, 85, .75) !important; background: rgba(15, 23, 42, .66) !important; box-shadow: none !important; }
.round-library-panel [data-library-legacy-header] { display: none !important; }
.round-card-menu { position: relative; }
.round-card-menu > summary { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; border: 1px solid #334155; color: #cbd5e1; background: #1e293b; cursor: pointer; list-style: none; }
.round-card-menu > summary::-webkit-details-marker { display: none; }
.round-card-menu-popover { position: absolute; bottom: calc(100% + 7px); left: 0; z-index: 20; display: grid; min-width: 170px; padding: 7px; border-radius: 13px; border: 1px solid #334155; background: #0f172a; box-shadow: 0 16px 40px rgba(0, 0, 0, .42); }
.round-card-menu-popover button { justify-content: flex-start !important; width: 100%; padding: 8px 10px !important; border: 0 !important; border-radius: 8px !important; background: transparent !important; }
.round-card-menu-popover button:hover { background: #1e293b !important; }


/* Shared interaction rules: modal geometry must not depend on generated utilities. */
#roundLaunchGate { position:fixed; inset:0; z-index:97; align-items:center; justify-content:center; padding:28px; background:#030b18e8; -webkit-backdrop-filter: blur(8px); backdrop-filter:blur(8px); }
#roundLaunchGate.hidden, .round-library-panel.hidden { display:none !important; }
.round-library-panel:not(.hidden).is-active { display:flex; }
.round-card-menu-popover { position:static; min-width:160px; margin-top:8px; box-shadow:none; }
.round-library-panel > div { overflow:auto; }
.round-library-title p, .round-library-tabs small, .landing-library-entry small { font:12px/1.7 Tahoma,Arial,sans-serif; color:#a5bacd; }
.round-library-title h2 { font-size:30px; }
.round-library-tabs strong { font-size:16px; }
.round-library-tabs button { min-height:68px; }
.round-library-header { padding-left:104px; }
#roundLaunchGate button, #roundLaunchGate p, #roundLaunchGate small { font-family:Tahoma,Arial,sans-serif; }
.round-launch-gate-note small { font-size:13px; line-height:1.8; }
.round-launch-gate-copy p { line-height:1.9; }
.round-launch-gate-actions button { min-height:48px; font-size:14px; }
.round-mode-badges { display:flex; gap:10px; justify-content:center; padding:0 10px 10px; }
#mainScreen > .ship-container { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px 20px; padding:14px 18px; }
#mainScreen > .ship-container > div { grid-column:1; grid-row:1; }
#mainScreen > .ship-container > nav { grid-column:2; grid-row:1; padding-left:80px; }
#mainScreen #scoreboard { grid-column:1 / -1; grid-row:2; width:100%; overflow:visible; gap:12px; }
#scoreboard > div { min-width:0; max-width:none; width:0; height:86px; padding:10px 18px 23px; transform:none; }
#scoreboard > div img { width:42px; height:42px; }
#scoreboard > div span { font-size:22px; }
#scoreboard > div .absolute.bottom-1 span { font-size:10px; }
#mainScreen #activeRoundTitle { font-size:24px; }
.play-home-button, .play-presenter-button { font:700 13px Tahoma,Arial,sans-serif; }
.round-mode-badges > span { display:inline-flex; gap:6px; border:1px solid #42637b; background:#10283baa; border-radius:20px; padding:6px 12px; font:12px Tahoma,Arial,sans-serif; color:#acd1de; }
body:has(#mainScreen:not(.hidden)) .round-mode-badges > span:first-child { color:#f5d88e; }
.treasure-unavailable { cursor:not-allowed !important; }
button:focus-visible, summary:focus-visible, a:focus-visible { outline:3px solid #f8d581; outline-offset:4px; }
button:disabled { cursor:not-allowed; }
::-webkit-scrollbar { display:block; width:7px; height:7px; }
::-webkit-scrollbar-thumb { background:#45617b; border-radius:10px; }
* { scrollbar-width:thin; scrollbar-color:#45617b transparent; }
#treasureGrid .treasure-chest { animation:captain-arrive .35s ease both; }
#treasureGrid .treasure-chest:hover:not(:disabled) { transform:translateY(-5px) scale(1.025); filter:drop-shadow(0 9px 14px #e8a72e55); }
#treasureGrid .treasure-chest:active:not(:disabled) { transform:scale(.97); }
@keyframes captain-arrive { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
@media(prefers-reduced-motion:reduce) { *, *::before, *::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; } }
