@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Space+Mono:wght@400;700&display=swap');

:root {
  --bg-dark: #090b11;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.08);
  
  /* Color Coding Elements */
  --color-grass: #10b981;
  --color-fire: #ef4444;
  --color-water: #3b82f6;
  --color-electric: #fbbf24;
  
  --color-success: #10b981;
  --color-error: #ef4444;
  
  --binder-leather: #1c1d24;
  --binder-page: #10121a;
  --zipper-border: #f59e0b; /* Yellow zipper accent */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* HEADER STYLE WITH USER CREDITS */
header {
  padding: 1rem 2rem;
  background: rgba(9, 11, 17, 0.9);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.title-container h1 {
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fcd34d 0%, #ef4444 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.title-container .credits {
  font-size: 0.85rem;
  color: #fbbf24;
  font-weight: 600;
  margin-top: 0.1rem;
}

.header-actions {
  display: flex;
  gap: 0.8rem;
}

.action-btn-header {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.action-btn-header:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* MAIN LAYOUT */
.app-container {
  flex: 1;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 1.5rem;
  padding: 1.5rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* LEFT COLUMN: MEJA KAYU REALISTIS */
.table-zone {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.table-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fbbf24;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cards-table {
  flex: 1;
  min-height: 580px;
  background: 
    radial-gradient(circle at center, rgba(0,0,0,0) 0%, rgba(0,0,0,0.55) 100%),
    repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(0,0,0,0.06) 40px, rgba(0,0,0,0.06) 80px),
    linear-gradient(to bottom, #44240f 0%, #251206 100%);
  border: 12px solid #1c0e05;
  border-radius: 20px;
  box-shadow: 
    inset 0 0 100px rgba(0, 0, 0, 0.95), 
    0 15px 35px rgba(0,0,0,0.7);
  position: relative;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  justify-content: center;
  align-content: flex-start;
  transition: all 0.3s;
}

.cards-table.drag-over {
  border-color: #fbbf24;
  box-shadow: 
    inset 0 0 60px rgba(251, 191, 36, 0.2), 
    0 15px 35px rgba(0,0,0,0.7);
}

.desk-mat {
  position: absolute;
  top: 15px; left: 15px; right: 15px; bottom: 15px;
  background: radial-gradient(circle, #1e293b 0%, #0f172a 100%);
  border: 3px solid rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  pointer-events: none;
  opacity: 0.12;
  z-index: 1;
}

/* REAL POKEMON CARD DESIGN */
.card-item {
  width: 110px;
  aspect-ratio: 2 / 2.78;
  border-radius: 6px;
  position: relative;
  cursor: grab;
  box-shadow: 0 6px 14px rgba(0,0,0,0.6);
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  overflow: hidden;
  background: #0d0f17;
  border: 1.5px solid rgba(255, 255, 255, 0.05);
  z-index: 2;
}

.card-item:active {
  cursor: grabbing;
}

.card-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.holo-shine {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(
    125deg,
    rgba(255, 255, 255, 0) 30%,
    rgba(255, 255, 255, 0.15) 40%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0.15) 60%,
    rgba(255, 255, 255, 0) 70%
  );
  background-size: 200% 200%;
  background-position: 0% 0%;
  mix-blend-mode: color-dodge;
  pointer-events: none;
  opacity: 0;
  z-index: 2;
  transition: opacity 0.3s;
}

.card-item:hover {
  transform: translateY(-8px) rotate(1.5deg) scale(1.05);
  box-shadow: 0 12px 24px rgba(0,0,0,0.7), 0 0 12px rgba(251, 191, 36, 0.25);
  border-color: #fbbf24;
}

.card-item:hover .holo-shine,
.card-item.selected .holo-shine {
  opacity: 0.85;
  animation: holoShift 2.5s infinite linear;
}

@keyframes holoShift {
  0% { background-position: 200% 200%; }
  100% { background-position: -200% -200%; }
}

.card-item.selected {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 0 0 3px #fbbf24, 0 8px 18px rgba(0,0,0,0.6);
  border-color: #fbbf24;
}

.card-item.held {
  position: absolute;
  z-index: 999;
  pointer-events: none;
  transform: scale(1.08) rotate(-2deg);
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.8);
  border: 2px dashed #fbbf24;
}

.card-item.stored-card {
  width: 100%;
  height: 100%;
  margin: 0;
  transform: none !important;
  box-shadow: none;
  border: none;
  border-radius: 4px;
  cursor: grab;
}
.card-item.stored-card:active {
  cursor: grabbing;
}


/* RIGHT COLUMN: BINDER ZONE */
.binder-zone {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.binder-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.binder-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #a78bfa;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* BINDER CONTAINER WITH DYNAMIC WIDTH */
.binder-container {
  height: 520px;
  position: relative;
  margin: 0 auto;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  width: 380px; /* Width when closed (single page size) */
  perspective: 2000px;
}

.binder-container.open {
  width: 780px; /* Width when open (double page size) */
}

/* CLOSED BINDER COVER (ZIPPER FOLDER VISUAL) */
.binder-cover-closed {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    radial-gradient(circle at center, rgba(255,255,255,0.03) 0%, rgba(0,0,0,0.4) 100%),
    repeating-linear-gradient(45deg, rgba(0,0,0,0.15), rgba(0,0,0,0.15) 2px, transparent 2px, transparent 4px),
    var(--binder-leather);
  border: 10px solid #14151a;
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: left center;
  z-index: 10;
  /* Yellow zipper accent strip around cover */
  outline: 4px solid var(--zipper-border);
  outline-offset: -10px;
  padding: 1.5rem;
}

.binder-cover-closed:hover {
  transform: scale(1.02) rotateY(-5deg);
  box-shadow: 0 30px 60px rgba(0,0,0,0.9), 0 0 25px rgba(245, 158, 11, 0.25);
}

.cover-logo-img {
  width: 190px;
  height: auto;
  object-fit: contain;
  margin-bottom: 0.2rem;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.4));
}

/* POKEBALL CSS MURNI */
.pokeball-css {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 8px solid #000;
  background: linear-gradient(to bottom, #ef4444 50%, #ffffff 50%);
  position: relative;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  margin: 0.8rem 0 1.2rem;
  overflow: hidden;
  animation: floatArt 3s infinite alternate ease-in-out;
}

.pokeball-css::before {
  content: '';
  position: absolute;
  top: calc(50% - 4px);
  left: 0;
  width: 100%;
  height: 8px;
  background: #000;
  z-index: 1;
}

.pokeball-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #ffffff;
  border: 8px solid #000;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.pokeball-button::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e2e8f0;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 1.5px solid #94a3b8;
}

@keyframes floatArt {
  0% { transform: translateY(0px) rotate(0deg); }
  100% { transform: translateY(-8px) rotate(2deg); }
}

.cover-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 0 3px 6px rgba(0,0,0,0.6);
  margin-bottom: 0.2rem;
}

.cover-subtitle {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--zipper-border);
  text-transform: uppercase;
  letter-spacing: 4px;
}

.zipper-puller {
  position: absolute;
  bottom: 20px;
  width: 14px;
  height: 36px;
  background: linear-gradient(to bottom, #cbd5e1, #475569);
  border-radius: 4px;
  border: 1px solid #1e293b;
  box-shadow: 0 4px 6px rgba(0,0,0,0.4);
  display: flex;
  justify-content: center;
  align-items: center;
}
.zipper-puller::after {
  content: '▼';
  font-size: 7px;
  color: #1e293b;
  font-weight: bold;
}

/* OPEN BINDER ALBUM */
.binder-album-open {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--binder-leather);
  border: 8px solid #15161b;
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.7);
  display: flex;
  transform-style: preserve-3d;
  opacity: 0;
  pointer-events: none;
  transition: all 0.5s ease;
  /* Yellow zipper accent showing inside folder edges */
  outline: 3px solid var(--zipper-border);
  outline-offset: -8px;
}

.binder-container.open .binder-cover-closed {
  transform: rotateY(-100deg);
  opacity: 0;
  pointer-events: none;
}

.binder-container.open .binder-album-open {
  opacity: 1;
  pointer-events: auto;
}

/* Spine & Steel Rings */
.binder-spine {
  width: 22px;
  background: linear-gradient(90deg, #090a0d 0%, #2d2f38 50%, #090a0d 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  padding: 2rem 0;
  z-index: 8;
  position: relative;
  box-shadow: 0 0 10px rgba(0,0,0,0.8);
}

.binder-ring {
  width: 32px;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 30%, #64748b 70%, #334155 100%);
  border: 1px solid #475569;
  box-shadow: 0 4px 6px rgba(0,0,0,0.5);
  margin-left: -5px;
  margin-right: -5px;
}

/* Binder Pages */
.binder-page {
  flex: 1;
  background: var(--binder-page);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.binder-page.left {
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
  box-shadow: inset -20px 0 30px rgba(0,0,0,0.6);
  border-right: 1px solid rgba(0,0,0,0.4);
}

.binder-page.right {
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
  box-shadow: inset 20px 0 30px rgba(0,0,0,0.6);
  border-left: 1px solid rgba(0,0,0,0.4);
}

.page-header {
  margin-bottom: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 0.4rem;
}

.page-header h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.page-header.grass h4 { color: var(--color-grass); }
.page-header.fire h4 { color: var(--color-fire); }
.page-header.water h4 { color: var(--color-water); }
.page-header.electric h4 { color: var(--color-electric); }

.page-number {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* 2x2 Grid for pockets */
.slots-grid-2x2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0.8rem;
  flex: 1;
}

/* Visual Pocket */
.binder-slot {
  background: rgba(255, 255, 255, 0.012);
  border: 1.5px dashed rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: all 0.25s;
  overflow: hidden;
  cursor: pointer;
  padding: 0.4rem;
}

.sleeve-gloss {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.05) 0%,
    rgba(255,255,255,0) 45%,
    rgba(255,255,255,0.03) 50%,
    rgba(255,255,255,0) 100%
  );
  pointer-events: none;
  z-index: 5;
}

.binder-slot:hover {
  background: rgba(255, 255, 255, 0.025);
  border-color: rgba(255, 255, 255, 0.2);
}

.binder-slot.highlight {
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.04);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.2);
}

.binder-slot.correct {
  border-style: solid;
  border-color: var(--color-success);
  background: rgba(16, 185, 129, 0.03);
}

.binder-slot.incorrect {
  border-style: solid;
  border-color: var(--color-error);
  background: rgba(239, 68, 68, 0.03);
}

.slot-icon {
  font-size: 1.6rem;
  opacity: 0.12;
  transition: opacity 0.3s;
}

.binder-slot.correct .slot-icon,
.binder-slot.incorrect .slot-icon {
  display: none;
}

.slot-text {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-top: 0.15rem;
  opacity: 0.3;
}

.binder-slot.correct .slot-text,
.binder-slot.incorrect .slot-text {
  display: none;
}

.slot-indicator {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.5rem;
  font-weight: 800;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  z-index: 6;
}

.binder-slot.correct .slot-indicator {
  background: rgba(16, 185, 129, 0.2);
  color: var(--color-success);
}

.binder-slot.incorrect .slot-indicator {
  background: rgba(239, 68, 68, 0.2);
  color: var(--color-error);
}

/* Navigation inside Binder Album page edges */
.binder-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid var(--border-color);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 10;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.binder-nav:hover {
  background: #fbbf24;
  color: #1e1b4b;
  border-color: #fbbf24;
}

.binder-nav.prev {
  left: -18px;
}
.binder-nav.next {
  right: -18px;
}

/* 3D PAGE FLIP SHEET OVERLAY */
.flip-leaf-overlay {
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: calc(50% - 11px);
  background: var(--binder-page);
  z-index: 7;
  transform-style: preserve-3d;
  box-shadow: inset 20px 0 30px rgba(0,0,0,0.6);
  backface-visibility: hidden;
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

.flip-leaf-overlay.flip-to-left {
  right: 8px;
  transform-origin: left center;
  animation: flipToLeftAnim 0.65s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.flip-leaf-overlay.flip-to-right {
  left: 8px;
  transform-origin: right center;
  animation: flipToRightAnim 0.65s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes flipToLeftAnim {
  0% {
    transform: rotateY(0deg);
    box-shadow: inset 20px 0 30px rgba(0,0,0,0.6);
  }
  50% {
    box-shadow: 0 15px 30px rgba(0,0,0,0.8);
  }
  100% {
    transform: rotateY(-180deg);
    box-shadow: inset -20px 0 30px rgba(0,0,0,0.6);
  }
}

@keyframes flipToRightAnim {
  0% {
    transform: rotateY(0deg);
    box-shadow: inset -20px 0 30px rgba(0,0,0,0.6);
  }
  50% {
    box-shadow: 0 15px 30px rgba(0,0,0,0.8);
  }
  100% {
    transform: rotateY(180deg);
    box-shadow: inset 20px 0 30px rgba(0,0,0,0.6);
  }
}


/* HUD PANEL / LOGGER LAYOUT */
.hud-zone {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
}

.hud-panel {
  background: rgba(15, 22, 42, 0.65);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  backdrop-filter: blur(16px);
  padding: 1.2rem;
}

.hud-panel h3 {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.4rem;
  margin-bottom: 0.8rem;
}

/* MAGNIFIER */
.magnifier-display {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.magnifier-card-art {
  width: 58px;
  aspect-ratio: 2 / 2.78;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.magnifier-card-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.magnifier-info {
  flex: 1;
}

.magnifier-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.magnifier-category {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  margin-top: 0.2rem;
}

.magnifier-rarity {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

/* CONTROLS HUD (Stacked Vertically) */
.controls-hud {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.control-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.65rem;
  border-radius: 6px;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
}

.control-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.control-btn:not(:disabled):hover {
  background: #fbbf24;
  color: #1e1b4b;
  border-color: #fbbf24;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}





/* WIN OVERLAY MODAL */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 17, 26, 0.85);
  backdrop-filter: blur(20px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.win-modal {
  background: linear-gradient(180deg, #1e1b4b 0%, #0c0a09 100%);
  border: 2px solid #fbbf24;
  border-radius: 20px;
  padding: 3rem;
  width: 90%;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(251, 191, 36, 0.2);
  transform: scale(0.8);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.show .win-modal {
  transform: scale(1);
}

.win-emoji {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: bounce 2s infinite;
}

.win-modal h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: #fff;
}

.win-modal p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

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

/* RESPONSIVE HACKS */
@media (max-width: 1050px) {
  .app-container {
    grid-template-columns: 1fr;
  }
}

.credit-close-btn:hover {
  color: #fff !important;
}
