/* Στυλ για τους Μικρούς Μηχανικούς (Physics Kids Stylesheet) */
@font-face {
  font-family: 'Ubuntu Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('assets/fonts/ubuntu-sans-greek-wght-normal.woff2') format('woff2');
  unicode-range: U+0370-03FF;
}

@font-face {
  font-family: 'Ubuntu Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('assets/fonts/ubuntu-sans-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC;
}

:root {
  --bg-dark: #0F172A;
  --bg-card: #1E293B;
  --bg-card-light: #334155;
  --primary: #F59E0B;
  --primary-glow: #FDE047;
  --accent-cyan: #0284C7;
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --border: #334155;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Ubuntu Sans', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* SpeedGuard Red Warning Banner */
.speedguard-banner {
  background: #EF4444;
  color: #FFFFFF;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: bold;
  position: sticky;
  top: 0;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}
.speedguard-banner.hidden { display: none; }
.sg-icon { font-size: 24px; }
.sg-title { font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; }
.sg-message { font-size: 13px; opacity: 0.95; }

/* Main App Container */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.suite-back-pill {
  background: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  transition: all 0.2s;
}
.suite-back-pill:hover {
  background: rgba(245, 158, 11, 0.25);
  transform: translateY(-1px);
}
.brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.brand-text {
  background: linear-gradient(135deg, #FDE047, #F59E0B, #EF4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.header-controls {
  display: flex;
  gap: 10px;
}

/* Buttons */
.pill-btn {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pill-btn:hover {
  background: var(--bg-card-light);
  border-color: #64748B;
  transform: translateY(-1px);
}

.action-btn {
  padding: 14px 28px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.primary-btn {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #041026;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}
.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.55);
}
.secondary-btn {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
}
.secondary-btn:hover {
  background: var(--bg-card-light);
  transform: translateY(-2px);
}

/* Screens */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}
.screen.hidden { display: none !important; }
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.99); }
  to { opacity: 1; transform: scale(1); }
}

/* Home Screen */
.home-screen {
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 40px 20px;
}
.home-hero {
  max-width: 680px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.mascot-wrapper {
  position: relative;
  margin-bottom: 24px;
}
.hero-mascot {
  width: 180px;
  height: 180px;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.5));
  animation: floatArchie 4s ease-in-out infinite alternate;
}
@keyframes floatArchie {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}
.mascot-speech-bubble {
  background: var(--bg-card);
  border: 1px solid var(--primary);
  border-radius: 18px;
  padding: 12px 20px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-main);
  max-width: 380px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  margin-top: -12px;
  position: relative;
  z-index: 2;
}
.hero-title {
  font-size: 44px;
  font-weight: 900;
  letter-spacing: -1px;
  margin-bottom: 8px;
}
.hero-subtitle {
  font-size: 20px;
  color: var(--text-muted);
  margin-bottom: 30px;
}
.hero-actions {
  display: flex;
  gap: 16px;
  margin-bottom: 36px;
}
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.badge-item {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: #CBD5E1;
}

/* Map Screen */
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.header-center-info {
  text-align: center;
}
.screen-title {
  font-size: 24px;
  font-weight: 800;
}
.screen-subtitle {
  font-size: 14px;
  color: var(--text-muted);
}
.map-stars-summary {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  font-size: 16px;
  font-weight: 700;
}
.stars-counter {
  color: #FACC15;
  font-size: 18px;
}
.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.level-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}
.level-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.25);
}
.level-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.8);
}
.card-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--primary);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}
.card-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
}
.card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 16px;
  flex: 1;
}
.card-stars {
  font-size: 18px;
  margin-bottom: 14px;
}
.play-level-btn {
  background: #F59E0B;
  color: #041026;
  border: none;
  padding: 10px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}

/* Gameplay Screen */
.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.level-info {
  flex: 1;
}
.level-title {
  font-size: 20px;
  font-weight: 800;
}
.level-desc {
  font-size: 13px;
  color: var(--text-muted);
}
.game-top-actions {
  display: flex;
  gap: 8px;
}
.run-sim-btn {
  padding: 10px 20px;
  font-size: 14px;
}

/* Mascot Tip Bar */
.mascot-tip-bar.hidden { display: none; }
.mascot-tip-bar {
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid var(--primary);
  border-radius: 14px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.tip-mascot-icon {
  width: 32px;
  height: 32px;
}
.tip-text {
  flex: 1;
  font-size: 14px;
  color: #F8FAFC;
}
.close-tip-btn {
  background: transparent;
  border: none;
  color: #94A3B8;
  font-size: 16px;
  cursor: pointer;
}

/* Sandbox toolbar */
.sandbox-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  max-width: 900px;
}
.sandbox-toolbar .pill-btn { font-size: 14px; }
.sandbox-help {
  margin: 10px auto 0;
  max-width: 640px;
  text-align: center;
  font-size: 14px;
  opacity: 0.8;
}

.sandbox-toolbar .pill-btn.hidden { display: none; }
.sandbox-calc {
  margin: 12px auto 0;
  max-width: 640px;
  width: 100%;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid #334155;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 14px;
}
.sandbox-calc.hidden { display: none; }
.sandbox-calc .calc-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; flex-wrap: wrap; }
.sandbox-calc .calc-k { opacity: 0.75; }
.sandbox-calc .calc-v { font-weight: 800; font-variant-numeric: tabular-nums; }
.sandbox-calc .calc-total { border-top: 1px solid #334155; margin-top: 4px; padding-top: 6px; }
.sandbox-calc .calc-total.ok .calc-v { color: #86EFAC; }
.sandbox-calc .calc-total.warn .calc-v { color: #FBBF24; }
.sandbox-calc .calc-total.bad .calc-v { color: #F87171; }

/* Physics Workspace & Canvas */
.physics-workspace, .sandbox-workspace {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
}
.canvas-container {
  background: #0B1120;
  border: 2px solid #334155;
  border-radius: 24px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
}
.physics-svg {
  width: 600px;
  height: 420px;
  max-width: 100%;
  display: block;
}

/* Diploma Screen & Print styles */
.diploma-screen {
  align-items: center;
}
.diploma-topbar {
  width: 100%;
  max-width: 800px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}
.diploma-wrapper {
  max-width: 800px;
  width: 100%;
}
.diploma-card {
  background: #FDFBF7;
  color: #1E293B;
  border-radius: 24px;
  padding: 30px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
}
.diploma-border {
  border: 4px double #F59E0B;
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  position: relative;
}
.diploma-seal {
  font-size: 48px;
  display: block;
  margin-bottom: 10px;
}
.diploma-title {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #D97706;
  margin-bottom: 6px;
}
.diploma-badge {
  display: inline-block;
  background: #FEF3C7;
  color: #B45309;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 1.5px;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.diploma-desc {
  font-size: 16px;
  line-height: 1.6;
  color: #475569;
  max-width: 580px;
  margin: 0 auto 24px;
}
.diploma-field {
  margin-bottom: 24px;
}
.diploma-field label {
  display: block;
  font-weight: 700;
  font-size: 14px;
  color: #334155;
  margin-bottom: 6px;
}
.diploma-input {
  font-size: 24px;
  font-weight: 900;
  text-align: center;
  color: #D97706;
  background: transparent;
  border: none;
  border-bottom: 2px solid #F59E0B;
  padding: 6px 12px;
  outline: none;
  width: 80%;
  max-width: 380px;
}
.diploma-meta {
  display: flex;
  justify-content: space-around;
  margin-bottom: 30px;
  border-top: 1px solid #E2E8F0;
  border-bottom: 1px solid #E2E8F0;
  padding: 16px 0;
}
.meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.meta-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748B;
}
.meta-value {
  font-size: 16px;
  font-weight: 800;
  color: #0F172A;
}
.diploma-signature {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-top: 10px;
}
.sig-block {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.sig-mascot {
  width: 70px;
  height: 70px;
  margin-bottom: 6px;
}
.sig-title {
  font-weight: 800;
  font-size: 15px;
}
.sig-sub {
  font-size: 12px;
  color: #64748B;
}
.sig-seal-mark {
  border: 3px solid #D97706;
  border-radius: 50%;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 900;
  color: #D97706;
  transform: rotate(-15deg);
  opacity: 0.85;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal.hidden { display: none; }
.modal-card {
  background: var(--bg-card);
  border: 2px solid var(--primary);
  border-radius: 28px;
  padding: 40px;
  text-align: center;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-icon { font-size: 56px; margin-bottom: 12px; }
.modal-title { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.modal-desc { font-size: 15px; color: var(--text-muted); margin-bottom: 20px; }
.modal-stars { font-size: 36px; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 12px; justify-content: center; }

/* Print Media */
@media print {
  body { background: #FFF !important; }
  .app-header, .diploma-topbar, .speedguard-banner { display: none !important; }
  .screen:not(.diploma-screen) { display: none !important; }
  .diploma-screen { padding: 0 !important; }
  .diploma-card { box-shadow: none !important; border-radius: 0 !important; }
}

/* Κινητά: η μπάρα της αποστολής τυλίγεται (τίτλος πάνω, κουμπιά από κάτω) αντί να κόβεται */
@media (max-width: 600px) {
  .game-topbar { flex-wrap: wrap; gap: 10px; }
  .game-topbar .level-info { order: -1; flex: 1 1 100%; text-align: center; }
  .game-top-actions { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
}
