/* ===== ROBOT BUILDER GAME v2 ===== */

.game-section {
    padding: 80px 0 100px;
    background: linear-gradient(135deg, #1D3461 0%, #243f75 30%, #1D3461 60%, #7a1a22 100%);
    position: relative;
    overflow: hidden;
}

/* Gold accent bar at top */
.game-section::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #C8962A, #f0c060, #C8962A);
    pointer-events: none;
    z-index: 3;
}

/* Subtle dot grid overlay */
.game-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(200,150,42,0.06) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
}

/* ── 3-column wrapper ── */
.rg-wrapper {
    display: grid;
    grid-template-columns: 230px 1fr 250px;
    gap: 20px;
    margin-top: 48px;
    align-items: start;
    position: relative;
    z-index: 2;
}

.rg-panel-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #C8962A;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Parts Panel ── */
.rg-parts-panel {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(200,150,42,0.18);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.rg-panel-hint {
    font-size: 11px;
    color: rgba(255,255,255,0.35);
    margin-bottom: 16px;
    font-style: italic;
}

.rg-category { margin-bottom: 18px; }

.rg-cat-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.3);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.rg-parts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
}

.rg-part {
    background: rgba(255,255,255,0.07);
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 10px 4px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.rg-part:hover {
    background: rgba(200,150,42,0.18);
    border-color: #C8962A;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(200,150,42,0.2);
}

.rg-part:active { transform: scale(0.93); }

.rg-part.equipped {
    background: rgba(200,150,42,0.2);
    border-color: rgba(200,150,42,0.7);
    box-shadow: 0 0 14px rgba(200,150,42,0.25);
}

.rg-part-emoji { font-size: 24px; margin-bottom: 4px; line-height: 1; }

.rg-part-name {
    font-size: 9px;
    font-weight: 700;
    color: rgba(255,255,255,0.65);
    letter-spacing: 0.4px;
    margin-bottom: 5px;
}

.rg-part-tag {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.8px;
    padding: 2px 5px;
    border-radius: 4px;
    display: inline-block;
    text-transform: uppercase;
}
.rg-part-tag.intel   { background: rgba(29,52,97,0.55);     color: #7aaad4; }
.rg-part-tag.speed   { background: rgba(200,150,42,0.28);  color: #e8b84b; }
.rg-part-tag.power   { background: rgba(193,18,31,0.28);   color: #e85060; }
.rg-part-tag.defense { background: rgba(16,42,67,0.55);    color: #5b8ab5; }

/* ── Canvas Area ── */
.rg-canvas-area {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Score bar */
.rg-score-bar {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(200,150,42,0.2);
    border-radius: 14px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rg-score-left { display: flex; align-items: center; gap: 12px; }
.rg-score-icon { font-size: 30px; }

.rg-score-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
}

.rg-score-val {
    font-size: 34px;
    font-weight: 900;
    color: #C8962A;
    line-height: 1;
    transition: transform 0.2s;
}

.rg-level-badge {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: rgba(200,150,42,0.18);
    color: #C8962A;
    border: 1.5px solid rgba(200,150,42,0.35);
    transition: all 0.3s;
}

/* ── Robot Canvas ── */
.rg-robot-canvas {
    background: rgba(13,28,58,0.5);
    border: 1.5px solid rgba(200,150,42,0.15);
    border-radius: 20px;
    padding: 28px 16px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-height: 360px;
    position: relative;
}

/* Slot rows */
.rg-slot-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}
.arms-row { gap: 8px; }
.legs-row  { gap: 14px; }

/* Individual slot */
.rg-slot { position: relative; }

.rg-slot-inner {
    width: 90px;
    height: 90px;
    border: 2px dashed rgba(255,255,255,0.18);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background: rgba(255,255,255,0.02);
    position: relative;
}

.rg-slot.body-slot .rg-slot-inner { width: 108px; height: 100px; border-radius: 16px; }
.rg-slot.arm-slot  .rg-slot-inner,
.rg-slot.leg-slot  .rg-slot-inner { width: 80px; height: 80px; }

.rg-slot.drag-over .rg-slot-inner {
    border-color: #C8962A;
    background: rgba(200,150,42,0.12);
    box-shadow: 0 0 22px rgba(200,150,42,0.25);
}

.rg-slot.filled .rg-slot-inner {
    border-style: solid;
    border-color: rgba(200,150,42,0.45);
    background: rgba(200,150,42,0.07);
}

.rg-slot-ghost {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: rgba(255,255,255,0.18);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    pointer-events: none;
}
.rg-slot-ghost i { font-size: 20px; }

/* Equipped part inside slot */
.rg-equipped-part {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    animation: partSnap 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes partSnap {
    from { transform: scale(0.3) rotate(-10deg); opacity: 0; }
    to   { transform: scale(1) rotate(0deg);     opacity: 1; }
}

.rg-ep-emoji { font-size: 34px; line-height: 1; }
.rg-slot.body-slot .rg-ep-emoji { font-size: 42px; }
.rg-slot.arm-slot  .rg-ep-emoji,
.rg-slot.leg-slot  .rg-ep-emoji { font-size: 28px; }

.rg-ep-name {
    font-size: 8px;
    font-weight: 700;
    color: #C8962A;
    letter-spacing: 0.5px;
    text-align: center;
}

/* Remove button (×) */
.rg-remove-btn {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    border: none;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 5;
    transition: transform 0.15s;
}
.rg-slot:hover .rg-remove-btn { display: flex; }
.rg-remove-btn:hover { transform: scale(1.2); }

/* ── Controls ── */
.rg-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.rg-btn {
    padding: 11px 22px;
    border: none;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    color: white;
    transition: transform 0.15s, filter 0.15s, box-shadow 0.15s;
}
.rg-btn:hover  { transform: translateY(-2px); filter: brightness(1.12); box-shadow: 0 6px 20px rgba(0,0,0,0.35); }
.rg-btn:active { transform: scale(0.95); }
.rg-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: none; }

.rg-btn.test-btn  { background: linear-gradient(135deg, #10b981, #059669); }
.rg-btn.reset-btn { background: linear-gradient(135deg, #ef4444, #dc2626); }
.rg-btn.save-btn  { background: linear-gradient(135deg, #1D3461, #2E5AA8); }

/* ── Stats Panel ── */
.rg-stats-panel {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(200,150,42,0.18);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.rg-stats-section,
.rg-challenges-section { display: flex; flex-direction: column; }

.rg-stat-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.rg-stat-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.65);
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.rg-stat-track {
    width: 72px;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
}

.rg-stat-fill {
    height: 100%;
    border-radius: 3px;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
}
.rg-stat-fill.intel   { background: linear-gradient(90deg, #1D3461, #2E5AA8); }
.rg-stat-fill.speed   { background: linear-gradient(90deg, #a06a10, #C8962A); }
.rg-stat-fill.power   { background: linear-gradient(90deg, #8a0a12, #C1121F); }
.rg-stat-fill.defense { background: linear-gradient(90deg, #102A43, #1D4A7A); }

.rg-stat-num {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.4);
    min-width: 22px;
    text-align: right;
}

.rg-power-total {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.07);
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.rg-power-bar {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
}

.rg-power-fill {
    height: 100%;
    background: linear-gradient(90deg, #1D3461, #C8962A, #f0c060);
    border-radius: 4px;
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
}

/* ── Challenges ── */
.rg-challenges-list { display: flex; flex-direction: column; gap: 8px; }

.rg-challenge {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    font-size: 12px;
    color: rgba(255,255,255,0.45);
    font-weight: 600;
    transition: all 0.25s;
}

.rg-challenge.completed {
    background: rgba(16,185,129,0.1);
    border-color: rgba(16,185,129,0.3);
    color: #34d399;
    animation: challengePop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes challengePop {
    0%  { transform: scale(1); }
    50% { transform: scale(1.04); }
    100%{ transform: scale(1); }
}

.rg-check {
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 900;
    color: transparent;
    flex-shrink: 0;
    transition: all 0.3s;
}

.rg-challenge.completed .rg-check {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.rg-ch-pts {
    margin-left: auto;
    font-size: 10px;
    font-weight: 800;
    color: #C8962A;
    opacity: 0.65;
}
.rg-challenge.completed .rg-ch-pts { opacity: 0; }

/* ── Notifications ── */
.game-notification {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 10px;
    z-index: 10000;
    font-weight: 700;
    font-size: 14px;
    color: white;
    box-shadow: 0 8px 24px rgba(29,52,97,0.3);
    animation: notifSlide 0.3s cubic-bezier(0.34,1.56,0.64,1);
    white-space: nowrap;
    pointer-events: none;
}
.game-notification.success { background: #10b981; }
.game-notification.error   { background: #ef4444; }
.game-notification.info    { background: #1D3461; }

@keyframes notifSlide {
    from { opacity: 0; transform: translateX(-50%) translateY(-16px) scale(0.9); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0)      scale(1); }
}

/* ── Confetti ── */
.confetti {
    position: fixed;
    width: 8px; height: 8px;
    border-radius: 2px;
    top: -10px;
    animation: confettiFall 3s ease-in forwards;
    z-index: 9999;
    pointer-events: none;
}
@keyframes confettiFall {
    0%   { transform: translateY(0) rotate(0deg);    opacity: 1; }
    100% { transform: translateY(110vh) rotate(600deg); opacity: 0; }
}

/* ══════════════════════════
   PART EFFECTS (unchanged)
══════════════════════════ */

#cameraOverlay {
    position: fixed; bottom: 80px; right: 24px;
    z-index: 10000; animation: popIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes popIn {
    from { opacity:0; transform: scale(0.7) translateY(20px); }
    to   { opacity:1; transform: scale(1) translateY(0); }
}
.cam-window { background:#0d1117; border:1px solid #30363d; border-radius:12px; overflow:hidden; box-shadow:0 20px 60px rgba(0,0,0,0.6); width:300px; }
.cam-topbar { display:flex; align-items:center; gap:6px; padding:10px 14px; background:#161b22; border-bottom:1px solid #30363d; }
.cam-dot { width:12px; height:12px; border-radius:50%; flex-shrink:0; }
.cam-dot.red { background:#ff5f57; } .cam-dot.yellow { background:#ffbd2e; } .cam-dot.green { background:#28c840; }
.cam-title { flex:1; font-size:11px; font-weight:600; color:#8b949e; letter-spacing:1px; text-align:center; }
.cam-close { background:none; border:none; color:#8b949e; cursor:pointer; font-size:14px; padding:0; transition:color 0.15s; }
.cam-close:hover { color:#f85149; }
.cam-body { position:relative; background:#000; }
#camFeed { width:100%; display:block; max-height:220px; object-fit:cover; }
.cam-ui { position:absolute; inset:0; pointer-events:none; }
.cam-corner { position:absolute; width:16px; height:16px; border-color:#10b981; border-style:solid; border-width:0; }
.cam-corner.tl { top:8px;    left:8px;   border-top-width:2px;    border-left-width:2px; }
.cam-corner.tr { top:8px;    right:8px;  border-top-width:2px;    border-right-width:2px; }
.cam-corner.bl { bottom:8px; left:8px;   border-bottom-width:2px; border-left-width:2px; }
.cam-corner.br { bottom:8px; right:8px;  border-bottom-width:2px; border-right-width:2px; }
.cam-label { position:absolute; top:10px; left:50%; transform:translateX(-50%); font-size:10px; font-weight:700; color:#f85149; letter-spacing:1px; animation:blink 1s step-end infinite; }
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:0;} }

.magnet-item { position:fixed; font-size:26px; z-index:9999; pointer-events:none; transition:left 0.7s cubic-bezier(0.4,0,0.8,1), top 0.7s cubic-bezier(0.4,0,0.8,1), transform 0.7s ease, opacity 0.7s ease; filter:drop-shadow(0 2px 6px rgba(29,52,97,0.4)); }

.welder-spark { position:fixed; width:6px; height:6px; border-radius:50%; z-index:9999; pointer-events:none; animation:sparkFly 0.7s ease-out forwards; }
@keyframes sparkFly { 0%{transform:translate(0,0) scale(1);opacity:1;} 100%{transform:translate(var(--tx),var(--ty)) scale(0);opacity:0;} }

.ai-overlay { position:absolute; inset:0; background:rgba(29,52,97,0.78); display:flex; flex-direction:column; align-items:center; justify-content:center; z-index:10; animation:fadeInOverlay 0.3s ease; border-radius:20px; }
@keyframes fadeInOverlay { from{opacity:0;} to{opacity:1;} }
.ai-scan { width:100%; height:3px; background:linear-gradient(90deg,transparent,#C8962A,transparent); position:absolute; top:0; animation:aiScan 1.5s linear infinite; }
@keyframes aiScan { 0%{top:0%;} 100%{top:100%;} }
.ai-text { color:#fff; font-size:16px; font-weight:700; text-align:center; letter-spacing:2px; }
.ai-sub  { display:block; font-size:11px; font-weight:400; opacity:0.7; margin-top:8px; letter-spacing:0.5px; }

.antenna-wave { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); border:2px solid rgba(200,150,42,0.5); border-radius:50%; width:40px; height:40px; animation:waveExpand 1.5s ease-out forwards; pointer-events:none; }
@keyframes waveExpand { 0%{width:40px;height:40px;opacity:0.8;} 100%{width:300px;height:300px;opacity:0;} }

.speed-line { position:absolute; left:0; height:2px; background:linear-gradient(90deg,transparent,#1D3461 40%,#C8962A); border-radius:2px; animation:speedZoom 0.6s ease-out forwards; pointer-events:none; }
@keyframes speedZoom { from{transform:scaleX(0);opacity:1;} to{transform:scaleX(1);opacity:0;} }

.tank-shield { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); width:160px; height:200px; border:3px solid #1D3461; border-radius:50% 50% 40% 40%; background:rgba(29,52,97,0.08); animation:shieldPulse 0.5s ease-out 3; pointer-events:none; }
@keyframes shieldPulse { 0%,100%{transform:translate(-50%,-50%) scale(1);opacity:1;} 50%{transform:translate(-50%,-50%) scale(1.08);opacity:0.6;} }

.hover-glow { position:absolute; bottom:30px; left:50%; transform:translateX(-50%); width:120px; height:20px; background:radial-gradient(ellipse,rgba(29,52,97,0.5) 0%,transparent 70%); border-radius:50%; animation:hoverFloat 0.8s ease-in-out infinite alternate; pointer-events:none; }
@keyframes hoverFloat { from{transform:translateX(-50%) scaleX(1);opacity:0.6;} to{transform:translateX(-50%) scaleX(1.3);opacity:1;} }

.wheel-dust { position:absolute; bottom:30px; width:10px; height:10px; background:rgba(100,116,139,0.5); border-radius:50%; animation:dustFloat 1s ease-out forwards; pointer-events:none; }
@keyframes dustFloat { 0%{transform:translateY(0) scale(1);opacity:0.7;} 100%{transform:translateY(-60px) scale(2.5);opacity:0;} }

/* ── Responsive ── */
@media (max-width: 1100px) {
    .rg-wrapper { grid-template-columns: 200px 1fr 220px; gap: 14px; }
}

@media (max-width: 900px) {
    .rg-wrapper { grid-template-columns: 1fr; }
    .rg-parts-grid { grid-template-columns: repeat(6, 1fr); }
    .rg-robot-canvas { min-height: 300px; }
    .rg-stats-panel { flex-direction: row; gap: 16px; }
    .rg-stats-section, .rg-challenges-section { flex: 1; }
}

@media (max-width: 600px) {
    .rg-parts-grid { grid-template-columns: repeat(3, 1fr); }
    .rg-slot-inner { width: 72px; height: 72px; }
    .rg-slot.body-slot .rg-slot-inner { width: 88px; height: 88px; }
    .rg-slot.arm-slot .rg-slot-inner, .rg-slot.leg-slot .rg-slot-inner { width: 65px; height: 65px; }
    .rg-stats-panel { flex-direction: column; }
    .rg-controls { flex-wrap: wrap; }
    .rg-btn { flex: 1; justify-content: center; min-width: 100px; }
}
