/* Αβακάκηδες · Abacus Masters Stylesheet */
@font-face {
  font-family: 'Ubuntu Sans';
  font-weight: 400 800;
  src: url('assets/fonts/ubuntu-sans-greek-wght-normal.woff2') format('woff2');
  unicode-range: U+0370-03FF, U+1F00-1FFF;
}
@font-face {
  font-family: 'Ubuntu Sans';
  font-weight: 400 800;
  src: url('assets/fonts/ubuntu-sans-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153;
}

:root {
  --bg-dark: #1C1917;
  --bg-panel: #292524;
  --bg-card: #292524;
  --primary: #D97706;
  --primary-hover: #B45309;
  --accent: #FBBF24;
  --text-main: #F8FAFC;
  --text-muted: #A8A29E;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-family: 'Ubuntu Sans', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* SpeedGuard Red Warning Banner */
.speed-guard-banner {
  background: linear-gradient(90deg, #DC2626 0%, #B91C1C 100%);
  color: #FFFFFF;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 14px;
  z-index: 9999;
  border-bottom: 2px solid #EF4444;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}
.speed-guard-banner .sg-icon { font-size: 20px; }
.speed-guard-banner .sg-text { display: flex; flex-direction: column; }
.speed-guard-banner strong { font-weight: 800; }

.hidden { display: none !important; }

/* Main App Wrapper */
.app-container {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Top App Header */
.app-header {
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(28, 25, 23, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hub-link {
  color: #FDE68A;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
}
.header-sep { color: #78716C; }
.brand-title {
  font-size: 16px;
  font-weight: 800;
  color: #FFFFFF;
}
.header-controls {
  display: flex;
  gap: 10px;
}
.pill-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.pill-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}
.lang-btn { font-weight: 800; color: #FDE68A; }

/* Screens Base */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 20px 24px;
}

/* 1. Home Screen */
.home-screen {
  justify-content: center;
  align-items: center;
  text-align: center;
}
.home-hero {
  max-width: 580px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.mascot-wrapper {
  position: relative;
  margin-bottom: 24px;
}
.hero-mascot {
  width: 190px;
  height: 190px;
  filter: drop-shadow(0 15px 25px rgba(217, 119, 6, 0.3));
  animation: floatMascot 4s ease-in-out infinite alternate;
}
@keyframes floatMascot {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}
.mascot-speech-bubble {
  position: absolute;
  top: -15px;
  right: -130px;
  background: #78350F;
  border: 2px solid #D97706;
  color: #FFFFFF;
  padding: 12px 18px;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 600;
  max-width: 200px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}
.hero-title {
  font-size: 44px;
  font-weight: 900;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #FFFFFF 0%, #FDE68A 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-subtitle {
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 32px;
}
.hero-actions {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}
.action-btn {
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
}
.primary-btn {
  background: linear-gradient(135deg, #D97706 0%, #B45309 100%);
  color: #FFFFFF;
}
.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 25px -4px rgba(217, 119, 6, 0.45);
}
.secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}
.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-2px);
}
.text-link-btn {
  background: none;
  border: none;
  color: #FBBF24;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.text-link-btn:hover { color: #FDE68A; }

/* 2. Map Screen */
.screen-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.screen-title {
  font-size: 24px;
  font-weight: 900;
  color: #FFFFFF;
}
.nav-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.nav-btn:hover { background: rgba(255, 255, 255, 0.15); }
.primary-nav-btn {
  background: #D97706;
  border-color: #B45309;
}
.primary-nav-btn:hover { background: #B45309; }
.map-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}
.mission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}
.mission-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.mission-card:hover {
  transform: translateY(-4px);
  border-color: rgba(217, 119, 6, 0.5);
  box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.4);
}
.sandbox-card {
  border-color: rgba(251, 191, 36, 0.3);
  background: linear-gradient(180deg, #292524 0%, #1C1917 100%);
}
.card-icon {
  font-size: 38px;
  margin-bottom: 8px;
}
.card-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 6px;
  color: #FFFFFF;
}
.card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 12px;
  flex: 1;
}
.card-stars {
  display: flex;
  gap: 4px;
}
.card-stars .star {
  font-size: 18px;
  color: #57534E;
}
.card-stars .star.earned {
  color: #FACC15;
  filter: drop-shadow(0 0 4px rgba(250, 204, 21, 0.6));
}
.sandbox-tag {
  font-size: 12px;
  font-weight: 800;
  color: #FBBF24;
  background: rgba(251, 191, 36, 0.15);
  padding: 4px 10px;
  border-radius: 999px;
}

/* 3. Game Screen & Board */
.game-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.mission-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 16px;
  border-radius: 999px;
}
.mission-name {
  font-weight: 800;
  color: #FDE68A;
  font-size: 15px;
}
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.timer-badge {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #FCA5A5;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tool-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.tool-btn:hover { background: rgba(255, 255, 255, 0.15); }
.reset-btn { background: rgba(244, 63, 94, 0.15); border-color: rgba(244, 63, 94, 0.3); color: #FDA4AF; }

.challenge-bar {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.challenge-prompt-text {
  font-size: 18px;
  font-weight: 800;
  color: #FFFFFF;
}
.challenge-stats {
  display: flex;
  gap: 12px;
}
.stat-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.stat-lbl {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
}
.stat-num {
  font-size: 18px;
  font-weight: 900;
  color: #FFFFFF;
}
.target-num { color: #FBBF24; font-size: 20px; }
.current-pill { border-color: rgba(217, 119, 6, 0.4); }

.board-wrapper {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #141210;
  border-radius: var(--radius-lg);
  border: 2px solid #78350F;
  overflow: hidden;
  box-shadow: 0 16px 36px -10px rgba(0, 0, 0, 0.6);
  position: relative;
}
#abacusSvg {
  width: 100%;
  height: 100%;
  max-height: 480px;
  display: block;
}

/* 4. Diploma Screen */
.diploma-screen {
  align-items: center;
}
.diploma-form-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.diploma-form-bar label {
  font-weight: 700;
  font-size: 14px;
}
.diploma-form-bar input {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  outline: none;
}
.diploma-form-bar input:focus {
  border-color: var(--primary);
}

.diploma-card {
  width: 100%;
  max-width: 760px;
  background: #FFFBEB;
  color: #1E293B;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}
.diploma-border {
  border: 4px double #B45309;
  border-radius: var(--radius-md);
  padding: 36px 40px;
  text-align: center;
  position: relative;
}
.diploma-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.diploma-brand {
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 2px;
  color: #92400E;
}
.diploma-badge-pill {
  background: #F59E0B;
  color: #451A03;
  font-weight: 900;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  letter-spacing: 1px;
}
.diploma-title {
  font-size: 32px;
  font-weight: 900;
  color: #78350F;
  margin-bottom: 12px;
  letter-spacing: 1px;
}
.diploma-presents {
  font-size: 15px;
  color: #4B5563;
  margin-bottom: 24px;
}
.diploma-name-box {
  border-bottom: 2px solid #B45309;
  padding: 10px 20px;
  margin-bottom: 28px;
  display: inline-block;
  min-width: 280px;
}
#diplomaChildName {
  font-size: 32px;
  font-weight: 800;
  color: #9A3412;
  font-style: italic;
}
.diploma-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 30px;
}
.stat-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-label {
  font-size: 12px;
  font-weight: 700;
  color: #6B7280;
}
.stat-val {
  font-size: 16px;
  font-weight: 800;
  color: #1F2937;
}
.diploma-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 10px;
}
.diploma-seal {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle, #F59E0B 0%, #B45309 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(180, 83, 9, 0.4);
}
.seal-inner {
  font-size: 9px;
  font-weight: 900;
  color: #FFFFFF;
  text-align: center;
  letter-spacing: 0.5px;
}
.diploma-mascot {
  width: 90px;
  height: 90px;
}

/* Victory Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popIn {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.modal-icon { font-size: 52px; margin-bottom: 12px; }
.modal-title { font-size: 28px; font-weight: 900; margin-bottom: 8px; color: #FFFFFF; }
.modal-desc { font-size: 15px; color: var(--text-muted); margin-bottom: 20px; }
.modal-stars {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}
.modal-star {
  font-size: 38px;
  color: #57534E;
}
.modal-star.earned {
  color: #FACC15;
  filter: drop-shadow(0 0 10px rgba(250, 204, 21, 0.7));
  animation: starPulse 0.5s ease;
}
@keyframes starPulse {
  0% { transform: scale(0.5); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.modal-actions {
  display: flex;
  gap: 12px;
}
.modal-actions .action-btn { flex: 1; }

/* Print Styles */
@media print {
  body { background: #FFFFFF; color: #000; }
  .app-header, .speed-guard-banner, .screen-bar, .diploma-form-bar { display: none !important; }
  .diploma-card { box-shadow: none; max-width: 100%; width: 100%; border: none; }
}
