﻿/* style.css */
/* Base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary-color: #6C5CE7;
  --accent-color: #FD79A8;
  --background: #0A0A0A;
  --surface: #1A1A1A;
  --text-primary: #FFFFFF;
  --text-secondary: #B8B8B8;
  --error: #FF6B6B;
  --success: #51CF66;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

body[data-lang="ko"] {
  font-family: 'Inter', -apple-system, 'Noto Sans KR', sans-serif;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

h1 {
  text-align: center;
  font-size: clamp(1.5em, 7vw, 2.8em);
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.03em;
  line-height: 1;
  white-space: nowrap;
}

/* Input section */
.input-section {
  display: flex;
  gap: 10px;
  margin-bottom: 0;
}

.input-column {
  flex: 0 0 200px;
  max-width: 200px;
}

/* Input row */
.input-row {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tiny-toggle {
  position: absolute;
  left: -25px;
  top: 15px;
  width: 20px;
  height: 20px;
  background: var(--surface);
  border: 1px solid #333;
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.tiny-toggle:hover {
  background: rgba(108, 92, 231, 0.2);
  border-color: var(--primary-color);
  color: var(--primary-color);
}
.tiny-toggle.disabled {
opacity: 0.5;
cursor: not-allowed;
}

.tiny-toggle.disabled:hover {
background: var(--surface);
border-color: #333;
color: var(--text-secondary);
}
/* Input group */
.input-group {
  margin-bottom: 0;
  position: relative;
  transition: all 0.3s ease;
}

.input-group label {
  display: block;
  margin-bottom: 2px;
  color: var(--text-secondary);
  font-size: 0.75em;
  font-weight: 500;
}

.input-wrapper {
  display: flex;
  gap: 6px;
  align-items: center;
}

.input-group input {
  flex: 1;
  padding: 8px 10px;
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.9em;
  transition: all 0.3s ease;
  height: 36px;
  min-width: 0; /* Allow shrinking */
}

.input-group input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(253, 121, 168, 0.1);
}

/* When first date is hidden, make second date more prominent */
#birthDateGroup.hidden {
  display: none;
}

#birthDateGroup.hidden + #secondDateGroup input {
  font-size: 1em;
  padding: 10px 12px;
  background: rgba(108, 92, 231, 0.05);
  border-color: rgba(108, 92, 231, 0.3);
  height: 40px;
}

/* Gender toggle - compact version */
.gender-toggle {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border-radius: 4px;
  padding: 2px;
  height: 36px;
}

.gender-toggle button {
  width: 32px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.2s ease;
  font-size: 0.75em;
  font-weight: 600;
}

.gender-toggle button.active {
  background: var(--primary-color);
  color: white;
}

.gender-toggle button:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
}

/* Default controls */
.default-controls {
  position: absolute;
  right: 8px;
  top: -2px;
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.input-group:hover .default-controls {
  opacity: 1;
}

.default-btn {
  padding: 2px 4px;
  background: transparent;
  border: 1px solid #333;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 3px;
  font-size: 0.65em;
  transition: all 0.2s ease;
}

.default-btn:hover {
  background: rgba(108, 92, 231, 0.1);
}

.default-btn.active {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.default-btn.clear {
  color: var(--error);
}

.has-default .default-btn:first-child {
  background: var(--primary-color);
  color: white;
}

/* Masked indicator */
.masked-indicator {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.6em;
  color: var(--accent-color);
  background: rgba(253, 121, 168, 0.2);
  padding: 1px 4px;
  border-radius: 3px;
  display: none;
}

.has-masked-default .masked-indicator {
  display: block;
}

/* Celebrity and recent dates - hidden by default, shown on focus */
.celebs-dates, .recent-dates {
  margin-top: 0;
  margin-bottom: 0;
  font-size: 0.7em;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.3s ease;
  line-height: 1;
}

.input-group:focus-within .celebs-dates,
.input-group:focus-within .recent-dates {
  max-height: 40px; /* Reduced even more */
  opacity: 1;
}

.celebs-dates-title, .recent-dates-title {
  display: inline-block;
  color: var(--text-secondary);
  margin-right: 6px;
}

.celeb-item, .recent-date-item {
  display: inline-block;
  margin-right: 8px;
  color: var(--accent-color);
  cursor: pointer;
  text-decoration: underline;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.celeb-item:hover, .recent-date-item:hover {
  opacity: 1;
}

/* Keypad styles */
.keypad-column {
  flex: 1;
}

/* Years section - no margin top */
.years-section {
  margin-top: 0;
}

/* Compact years grid */
.years-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  margin-bottom: 2px;
  padding: 2px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
}

.months-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}

.year-button, .month-button {
  padding: 4px 1px;
  background: var(--surface);
  border: 1px solid #333;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.65em;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 0;
}

.year-button {
  font-size: 0.7em;
}

.year-button:hover, .month-button:hover {
  background: rgba(108, 92, 231, 0.2);
  border-color: var(--primary-color);
}

.year-button.active, .month-button.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 6px;
}

.keypad-button {
  padding: 15px;
  background: var(--surface);
  border: 2px solid #333;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 8px;
  font-size: 1.2em;
  font-weight: 600;
  transition: all 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.keypad-button:hover {
  background: rgba(108, 92, 231, 0.2);
  border-color: var(--primary-color);
}

.keypad-button:active {
  transform: scale(0.95);
  background: var(--primary-color);
  color: white;
}

.keypad-button.clear {
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.3);
  color: var(--error);
}

.keypad-button.backspace {
  font-size: 1.1em;
}

/* Buttons */
.button-group {
  display: flex;
  gap: 10px;
}

.swap-button-bottom {
  padding: 12px 20px;
  background: rgba(108, 92, 231, 0.2);
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  cursor: pointer;
  border-radius: 8px;
  font-size: 1.2em;
  transition: all 0.3s ease;
}

.swap-button-bottom:hover {
  background: var(--primary-color);
  color: white;
}

#calculateButton {
  flex: 1;
  padding: 15px 30px;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  border: none;
  color: white;
  cursor: pointer;
  border-radius: 10px;
  font-size: 1.2em;
  font-weight: 700;
  transition: all 0.3s ease;
}

#calculateButton:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(108, 92, 231, 0.3);
}

#calculateButton:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Results */
.results-container {
  margin-top: 30px;
  padding: 20px;
  background: var(--surface);
  border-radius: 12px;
  display: none;
}

.error {
  color: var(--error);
  text-align: center;
  padding: 20px;
}

/* Energetic signature section */
.energetic-signature-section {
  display: none;
  margin-bottom: 30px;
  padding: 20px;
  background: var(--surface);
  border-radius: 12px;
}

.energetic-signature-section h2 {
  text-align: center;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.signature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

.signature-item {
  text-align: center;
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.signature-label {
  font-size: 0.9em;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.signature-aspect-labels {
  display: flex;
  justify-content: center;
  gap: 15px;
  font-size: 0.75em;
  color: var(--text-secondary);
  margin-bottom: 8px;
  opacity: 0.7;
}

.signature-number {
  font-size: 1.5em;
  font-weight: 700;
  color: var(--text-primary);
}

.signature-number.soulmate {
  color: #51CF66;
}

.signature-number.enemy {
  color: #FF6B6B;
}

.signature-number.tight-spacing {
  letter-spacing: -2px;
}

.sig-digit {
  display: inline-block;
  padding: 0 2px;
}

.sig-digit.clickable {
  cursor: pointer;
  transition: all 0.2s ease;
}

.sig-digit.clickable:hover {
  color: var(--accent-color);
  transform: scale(1.1);
}

/* Tooltip styles */
.signature-tooltip {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--primary-color);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.85em;
  color: var(--text-primary);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  max-width: 300px;
}

.signature-tooltip.active {
  opacity: 1;
  pointer-events: auto;
}

.tooltip-aspect {
  margin-bottom: 8px;
}

.tooltip-aspect:last-child {
  margin-bottom: 0;
}

.tooltip-aspect-label {
  color: var(--accent-color);
  font-weight: 600;
  text-transform: capitalize;
}

.explore-button {
  display: block;
  width: 200px;
  margin: 0 auto;
  padding: 10px 20px;
  background: rgba(108, 92, 231, 0.2);
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  text-align: center;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.explore-button:hover {
  background: var(--primary-color);
  color: white;
}

/* Table styles */
.result-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

.result-table th,
.result-table td {
  padding: 10px;
  text-align: center;
  border: 1px solid #333;
}

.result-table th {
  background: rgba(108, 92, 231, 0.1);
  font-weight: 600;
}

.result-table td {
  background: var(--surface);
}

.result-table td.lightblue {
  background: rgba(74, 144, 226, 0.3);
  color: #74C0FC;
}

.result-table td.lightgreen {
  background: rgba(81, 207, 102, 0.3);
  color: #51CF66;
}

.result-table td.lightorange {
  background: rgba(255, 159, 64, 0.3);
  color: #FF9F40;
}

.result-table td.lightred {
  background: rgba(255, 107, 107, 0.3);
  color: #FF6B6B;
}

.result-details {
  display: none;
  margin-top: 20px;
}

.expand-button {
  display: block;
  margin: 20px auto;
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.expand-button:hover {
  background: var(--primary-color);
  color: white;
}

/* Summary styles */
.main-relationship-summary {
  font-size: 3.5em;  /* Increased from 2.8em */
  font-weight: 800;  /* Increased from 700 for bolder text */
  letter-spacing: -0.05em;
  line-height: 0.95;  /* Added tight line height for multi-line text */
  text-align: center;
  margin-bottom: 20px;
  padding: 30px 20px;  /* Increased vertical padding */
  background: rgba(108, 92, 231, 0.1);
  border-radius: 8px;
  color: var(--text-primary);
}

.relationship-summary {
  text-align: center;
  margin-bottom: 20px;
  line-height: 1.8;
}

.relationship-summary .backstab {
  color: #FF9F40;
  font-weight: 600;
}

.relationship-summary .enemy {
  color: #FF6B6B;
  font-weight: 600;
}

.relationship-summary .supportive {
  color: #74C0FC;
  font-weight: 600;
}

.relationship-summary .guardian {
  color: #51CF66;
  font-weight: 600;
}

.odds-explanation {
  text-align: center;
  margin-top: 20px;
  padding: 20px;
  background: rgba(253, 121, 168, 0.1);
  border-radius: 8px;
}

.soulmate-highlight {
  display: block;
  margin-top: 10px;
  color: var(--accent-color);
  font-weight: 600;
}

/* Connect section */
#connect-section {
  margin-top: 40px;
  text-align: center;
  padding-top: 30px;
}

#connectButton {
  max-width: 200px;
  margin: 0 auto;
  padding: 15px 30px;
  background: var(--accent-color);
  border: none;
  color: white;
  cursor: pointer;
  border-radius: 10px;
  font-size: 1.2em;
  font-weight: 700;
  transition: all 0.3s ease;
}

#connectButton:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(253, 121, 168, 0.3);
}

/* Loading spinner */
.spinner {
  display: none;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top: 3px solid var(--accent-color);
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

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

#countdown {
  text-align: center;
  color: var(--text-secondary);
  margin-top: 10px;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
  background-color: var(--surface);
  margin: 15% auto;
  padding: 20px;
  border: 1px solid var(--primary-color);
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
}

.modal-header {
  margin-bottom: 20px;
  color: var(--text-primary);
  text-align: center;
}

.modal-input-group {
  margin-bottom: 20px;
}

.modal-input-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.modal-input-group input[type="text"] {
  width: 100%;
  padding: 10px;
  background: var(--background);
  border: 1px solid #333;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 1em;
}

.modal-checkbox {
  margin-top: 15px;
}

.modal-checkbox input[type="checkbox"] {
  margin-right: 8px;
}

.modal-checkbox label {
  color: var(--text-secondary);
  font-size: 0.9em;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-buttons button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.cancel-btn {
  background: transparent;
  border: 1px solid #333;
  color: var(--text-secondary);
}

.cancel-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.modal-buttons button:last-child {
  background: var(--primary-color);
  color: white;
}

.modal-buttons button:last-child:hover {
  background: var(--accent-color);
}

/* Language toggle */
.language-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
}

.language-toggle button {
  padding: 4px 8px;
  background: rgba(108, 92, 231, 0.2);
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.75em;
  transition: all 0.2s ease;
}

.language-toggle button:hover {
  background: var(--primary-color);
  color: white;
}

/* Links */
.advanced-link {
  text-align: center;
  margin-bottom: 4px;
  font-size: 0.7em;
  line-height: 1;
}

.advanced-link a {
  color: var(--accent-color);
  text-decoration: none;
  opacity: 0.8;
}

.advanced-link a:hover {
  text-decoration: underline;
  opacity: 1;
}

/* Grip pad styles */
.grip-pad {
  position: fixed;
  right: 0;
  width: 30px;
  height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
  cursor: grab;
  touch-action: pan-y;
}

.grip-pad:active {
  cursor: grabbing;
}

.grip-pad.top {
  top: 25%;
}

.grip-pad.middle {
  top: 50%;
  transform: translateY(-50%);
}

.grip-pad.bottom {
  top: 75%;
}

.grip-dots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 6px;
}

.grip-dot {
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transition: all 0.3s ease;
}

.grip-pad:hover .grip-dot {
  background: rgba(253, 121, 168, 0.3);
}

.grip-pad:active .grip-dot {
  background: rgba(253, 121, 168, 0.5);
  transform: scale(1.2);
}

/* Add subtle glow on hover */
.grip-pad::before {
  content: '';
  position: absolute;
  inset: -10px;
  background: radial-gradient(ellipse at center, rgba(253, 121, 168, 0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.grip-pad:hover::before {
  opacity: 1;
}

/* Mobile optimizations */
@media (max-width: 600px) {

  .main-relationship-summary {
    font-size: 2.2em;  /* Smaller than desktop but still prominent */
    font-weight: 800;
    line-height: 0.9;  /* Even tighter for mobile */
    padding: 20px 15px;  /* Reduced padding for mobile */
    letter-spacing: -0.06em;  /* Slightly tighter letter spacing */
    word-break: break-word;  /* Ensure long words break properly */
    hyphens: auto;  /* Allow hyphenation if needed */
  }

  .container {
    padding: 12px;
    padding-right: 35px; /* Make room for grip pad */
  }

  h1 {
    font-size: clamp(1.2em, 6vw, 1.8em);
    margin-bottom: 10px;
  }

  .input-section {
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
  }

  .input-column {
    max-width: none;
  }

  .input-row {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: flex-end;
  }

  .input-group {
    flex: 1;
  }

  .input-wrapper {
    flex-direction: row;
  }

  .years-grid {
    grid-template-columns: repeat(6, 1fr);
    margin-bottom: 4px;
  }

  .months-grid {
    margin-bottom: 8px;
  }

  .keypad {
    gap: 5px;
    margin-bottom: 8px;
  }

  .keypad-button {
    padding: 12px;
    font-size: 1.1em;
  }

  .tiny-toggle {
    left: -20px;
    top: 25px;
  }

  .grip-pad {
    width: 25px;
    height: 60px;
  }

  .grip-pad.top {
    top: 25%;
  }

  .grip-pad.middle {
    top: 50%;
    transform: translateY(-50%);
  }

  .grip-pad.bottom {
    top: 75%;
  }

  .grip-dots {
    gap: 3px;
    padding: 4px;
  }

  .grip-dot {
    width: 3px;
    height: 3px;
  }
}