:root {
  --bg-color: #2c3e50;
  --device-color: #1a1a1a;
  --device-highlight: #333;
  --screen-bg: #9ea792; /* Classic LCD green/grey */
  --screen-text: #1a1a1a;
  --paper-color: #fdfbf7;
  --accent-color: #e74c3c;
  --led-color: #2ecc71;
}

* {
  box-sizing: border-box;
  user-select: none; /* Prevent text selection for better drag experience */
}

body, html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'VT323', monospace;
  background-color: var(--bg-color);
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.desk-surface {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  z-index: 0;
  pointer-events: none;
}

.instructions {
  position: absolute;
  top: 20px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.2rem;
  text-align: center;
  z-index: 10;
  letter-spacing: 1px;
}

.key {
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

/* --- Beeper Device Styling --- */
.beeper-container {
  position: relative;
  z-index: 100; /* Above papers initially */
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.5));
}

.beeper-case {
  width: 320px;
  height: 200px;
  background-color: var(--device-color);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 
    inset 0 2px 5px rgba(255,255,255,0.1),
    inset 0 -5px 10px rgba(0,0,0,0.5);
  border-bottom: 6px solid #000;
  position: relative;
}

.brand-logo {
  color: #555;
  font-family: sans-serif;
  font-weight: bold;
  font-size: 10px;
  margin-bottom: 5px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.screen-bezel {
  background-color: #000;
  padding: 10px 15px;
  border-radius: 6px;
  margin-bottom: 15px;
  box-shadow: inset 0 0 5px #222;
}

.screen {
  background-color: var(--screen-bg);
  height: 50px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 24px;
  color: var(--screen-text);
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
  overflow: hidden;
  white-space: nowrap;
  font-family: 'VT323', monospace;
  position: relative;
}

/* Scanline effect */
.screen::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.05),
    rgba(0, 0, 0, 0.05) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
}

.cursor {
  animation: blink 1s step-end infinite;
  margin-left: 2px;
  opacity: 0.8;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.btn-group {
  display: flex;
  gap: 10px;
}

.beeper-btn {
  width: 40px;
  height: 20px;
  border: none;
  background: #333;
  border-radius: 4px;
  color: #777;
  font-size: 8px;
  cursor: pointer;
  box-shadow: 0 2px 0 #000;
  transition: transform 0.1s, box-shadow 0.1s;
}

.beeper-btn:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 #000;
}

.nav-pad {
  display: flex;
  gap: 5px;
}

.arrow-btn {
  width: 0; 
  height: 0; 
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  cursor: pointer;
  opacity: 0.5;
}

.arrow-btn.left {
  border-right: 12px solid #333;
}
.arrow-btn.right {
  border-left: 12px solid #333;
}

.arrow-btn:active {
  opacity: 1;
}

.action-btn {
  background-color: var(--accent-color);
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  font-family: sans-serif;
  font-size: 10px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 3px 0 #c0392b;
  text-transform: uppercase;
  transition: transform 0.1s, box-shadow 0.1s;
}

.action-btn:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 #c0392b;
}

.printer-slot {
  position: absolute;
  bottom: -12px; /* Slightly hidden below */
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  height: 10px;
  background: #000;
  border-radius: 0 0 5px 5px;
  z-index: 50;
}

/* --- Generated Paper Card --- */
#paper-area {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 90; /* Below beeper but above bg */
  pointer-events: none; /* Let clicks pass through empty areas */
}

.paper-card {
  position: absolute;
  background-color: var(--paper-color);
  padding: 15px 20px;
  min-width: 150px;
  max-width: 300px;
  color: #222;
  font-family: 'VT323', monospace;
  font-size: 20px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transform-origin: center center;
  pointer-events: auto; /* Enable interaction */
  cursor: grab;
  /* Thermal paper look */
  border-top: 1px dashed #ccc;
  border-bottom: 1px dashed #ccc;
  overflow-wrap: break-word;
  line-height: 1.2;
  transition: box-shadow 0.2s;
}

.paper-card:active {
  cursor: grabbing;
  box-shadow: 0 10px 20px rgba(0,0,0,0.3);
  z-index: 1000 !important; /* Bring to front when dragging */
}

/* Class to allow smooth movement when auto-stacking */
.paper-card.animating {
  transition: top 0.6s cubic-bezier(0.25, 1, 0.5, 1), 
              left 0.6s cubic-bezier(0.25, 1, 0.5, 1), 
              transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Completed State */
.paper-card.completed {
  color: #888;
  background-color: #f4f4f4;
}

.paper-content {
  position: relative;
  display: inline-block;
}

/* The handwritten strike-through effect */
.paper-card.completed .paper-content::after {
  content: "";
  position: absolute;
  left: -5%;
  top: 50%;
  width: 110%;
  height: 2px;
  background: #c0392b; /* Red ink */
  transform: rotate(-2deg) translateY(-50%);
  box-shadow: 0 0 2px rgba(192, 57, 43, 0.5);
  pointer-events: none;
  opacity: 0.8;
}

.paper-timestamp {
  display: block;
  font-size: 12px;
  color: #888;
  margin-top: 8px;
  text-align: right;
  border-top: 1px solid #eee;
  padding-top: 4px;
}

/* Print Animation Class */
@keyframes printOut {
  0% {
    transform: translate(-50%, -100px) scale(0.9);
    opacity: 0;
  }
  100% {
    transform: translate(-50%, 0) scale(1);
    opacity: 1;
  }
}

.printing {
  animation: printOut 0.6s ease-out forwards;
}
