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

.card-panel {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

.interactive-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--shadow);
}

/* Deck Info */
.deck-info {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--surface-2) 0%, var(--surface) 100%);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.info-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

.info-item i {
  font-size: 1.4rem;
  color: var(--primary);
  filter: drop-shadow(0 2px 4px rgba(106, 167, 255, 0.3));
}

.info-item span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.info-item strong {
  color: var(--text);
  font-size: 1.4rem;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Card Display */
.card-display {
  min-height: 300px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  align-items: center;
  padding: 32px;
  background: linear-gradient(135deg, var(--surface-2) 0%, var(--surface) 100%);
  border-radius: 20px;
  border: 2px dashed var(--border);
  margin-bottom: 32px;
  position: relative;
  overflow: visible;
}

.card-placeholder {
  text-align: center;
  color: var(--muted);
  animation: placeholder-float 3s ease-in-out infinite;
}

@keyframes placeholder-float {
  0%, 100% {
    opacity: 0.6;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

.card-placeholder i {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.5;
  display: block;
  color: var(--primary);
  filter: drop-shadow(0 4px 8px rgba(106, 167, 255, 0.2));
}

@keyframes icon-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.card-placeholder p {
  font-size: 1.1rem;
  margin: 0;
  font-weight: 500;
}

/* Playing Card - Modern Clean Style */
.playing-card {
    width: 120px;
    height: 168px;
  background: #ffffff;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  position: relative;
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.08),
    0 1px 3px rgba(0, 0, 0, 0.05);
  animation: card-appear 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  overflow: hidden;
  font-family: 'Outfit', 'Pretendard', sans-serif;
  user-select: none;
  border: 1px solid rgba(0,0,0,0.06);
}

.playing-card::before {
  content: ''; /* Subtle top shine */
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(180deg, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 100%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

.playing-card:hover {
  transform: translateY(-8px);
  box-shadow: 
    0 14px 28px rgba(0,0,0,0.12),
    0 10px 10px rgba(0,0,0,0.08);
  z-index: 10;
}

@keyframes card-appear {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.playing-card.red {
  color: #FF4757; /* Modern bright red */
}

.playing-card.black {
  color: #2F3542; /* Modern dark grey */
}

.card-corner {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  z-index: 1;
}

.card-corner-top {
  text-align: left;
  display: flex;
  flex-direction: column;
    align-items: flex-start;
  gap: 2px;
}

.card-corner-bottom {
  text-align: right;
  transform: rotate(180deg);
  display: flex;
  flex-direction: column;
    align-items: flex-start;
  gap: 2px;
}

.card-suit {
  font-size: 1.2rem;
  text-align: center;
  margin: auto 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  line-height: 1;
}

/* Joker Card Special Design */
.joker-card {
  background: #ffffff;
}

.joker-card.red {
  color: #FF4757;
  background: linear-gradient(180deg, #ffffff 0%, #ffe1e4 100%);
}

.joker-card.black {
  color: #2F3542;
  background: linear-gradient(180deg, #ffffff 0%, #dfecfd 100%);
}

.joker-card .card-suit.joker-text {
  display: none; /* Hide old text joker */
}

/* Face Card Content */
.face-card-content {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}

.face-card-content svg {
  width: 78%;
  height: 78%;
  max-width: 94px;
  max-height: 128px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
  overflow: visible;
}

.number-card-content {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
}

.number-card-content .card-suit {
  font-size: 1.8rem;
  line-height: 1;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,0.1));
}


/* Control Panel */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
  padding: 12px 20px;
  border-radius: 12px;
  background: var(--surface-2);
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.checkbox-label:hover {
  background: var(--surface);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateX(4px);
}

.checkbox-label input[type="checkbox"] {
  width: 24px;
  height: 24px;
  cursor: pointer;
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 6px;
  transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked {
  background: linear-gradient(135deg, var(--primary) 0%, #5891ff 100%);
  border-color: var(--primary);
}

.checkbox-label input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  color: white;
  font-size: 16px;
  font-weight: bold;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  animation: checkmark 0.3s ease;
}

@keyframes checkmark {
  0% {
    transform: translate(-50%, -50%) scale(0);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

.control-group label {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.input-with-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-with-buttons input {
  flex: 1;
  max-width: 200px;
  padding: 14px 20px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.input-with-buttons input:hover {
  border-color: var(--primary);
}

.input-with-buttons input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 
    0 0 0 3px rgba(106, 167, 255, 0.1),
    0 2px 8px rgba(0, 0, 0, 0.05);
  transform: scale(1.02);
}

.input-with-buttons .pill-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.control-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.pill-btn {
  background: linear-gradient(135deg, var(--surface-2) 0%, var(--chip) 100%);
  color: var(--text);
  border: 2px solid var(--border);
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.pill-btn:hover {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(106, 167, 255, 0.15);
}

.pill-btn:active {
  transform: translateY(0);
}

/* History Section */
.history-section {
  margin-top: 32px;
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.history-toggle {
  width: 100%;
  background: linear-gradient(135deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 2px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.history-toggle:hover {
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(106, 167, 255, 0.2);
}

.history-toggle i {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
  color: var(--primary);
  filter: drop-shadow(0 2px 4px rgba(106, 167, 255, 0.3));
}

.history-section:not(.collapsed) .history-toggle i {
  transform: rotate(180deg);
}

.history-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.history-section:not(.collapsed) .history-content {
  max-height: 600px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  margin-bottom: 16px;
}

.history-header h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.text-btn {
  background: transparent;
  border: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.text-btn:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
  transform: translateY(-2px);
}

.text-btn:active {
  transform: translateY(0);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
}

.history-item {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 20px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border-radius: 16px;
  border: 2px solid var(--border);
  align-items: center;
    justify-content: space-between;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.history-item:hover {
  transform: translateX(4px);
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(106, 167, 255, 0.15);
}

.history-item .playing-card {
  width: 65px;
  height: 91px;
  font-size: 0.7rem;
  flex-shrink: 0;
  padding: 4px; 
  border-radius: 6px;
  box-shadow: 
    0 1px 3px rgba(0, 0, 0, 0.12),
    0 2px 4px rgba(0, 0, 0, 0.08);
}

.history-item .playing-card .face-card-content,
.history-item .playing-card .joker-content {
  opacity: 1;
}

/* Adjust Face Card/Joker SVGs in History */
.history-item .face-card-content svg {
  width: auto;
  height: 28px;
  max-width: 34px;
}

.history-item .joker-card .face-card-content svg {
  height: 32px;
  max-width: 38px;
}

.history-item .playing-card::before {
  top: 3px;
  left: 3px;
  right: 3px;
  bottom: 3px;
  border-radius: 4px;
}

.history-item .playing-card:hover {
  transform: none; /* No hover effect for history cards to keep layout stable */
}

.history-item .number-card-content {
  position: relative;
  transform: none;
  top: auto;
  left: auto;
}

.history-item .number-card-content .card-suit {
  font-size: 1rem; /* Adjusted to approximate visual weight of SVGs */
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

.history-item .card-corner {
  font-size: 0.6rem;
}

.history-item .joker-card {
  background: #ffffff;
}

.history-item .joker-card .card-suit.joker-text {
  font-size: 0.5rem;
  transform: translate(-50%, -50%) rotate(-45deg);
}

.history-item .joker-card .card-corner {
  font-size: 0.8rem;
}

.history-empty {
  text-align: center;
  color: var(--muted);
  padding: 32px;
  font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 768px) {
  .interactive-card {
    padding: 24px 16px;
  }

  .deck-info {
    gap: 12px;
  }

  .info-item {
    padding: 10px 16px;
  }

  .card-display {
    min-height: 240px;
    padding: 20px;
  }

  .playing-card {
    width: 80px;
    height: 112px;
    padding: 8px;
  }

  .card-suit {
    font-size: 1rem;
  }
  
  .number-card-content .card-suit {
    font-size: 2.2rem;
  }
  
  .card-corner {
    font-size: 0.85rem;
  }

  .control-actions {
    flex-direction: column;
  }

  .primary-btn {
    min-width: 100%;
  }

  .input-with-buttons {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .playing-card {
    width: 70px;
    height: 98px;
    padding: 7px;
  }

  .card-suit {
    font-size: 0.9rem;
  }

  .number-card-content .card-suit {
    font-size: 1.8rem;
  }
  
  .card-corner {
    font-size: 0.75rem;
  }
}
