/* ===================== Λογική & Τακτική, Μετεωρίτες, Ένωσε τις τελείες ===================== */

/* ---- κοινά ---- */
.lg-result { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(40,20,60,.35); backdrop-filter: blur(3px); }
.lg-result-box { background: #fff; border-radius: 28px; padding: 22px 34px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.3); animation: popin .4s; max-width: 420px; }
.lg-result-box .e { font-size: 64px; line-height: 1.1; }
.lg-result-box h3 { margin: 6px 0 4px; font-size: 26px; color: #37474f; }
.lg-result-box p { margin: 0 0 12px; font-size: 17px; color: #607d8b; }
.shake { animation: shake-plain .4s; }
.bump { animation: bump .4s; }

/* ---- Τάνγκραμ ---- */
/* Φόντο των παιχνιδιών λογικής: img/logic_bg.jpg (δωμάτιο με παζλ) με ελαφρύ λευκό φίλτρο */
.tg-wrap, .c4-wrap, .ttt-wrap, .mem-wrap, .dm-wrap, .df-wrap, .tr-wrap { background: linear-gradient(rgba(255,255,255,.42), rgba(255,255,255,.42)), url('../img/logic_bg.jpg') center/cover no-repeat; }
.tg-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 10px; gap: 6px; }
.tg-top { display: flex; align-items: center; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tg-top .big-btn { font-size: 18px; padding: 8px 16px; margin: 0; }
.tg-name { font-weight: 700; font-size: 22px; color: #ff7043; margin-right: 8px; }
.tg-count { font-weight: 700; font-size: 20px; color: #37474f; margin-left: 8px; }
.tg-board { flex: 1; min-height: 0; width: 100%; background: rgba(255,255,255,.7); border-radius: 20px; touch-action: none; }
.tg-targets polygon { fill: #b0bec5; stroke: #78909c; stroke-width: .06; stroke-linejoin: round; }
.tg-piece { stroke: rgba(0,0,0,.35); stroke-width: .06; stroke-linejoin: round; cursor: grab; filter: drop-shadow(0 .12px .12px rgba(0,0,0,.35)); transition: filter .15s; }
.tg-piece:hover { filter: drop-shadow(0 .2px .25px rgba(0,0,0,.45)) brightness(1.08); }
.tg-piece.sel { stroke: #fff; stroke-width: .12; }
.tg-piece.locked { cursor: default; stroke: rgba(0,0,0,.25); filter: none; }
.tg-ctl { cursor: pointer; }
.tg-ctl circle { fill: #fff; stroke: #ff9800; stroke-width: .07; filter: drop-shadow(0 .06px .1px rgba(0,0,0,.35)); transition: transform .1s; }
.tg-ctl text { text-anchor: middle; fill: #e65100; font-weight: 700; font-family: inherit; pointer-events: none; user-select: none; }
.tg-ctl:hover circle { fill: #ffe082; }
.tg-ctl:active circle { fill: #ffb74d; }

/* ---- Σκορ 4 ---- */
.c4-wrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 30px; padding: 10px; overflow: hidden; }
.c4-side { display: flex; flex-direction: column; gap: 14px; align-items: center; z-index: 1; }
.c4-turn { font-weight: 700; font-size: 24px; color: #37474f; background: rgba(255,255,255,.85); padding: 8px 18px; border-radius: 20px; min-height: 46px; }
.c4-you { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; background: rgba(255,255,255,.75); padding: 6px 14px; border-radius: 16px; }
.c4-board { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; background: #1e88e5; padding: 12px; border-radius: 20px; box-shadow: 0 10px 0 #0d47a1, 0 16px 30px rgba(0,0,0,.25); z-index: 1; width: min(560px, 60vw, 78vh); }
.c4-cell { aspect-ratio: 1; background: #0d47a1; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.c4-board.wait .c4-cell { cursor: wait; }
.c4-cell:hover { box-shadow: inset 0 0 0 4px rgba(255,255,255,.4); }
.c4-disc { width: 84%; height: 84%; border-radius: 50%; display: inline-block; }
.c4-you .c4-disc { width: 24px; height: 24px; }
.c4-disc.p1 { background: radial-gradient(circle at 35% 30%, #ff8a80, #d32f2f); box-shadow: inset 0 -4px 0 rgba(0,0,0,.2); }
.c4-disc.p2 { background: radial-gradient(circle at 35% 30%, #fff59d, #f9a825); box-shadow: inset 0 -4px 0 rgba(0,0,0,.2); }
.c4-cell.drop .c4-disc { animation: c4-drop .35s cubic-bezier(.3, 1.4, .6, 1); }
@keyframes c4-drop { from { transform: translateY(-300%); } to { transform: translateY(0); } }
.c4-cell.win { box-shadow: 0 0 0 4px #fff, 0 0 18px #fff; animation: glow-cell .6s infinite alternate; }
@keyframes glow-cell { to { box-shadow: 0 0 0 6px #ffd740, 0 0 26px #ffd740; } }

/* ---- Τρίλιζα ---- */
.ttt-wrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 30px; overflow: hidden; }
.ttt-side { z-index: 1; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.ttt-score { font-weight: 700; font-size: 22px; background: rgba(255,255,255,.85); padding: 8px 18px; border-radius: 20px; }
.ttt-turn { font-weight: 700; font-size: 20px; color: #37474f; min-height: 28px; }
.ttt-board { z-index: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(420px, 60vw, 70vh); background: #5c6bc0; padding: 10px; border-radius: 22px; box-shadow: 0 10px 0 #303f9f, 0 16px 30px rgba(0,0,0,.2); }
.ttt-cell { aspect-ratio: 1; font-size: min(72px, 12vw, 12vh); background: #fff; border: 0; border-radius: 16px; cursor: pointer; font-family: inherit; transition: transform .1s; }
.ttt-cell:hover { transform: scale(1.04); background: #f3f4ff; }
.ttt-cell.win { background: #fff59d; box-shadow: 0 0 0 4px #ffb300; }
.ttt-cell.popin { animation: popin .3s; }

/* ---- Μνήμη ---- */
.mem-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; padding: 8px 14px; gap: 8px; overflow: hidden; }
.mem-info { z-index: 1; font-weight: 700; font-size: 20px; background: rgba(255,255,255,.85); padding: 6px 18px; border-radius: 18px; }
.mem-area { z-index: 1; flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }
.mem-grid { display: grid; gap: 10px; --card: 90px; --emoji: 48px; }
.mem-card { position: relative; width: var(--card); height: var(--card); border: 0; background: transparent; cursor: pointer; perspective: 600px; padding: 0; }
.mem-card .front, .mem-card .back { position: absolute; inset: 0; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: var(--emoji); backface-visibility: hidden; transition: transform .35s; box-shadow: 0 4px 0 rgba(0,0,0,.15); }
.mem-card .back { background: linear-gradient(135deg, #7e57c2, #5c6bc0); color: #fff; }
.mem-card .front { background: #fff; transform: rotateY(180deg); }
.mem-card.open .back, .mem-card.done .back { transform: rotateY(180deg); }
.mem-card.open .front, .mem-card.done .front { transform: rotateY(0); }
.mem-card.done .front { background: #e8f5e9; box-shadow: 0 0 0 3px #66bb6a; }

/* ---- Ντόμινο ---- */
.dm-wrap { position: absolute; inset: 0; display: grid; grid-template-rows: auto 1fr auto; gap: 8px; padding: 10px; overflow: hidden; }
.dm-row { z-index: 1; background: rgba(255,255,255,.8); border-radius: 18px; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }
.dm-mehead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dm-label { font-weight: 700; font-size: 17px; color: #37474f; display: flex; align-items: center; gap: 6px; }
.dm-turn { font-weight: 700; color: #2e7d32; margin-left: auto; font-size: 18px; }
#dm-hand, #dm-ai-hand { display: flex; flex-wrap: wrap; gap: 8px; }
.dm-chain-box { z-index: 1; overflow-x: auto; display: flex; align-items: center; background: rgba(0,0,0,.25); border-radius: 18px; padding: 10px; }
.dm-chain { display: flex; gap: 4px; align-items: center; margin: auto; }
.dm-empty { color: #fff; font-weight: 700; font-size: 18px; padding: 10px 20px; }
.dm-tile { display: inline-flex; background: #fffef5; border: 2px solid #5d4037; border-radius: 8px; box-shadow: 0 3px 0 #8d6e63; }
.dm-tile.mine { cursor: pointer; opacity: .55; transition: transform .1s, opacity .15s; }
.dm-tile.mine.ok { opacity: 1; }
.dm-tile.mine.ok:hover { transform: translateY(-6px) scale(1.06); }
.dm-tile.back { width: 44px; height: 24px; background: linear-gradient(135deg, #8d6e63, #5d4037); }
.dm-half { display: grid; grid-template-columns: repeat(3, 11px); grid-template-rows: repeat(3, 11px); gap: 3px; padding: 6px; }
.dm-half + .dm-half { border-left: 2px solid #5d4037; }
.dm-half i { width: 11px; height: 11px; border-radius: 50%; }
.dm-half i.on { background: #263238; }
.dm-tile.chain .dm-half { grid-template-columns: repeat(3, 9px); grid-template-rows: repeat(3, 9px); }
.dm-tile.chain .dm-half i { width: 9px; height: 9px; }
.modal .dm-tile { transform: scale(1.6); margin: 14px; }

/* ---- Λαβύρινθος ---- */
.lm-wrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 20px; padding: 10px; overflow: hidden; }
.lm-board { z-index: 1; position: relative; width: min(72vh, 60vw, 720px); border-radius: 10px; overflow: hidden; box-shadow: 0 14px 34px rgba(0,0,0,.3), 0 0 0 4px rgba(255,255,255,.6); }
.lm-canvas { display: block; width: 100%; height: 100%; }
/* Δείκτης εξόδου: παλλόμενοι δακτύλιοι + ετικέτα πάνω από το κελί-στόχο (--t = μέγεθος πλακιδίου σε px) */
.lm-goal { position: absolute; width: 0; height: 0; pointer-events: none; z-index: 2; }
.lm-goal-ring { position: absolute; left: 0; top: 0; width: calc(var(--t, 24px) * 2.2); height: calc(var(--t, 24px) * 2.2); border-radius: 50%; transform: translate(-50%, -50%); border: 4px solid #ffeb3b; box-shadow: 0 0 12px #ffeb3b, inset 0 0 12px rgba(255,235,59,.6); animation: lm-pulse 1.4s ease-out infinite; }
.lm-goal-ring.r2 { animation-delay: .7s; }
@keyframes lm-pulse { 0% { transform: translate(-50%, -50%) scale(.55); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; } }
.lm-goal-label { position: absolute; left: 0; top: calc(var(--t, 24px) * -1.6); transform: translate(-80%, -100%); white-space: nowrap; font-size: max(12px, calc(var(--t, 24px) * .55)); font-weight: 900; color: #5d4037; background: #ffeb3b; border: 3px solid #fff; border-radius: 30px; padding: 2px 10px; box-shadow: 0 3px 10px rgba(0,0,0,.3); animation: lm-bob 1s ease-in-out infinite alternate; }
@keyframes lm-bob { from { margin-top: 0; } to { margin-top: calc(var(--t, 24px) * -.3); } }
/* Δείκτης κλειδιού: πορτοκαλί, ετικέτα προς τα δεξιά ώστε να μη σκεπάζει την έξοδο */
.lm-key .lm-goal-ring { border-color: #ff9800; box-shadow: 0 0 12px #ff9800, inset 0 0 12px rgba(255,152,0,.6); }
.lm-key .lm-goal-label { background: #ffb74d; color: #4e342e; transform: translate(-20%, -100%); }
.lm-wrap.dark .lm-board { box-shadow: 0 14px 34px rgba(0,0,0,.6), 0 0 0 4px rgba(120,144,156,.5); }
.lm-pad { z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; background: rgba(255,255,255,.8); padding: 12px; border-radius: 20px; }
.lm-pad div { display: flex; gap: 6px; }
.lm-pad button { font-size: 28px; width: 58px; height: 58px; border-radius: 14px; border: 3px solid #cfd8dc; background: #fff; cursor: pointer; }
.lm-pad button:active { transform: translateY(3px); }
.lm-steps { font-weight: 700; margin-top: 6px; }

/* ---- Βρες τις διαφορές ---- */
.df-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.df-pics { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: center; gap: 12px; }
.df-pics.stack { flex-direction: column; }
.df-scene { position: relative; flex: none; overflow: hidden; border-radius: 16px; box-shadow: 0 0 0 4px #fff, 0 8px 20px rgba(0,0,0,.18); background: #fff; cursor: crosshair; }
.df-svg { display: block; width: 100%; height: 100%; }
.df-marks { position: absolute; inset: 0; pointer-events: none; }
/* Ο κύκλος εμφανίζεται ακριβώς στο σημείο: το animation κρατά το translate(-50%,-50%) (το γενικό popin το έχανε και ο κύκλος «γλιστρούσε») */
.df-mark { position: absolute; aspect-ratio: 1; border: 5px solid #e53935; border-radius: 50%; transform: translate(-50%, -50%); animation: df-pop .25s ease-out; box-shadow: 0 0 0 3px #fff, inset 0 0 0 3px #fff; box-sizing: border-box; }
@keyframes df-pop { 0% { transform: translate(-50%, -50%) scale(.3); opacity: 0; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.df-mark.no { border-color: #90a4ae; border-style: dashed; border-width: 4px; }
.df-mark.hint { border-color: #ffb300; animation: df-blink .3s 5; }
@keyframes df-blink { 50% { opacity: .2; } }
.df-title { font-size: 17px; color: #607d8b; }
.df-bar { display: flex; justify-content: center; align-items: center; gap: 16px; font-weight: 700; font-size: 20px; }
.df-bar .big-btn { font-size: 18px; padding: 8px 16px; margin: 0; }

/* ---- Κρυμμένος θησαυρός ---- */
.tr-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; padding: 8px; gap: 6px; overflow: hidden; }
.tr-info { z-index: 1; display: flex; gap: 20px; align-items: center; font-weight: 700; font-size: 18px; background: rgba(255,255,255,.85); padding: 6px 16px; border-radius: 18px; }
.tr-legend { display: flex; align-items: center; gap: 4px; font-size: 14px; }
.tr-legend i { width: 18px; height: 18px; border-radius: 4px; display: inline-block; }
.tr-grid { z-index: 1; flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }
.tr-svg { width: 100%; height: 100%; overflow: visible; }
/* Κάθε πλακίδιο: σκούρα «πλευρά» (ανάγλυφο) + πάνω όψη με λευκό περίγραμμα = ευδιάκριτο πλέγμα */
.tr-cell { cursor: pointer; }
.tr-cell .tr-top { transition: fill .3s; }
.tr-cell:not(.open):hover .tr-top { filter: brightness(1.18); }
.tr-cell:not(.open):hover { transform: translateY(-3px); }
.tr-cell.open { cursor: default; }
.tr-cell.gold .tr-top { fill: url(#tr-gold); }
.tr-cell.gold { animation: tr-found .5s ease-out; transform-box: fill-box; transform-origin: center; }
@keyframes tr-found { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
.tr-cell text { pointer-events: none; user-select: none; }
.tr-cell.open .tr-q { display: none; }
.tr-info b { font-size: 20px; }
.tr-legend .tr-bar { width: 110px; height: 14px; border-radius: 7px; background: linear-gradient(90deg, #1e88e5, #8e5b9e, #e53935); border: 2px solid #fff; box-shadow: 0 0 0 1px #b0bec5; }

/* ---- Μετεωρίτες ---- */
.mt-scene { background: url('../img/night_bg.jpg') center/cover no-repeat; }
.mt-sky { position: absolute; inset: 0; overflow: hidden; }
.mt-city { position: absolute; left: 0; right: 0; bottom: 0; height: 22%; background: linear-gradient(transparent, rgba(0,0,0,.35)); }
.mt-building { position: absolute; bottom: 4%; transform: translateX(-50%); font-size: min(56px, 8vh); line-height: 1; }
.mt-building .mt-shield { position: absolute; inset: -12px; border-radius: 50%; border: 4px solid rgba(79,195,247,0); background: rgba(79,195,247,0); transition: all .3s; }
.mt-building .mt-shield.on { border-color: rgba(79,195,247,.9); background: rgba(79,195,247,.2); box-shadow: 0 0 14px #4fc3f7; }
.mt-building.dead { filter: grayscale(1); opacity: .7; }
.mt-base { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; z-index: 3; }
.mt-launcher { font-size: 30px; transform: rotate(-45deg); filter: drop-shadow(0 0 6px #ffab40); }
.mt-base.launch .mt-launcher { animation: mt-launch .35s; }
@keyframes mt-launch { 0% { transform: rotate(-45deg) scale(1); } 40% { transform: rotate(-45deg) scale(1.4) translateY(-6px); } 100% { transform: rotate(-45deg) scale(1); } }
.mt-rocket { position: absolute; font-size: min(38px, 5vh); line-height: 1; transform: translate(-50%, -50%) rotate(-45deg); z-index: 5; pointer-events: none; filter: drop-shadow(0 0 8px #ffab40); }
.mt-trail { position: absolute; width: 18px; height: 18px; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; z-index: 4;
  background: radial-gradient(circle, #fff9c4, #ff9100 55%, transparent 72%); animation: mt-trail .5s forwards; }
@keyframes mt-trail { 0% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(2.2); } }
.mt-ring { position: absolute; width: 40px; height: 40px; border-radius: 50%; border: 4px solid #ffeb3b; transform: translate(-50%, -50%); pointer-events: none; z-index: 4; box-shadow: 0 0 20px #ff9100; animation: mt-ring .5s forwards; }
@keyframes mt-ring { 0% { opacity: 1; transform: translate(-50%, -50%) scale(.4); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(3); } }
.mt-meteor.targeted .mt-letter { border-color: #ffeb3b; box-shadow: 0 0 0 3px #ffeb3b, 0 3px 0 #bf360c; }
.mt-meteor { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; z-index: 2; }
.mt-rock { font-size: min(44px, 6vh); line-height: 1; animation: mt-spin 1.2s linear infinite; }
@keyframes mt-spin { to { transform: rotate(360deg); } }
.mt-letter { background: #fff; color: #263238; font-weight: 700; font-size: 26px; line-height: 1; padding: 4px 10px; border-radius: 12px; border: 3px solid #ff7043; box-shadow: 0 3px 0 #bf360c; margin-top: -6px; }
.mt-boom { position: absolute; transform: translate(-50%, -50%); font-size: 40px; animation: pop .5s forwards; pointer-events: none; z-index: 4; }
.mt-boom.big { font-size: 70px; }

.mt-hud { position: absolute; top: 8px; left: 12px; right: 12px; display: flex; justify-content: space-between; font-weight: 700; font-size: 20px; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,.5); z-index: 3; }

/* ---- Ένωσε τις τελείες ---- */
.dt-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; padding: 8px; overflow: hidden; background: url('../img/garden_bg.jpg') center/cover no-repeat; }
.dt-info { z-index: 1; font-weight: 700; font-size: 20px; background: rgba(255,255,255,.85); padding: 6px 18px; border-radius: 18px; }
.dt-board { z-index: 1; flex: 1; min-height: 0; width: 100%; max-width: 78vh; background: rgba(255,255,255,.62); border-radius: 22px; box-shadow: 0 6px 20px rgba(0,0,0,.15); }
.dt-fill { opacity: 0; transition: opacity .8s; }
.dt-board.complete .dt-fill { opacity: .9; }
.dt-line { stroke: #37474f; stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.dt-dot { cursor: pointer; }
.dt-dot circle { fill: #fff; stroke: #5c6bc0; stroke-width: 1; transition: fill .15s; }
.dt-dot text { font-size: 4.2px; font-weight: 700; text-anchor: middle; fill: #37474f; pointer-events: none; font-family: inherit; }
.dt-dot:hover circle { fill: #e8eaf6; }
.dt-dot.done circle { fill: #66bb6a; stroke: #2e7d32; }
.dt-dot.done text { fill: #fff; }
.dt-dot.next circle { fill: #ffd54f; stroke: #ff9800; animation: dt-pulse .8s infinite alternate; }
@keyframes dt-pulse { from { r: 4.2; } to { r: 5.4; } }
.dt-dot.shake circle { animation: dt-wrong .4s; }
@keyframes dt-wrong { 0%, 100% { fill: #fff; } 50% { fill: #ef5350; stroke: #b71c1c; } }
.dt-board.complete .dt-dot { opacity: .35; }
.dt-title { font-size: 7px; font-weight: 700; fill: #37474f; font-family: inherit; }

@media (max-width: 900px) {
  .c4-wrap, .ttt-wrap, .lm-wrap { flex-direction: column; gap: 10px; }
}
