* {
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Terminal Window */
.terminal-window {
  background: #1e1e2e;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  margin-bottom: 30px;
  overflow: hidden;
  border: 1px solid #333;
}

.window-header {
  background: linear-gradient(90deg, #2a2a3e 0%, #3a3a5e 100%);
  padding: 10px 15px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #444;
}

.window-controls {
  display: flex;
  gap: 8px;
  margin-right: 15px;
}

.control {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.control.close {
  background: #ff5f57;
}

.control.minimize {
  background: #ffbd2e;
}

.control.maximize {
  background: #28ca42;
}

.control:hover {
  opacity: 0.8;
  transform: scale(1.1);
}

.window-title {
  color: #e0e0e0;
  font-weight: 600;
  font-size: 14px;
  flex-grow: 1;
  text-align: center;
}

.window-content {
  padding: 20px;
  background: #0f0f23;
  font-family: 'JetBrains Mono', monospace;
  color: #00d4ff;
  position: relative;
  min-height: 200px;
}

.cursor {
  display: inline-block;
  width: 1ch;
  background: #00d4ff;
  animation: blink 1s step-start infinite;
}

@keyframes blink {
  50% { background: transparent; }
}

/* Panel Section */
#panel {
  text-align: center;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  align-items: start;
}

.main-content {
  display: flex;
  flex-direction: column;
}

#panel h1 {
  font-size: 3rem;
  margin-bottom: 10px;
  background: linear-gradient(45deg, #00d4ff, #0099cc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
  font-weight: 700;
}

.subtitle {
  font-size: 1.2rem;
  color: #b8c5d6;
  margin-bottom: 40px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Blocks Grid */
.blocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
  perspective: 1000px;
}

.block {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.8) 0%, rgba(30, 41, 59, 0.8) 100%);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 16px;
  padding: 25px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(30px) rotateX(15deg);
  animation: slideInUp 0.8s ease forwards, float 6s ease-in-out infinite;
  min-height: 120px;
}

.block:nth-child(odd) {
  animation-delay: var(--float-delay);
}

.block:nth-child(even) {
  animation-delay: calc(var(--float-delay) + 3s);
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-3px); }
}

@keyframes slideInUp {
  to {
    opacity: 1;
    transform: translateY(0) rotateX(0deg);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.block::before {
  display: none;
}

.block:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 8px 30px rgba(0, 212, 255, 0.15) !important;
  border-color: rgba(0, 212, 255, 0.4) !important;
}

.block-icon {
  font-size: 2.2rem;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.block:hover .block-icon {
  transform: scale(1.1) rotate(5deg);
  filter: drop-shadow(0 0 10px rgba(0, 255, 136, 0.5));
}

.block-content {
  text-align: center;
  color: #e2e8f0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  width: 100%;
  transition: all 0.3s ease;
  word-break: break-word;
  overflow-wrap: break-word;
}

.block:hover .block-content {
  color: #00d4ff;
}

/* Warning */
.warning {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(245, 158, 11, 0.1) 100%);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 15px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 30px;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.1);
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease forwards 0.6s;
}

.warning-text {
  text-align: left;
  color: #fca5a5;
  font-weight: 500;
  line-height: 1.4;
}

.copyable {
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 2px 4px;
  border-radius: 3px;
}

.copyable:hover {
  background: rgba(0, 212, 255, 0.1);
  color: #00d4ff;
}

/* Time Visualization */
.time-visualization {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.time-drain {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.drain-container {
  position: relative;
  width: 40px;
  height: 120px;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.8) 100%);
  border: 2px solid rgba(0, 212, 255, 0.3);
  border-radius: 20px 20px 8px 8px;
  overflow: hidden;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
}

.drain-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0%;
  background: linear-gradient(to top, #00d4ff, #0099cc, #0066aa);
  border-radius: 0 0 6px 6px;
  transition: height 0.5s ease, background 0.5s ease, box-shadow 0.5s ease;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
  animation: normalFlow 2s ease-in-out infinite;
}

@keyframes normalFlow {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(1.02); }
}

@keyframes cautionPulse {
  0%, 100% { transform: scaleY(1); opacity: 1; }
  50% { transform: scaleY(1.05); opacity: 0.9; }
}

@keyframes warningPulse {
  0%, 100% { transform: scaleY(1); opacity: 1; }
  50% { transform: scaleY(1.08); opacity: 0.8; }
}

@keyframes criticalPulse {
  0%, 100% { transform: scaleY(1); opacity: 1; }
  50% { transform: scaleY(1.1); opacity: 0.7; }
}

.drain-marks {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
}

.drain-mark {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(0, 212, 255, 0.2);
}

.drain-labels {
  position: absolute;
  left: -35px;
  top: 0;
  bottom: 0;
  width: 30px;
}

.drain-label {
  position: absolute;
  right: 5px;
  font-size: 8px;
  color: rgba(0, 212, 255, 0.6);
  font-family: 'JetBrains Mono', monospace;
  transform: translateY(50%);
}

.time-display-drain {
  text-align: center;
  flex: 1;
}

.current-session {
  font-size: 2.2rem;
  font-weight: 700;
  color: #00d4ff;
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 5px;
}

.session-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 15px;
  font-family: 'Inter', sans-serif;
}

.total-wasted {
  font-size: 1.8rem;
  font-weight: 600;
  color: #ffaa44;
  text-shadow: 0 0 8px rgba(255, 170, 68, 0.4);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 5px;
}

.wasted-label {
  font-size: 0.7rem;
  color: rgba(255, 170, 68, 0.7);
  font-family: 'Inter', sans-serif;
}

.time-stats {
  display: flex;
  gap: 15px;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
}

.stat {
  background: rgba(0, 212, 255, 0.1);
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0, 212, 255, 0.2);
}

/* Confetti Animation */
.confetti {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: confettiFall linear forwards;
  pointer-events: none;
  z-index: 1000;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-10px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(200px) rotate(720deg);
    opacity: 0;
  }
}

/* Floating Thoughts */
.floating-thought {
  position: absolute;
  background: rgba(0, 20, 40, 0.85);
  color: rgba(0, 212, 255, 0.9);
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  border: 1px solid rgba(0, 212, 255, 0.3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 212, 255, 0.2);
  animation: thoughtFloat 4s ease-out forwards;
  pointer-events: none;
  z-index: 100;
  max-width: 220px;
  text-align: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

@keyframes thoughtFloat {
  0% {
    transform: translateY(0) scale(0.8);
    opacity: 0;
    filter: blur(2px);
  }
  10% {
    transform: translateY(-5px) scale(1);
    opacity: 1;
    filter: blur(0px);
  }
  85% {
    transform: translateY(-25px) scale(1);
    opacity: 1;
    filter: blur(0px);
  }
  100% {
    transform: translateY(-35px) scale(0.9);
    opacity: 0;
    filter: blur(1px);
  }
}

@keyframes particleBurst {
  0% {
    opacity: 1;
    transform: scale(1) translate(0, 0);
  }
  100% {
    opacity: 0;
    transform: scale(0) translate(var(--tx), var(--ty));
  }
}

@keyframes celebrationShake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
  20%, 40%, 60%, 80% { transform: translateX(2px); }
}

/* Achievements Sidebar */
.achievements-sidebar {
  width: 320px;
  background: rgba(0, 20, 40, 0.8);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid rgba(0, 212, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.achievements-sidebar h2 {
  color: #00d4ff;
  font-size: 1.5rem;
  margin-bottom: 20px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
}

.achievements-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.achievement {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 212, 255, 0.1);
}

.achievement.locked {
  background: rgba(30, 41, 59, 0.3);
  opacity: 0.6;
  filter: grayscale(100%);
}

.achievement.unlocked {
  background: rgba(0, 212, 255, 0.1);
  border-color: rgba(0, 212, 255, 0.4);
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
  animation: achievementUnlock 0.5s ease-out;
}

.achievement-icon {
  font-size: 1.5rem;
  width: 40px;
  text-align: center;
}

.achievement-content {
  flex: 1;
}

.achievement-title {
  font-weight: 600;
  color: #00d4ff;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.achievement-desc {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 8px;
}

.achievement-progress {
  margin-top: 8px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00d4ff, #0099cc);
  border-radius: 3px;
  transition: width 0.5s ease;
  width: 0%;
}

.achievement.unlocked .progress-fill {
  background: linear-gradient(90deg, #00ff88, #00cc66);
}

.progress-text {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
  text-align: right;
}

@keyframes achievementUnlock {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Away Overlay */
#away-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 20, 40, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  animation: fadeIn 1.2s ease-out;
}

.away-content {
  text-align: center;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 212, 255, 0.5);
  border-radius: 16px;
  padding: 25px;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  animation: slideUp 0.8s ease-out 0.3s both;
  position: relative;
}

.away-emoji {
  font-size: 3.5rem;
  margin-bottom: 12px;
  animation: subtleBounce 3s ease-in-out infinite;
}

.away-title {
  font-size: 2rem;
  color: #374151;
  font-weight: 500;
  margin-bottom: 8px;
  text-shadow: none;
  font-family: 'Inter', sans-serif;
}

.away-message {
  font-size: 1.2rem;
  color: #6b7280;
  margin-bottom: 12px;
  font-weight: 400;
  font-style: italic;
}

.away-timer {
  font-size: 1.1rem;
  color: #9ca3af;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
}

.away-warning {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  font-size: 0.9rem;
  color: #ff6666;
  animation: warningFlash 1s ease-in-out infinite;
  font-weight: bold;
}

/* Return Animation Overlay */
#return-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 20, 40, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: fadeIn 1.2s ease-out;
}

.return-content {
  text-align: center;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 212, 255, 0.5);
  border-radius: 16px;
  padding: 25px;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  animation: slideUp 0.8s ease-out 0.3s both;
  position: relative;
}

.return-emoji {
  font-size: 3.5rem;
  margin-bottom: 12px;
  animation: subtleBounce 3s ease-in-out infinite;
}

.return-title {
  font-size: 2rem;
  color: #374151;
  font-weight: 500;
  margin-bottom: 8px;
  text-shadow: none;
  font-family: 'Inter', sans-serif;
}

.return-message {
  font-size: 1.2rem;
  color: #6b7280;
  margin-bottom: 12px;
  font-weight: 400;
  font-style: italic;
}

@keyframes dangerPulse {
  0% { opacity: 0.9; }
  100% { opacity: 1; }
}

@keyframes backgroundShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes contentShake {
  0% { transform: translateX(-1px) translateY(-1px); }
  100% { transform: translateX(1px) translateY(1px); }
}

@keyframes borderGlow {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

@keyframes emojiPanic {
  0% { transform: scale(1) rotate(-2deg); }
  100% { transform: scale(1.1) rotate(2deg); }
}

@keyframes textGlow {
  0% { text-shadow: 0 0 10px rgba(255, 0, 0, 0.8), 0 0 20px rgba(255, 0, 0, 0.6), 0 0 30px rgba(255, 0, 0, 0.4); }
  100% { text-shadow: 0 0 15px rgba(255, 0, 0, 1), 0 0 30px rgba(255, 0, 0, 0.8), 0 0 45px rgba(255, 0, 0, 0.6); }
}

@keyframes timerPulse {
  0% { color: #ffaa44; }
  100% { color: #ffdd66; }
}

@keyframes warningFlash {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.3; }
}

@keyframes returnExplosion {
  0% {
    opacity: 0;
    transform: scale(0.5);
    filter: blur(10px);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
    filter: blur(5px);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0px);
  }
}

@keyframes returnBounce {
  0% { transform: translateY(50px) scale(0.8); opacity: 0; }
  60% { transform: translateY(-10px) scale(1.05); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes returnSparkle {
  0% { transform: scale(0) rotate(180deg); opacity: 0; }
  50% { transform: scale(1.2) rotate(90deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes returnGlow {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Toast notification */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #00d4ff, #0099cc);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

/* Responsive */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  #panel h1 {
    font-size: 2rem;
  }

  .blocks-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .block {
    min-height: 110px;
    padding: 22px;
  }

  .block-icon {
    font-size: 2rem;
  }

  .block-content {
    font-size: 0.8rem;
  }

  .warning {
    flex-direction: column;
    text-align: center;
  }

  .warning-text {
    text-align: center;
  }
}

/* Responsive Layout */
@media (max-width: 1200px) {
  #panel {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 0 10px;
  }

  .achievements-sidebar {
    width: 100%;
    order: -1; /* Move sidebar above main content on mobile */
  }

  .achievements-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
  }
}

@media (max-width: 768px) {
  .achievements-list {
    grid-template-columns: 1fr;
  }

  .achievement {
    padding: 10px;
  }

  .achievement-title {
    font-size: 0.85rem;
  }

  .achievement-desc {
    font-size: 0.75rem;
  }

  .progress-text {
    font-size: 0.65rem;
  }
}
