/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-color: oklch(15% 0.02 240);
  --text-color: oklch(98% 0.01 240);
  --accent-color: oklch(65% 0.25 280); /* Vibrant Purple/Blue */
  --accent-secondary: oklch(75% 0.15 190); /* Cyan/Teal */
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --shadow-color: rgba(0, 0, 0, 0.5);
}

body {
  font-family: 'Pretendard', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Background Texture */
.background-texture {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-image: 
    radial-gradient(circle at 10% 20%, oklch(30% 0.1 260) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, oklch(30% 0.1 300) 0%, transparent 40%);
  opacity: 0.5;
}

.background-texture::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('https://www.transparenttextures.com/patterns/p6.png'); /* Subtle Noise */
  opacity: 0.2;
}

/* App Layout */
.app-container {
  width: 90%;
  max-width: 600px;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: fadeIn 0.8s ease-out;
}

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

header {
  text-align: center;
}

header h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(to right, var(--accent-color), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

header p {
  font-size: 1rem;
  opacity: 0.8;
}

/* Glass Panels */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px var(--shadow-color);
}

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

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-group label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-secondary);
}

.input-group input {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 0.8rem;
  color: white;
  font-size: 1.1rem;
  transition: all 0.3s;
  width: 100%;
}

.input-group input:focus {
  outline: none;
  border-color: var(--accent-color);
  background: rgba(255, 255, 255, 0.15);
}

.button-group {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.8fr;
  gap: 0.8rem;
}

button {
  padding: 0.8rem 0.5rem;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-color), oklch(55% 0.2 300));
  color: white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 10px rgba(100, 50, 255, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 15px rgba(100, 50, 255, 0.6);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent-secondary), oklch(65% 0.1 180));
  color: var(--bg-color);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 0 10px rgba(0, 255, 255, 0.2);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 0 15px rgba(0, 255, 255, 0.4);
}

.btn-primary:disabled, .btn-accent:disabled {
  background: oklch(40% 0 0);
  color: oklch(70% 0 0);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Display Area */
.display-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 250px;
  text-align: center;
  position: relative;
}

.group-badge {
  font-size: 1rem;
  background: var(--accent-secondary);
  color: var(--bg-color);
  padding: 0.3rem 1rem;
  border-radius: 20px;
  font-weight: 700;
  margin-bottom: 0.5rem;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
}

.group-badge.show {
  opacity: 1;
  transform: translateY(0);
}

.counter-display {
  font-size: 6rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: white;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3), 0 0 40px var(--accent-color);
  animation: pulse 2s infinite ease-in-out;
}

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

.status-message {
  font-size: 0.9rem;
  opacity: 0.7;
  max-width: 80%;
}

/* History Panel */
.history-panel h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.history-list::-webkit-scrollbar {
  width: 4px;
}

.history-list::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 4px;
}

.history-item {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  font-weight: 700;
  border: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.history-item .group-label {
  font-size: 0.7rem;
  opacity: 0.6;
}

@keyframes popIn {
  0% { opacity: 0; transform: scale(0.5); }
  100% { opacity: 1; transform: scale(1); }
}

.empty-msg {
  opacity: 0.5;
  font-style: italic;
  font-size: 0.9rem;
}

/* Contact Panel */
.contact-panel h2 {
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
  font-weight: 700;
}

.contact-desc {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 1.2rem;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-form textarea {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 0.8rem;
  color: white;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  transition: all 0.3s;
}

.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  background: rgba(255, 255, 255, 0.15);
}

.w-full {
  width: 100%;
}

.formspree-hint {
  font-size: 0.75rem;
  opacity: 0.5;
  margin-top: 0.8rem;
  text-align: center;
}

/* Responsive Styles */
@media (max-width: 480px) {
  .counter-display {
    font-size: 4rem;
  }
  
  header h1 {
    font-size: 1.8rem;
  }

  .input-row {
    grid-template-columns: 1fr;
  }
}

