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

:root {
  --primary-color: #5865f2;
  --primary-hover: #4752c4;
  --secondary-color: #747f8d;
  --success-color: #23a55a;
  --error-color: #f23f42;
  --bg-color: #ffffff;
  --surface-color: #f7f8fa;
  --text-color: #2e3338;
  --border-color: #d1d9de;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #0a0a1a;
  min-height: 100vh;
  color: var(--text-color);
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  top: 50%;
  left: 50%;
  width: 120vw;
  height: 120vh;
  transform: translate(-50%, -50%);
  background: 
    radial-gradient(circle at 30% 30%, rgba(88, 101, 242, 0.4) 0%, transparent 50%),
    radial-gradient(circle at 70% 70%, rgba(118, 75, 162, 0.4) 0%, transparent 50%),
    radial-gradient(circle at center, rgba(0, 0, 0, 0.8) 0%, rgba(10, 10, 26, 0.6) 40%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  top: 50%;
  left: 50%;
  width: 100vw;
  height: 100vh;
  transform: translate(-50%, -50%);
  background: 
    radial-gradient(ellipse at center, rgba(88, 101, 242, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 20% 30%, rgba(118, 75, 162, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(88, 101, 242, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
  position: relative;
  z-index: 1;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 2rem;
  color: white;
  position: relative;
  z-index: 1;
}

header h1 {
  font-family: 'Winky Sans', sans-serif;
  font-size: 3rem;
  font-weight: 400;
  text-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(88, 101, 242, 0.5),
    0 0 40px rgba(88, 101, 242, 0.3);
}

/* Card */
.card {
  background: var(--bg-color);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}

.card h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
  color: var(--text-color);
}


/* Screens */
.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: fadeIn 0.3s ease-in;
}

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

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-color);
}

.form-group input[type="text"],
.form-group input[type="file"] {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Global Checkbox Styles */
.form-group label.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.form-group input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: var(--secondary-color);
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: #5e6770;
  box-shadow: var(--shadow);
}

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

/* Loading spinner */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

.button-group {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* Instruction Text */
.instruction {
  color: var(--secondary-color);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* Result Display */
.result {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--border-color);
}

.error {
  color: var(--error-color);
  padding: 1rem;
  background: #fee;
  border-radius: 6px;
  border-left: 4px solid var(--error-color);
}

.success {
  color: var(--success-color);
  padding: 1rem;
  background: #e8f5e9;
  border-radius: 6px;
  border-left: 4px solid var(--success-color);
}

.success p {
  margin: 0;
  font-weight: 500;
}

/* Editions Selection */
.editions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.edition-option {
  padding: 0.5rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  background: var(--surface-color);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.edition-option:hover {
  border-color: var(--primary-color);
  background: #f0f1ff;
}

.edition-option.selected {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Info Box */
.info-box {
  background: var(--surface-color);
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
}

.info-box p {
  margin: 0.25rem 0;
}

/* Rules Box */
.rules-box {
  background: var(--surface-color);
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
}

.rules-box h3 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.rules-box ul {
  list-style: none;
  padding-left: 0;
}

.rules-box li {
  padding: 0.25rem 0;
  padding-left: 1.5rem;
  position: relative;
}

.rules-box li:before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--primary-color);
  font-weight: bold;
}

/* Progress */
.progress {
  margin-top: 1rem;
  text-align: center;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-bar::after {
  content: "";
  display: block;
  width: 30%;
  height: 100%;
  background: var(--primary-color);
  animation: progress 1.5s ease-in-out infinite;
}

@keyframes progress {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(400%);
  }
}

/* Preview */
.preview-box {
  text-align: center;
}

.preview-box h2 {
  margin-bottom: 1.5rem;
  color: var(--text-color);
}

.preview-box .button-group .btn {
  min-width: 200px;
  font-size: 1.05rem;
  padding: 0.875rem 2rem;
}

.preview-wrapper {
  position: relative;
  display: inline-block;
  margin: 1.5rem 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.preview-info-bar {
  width: 100%;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0.75rem 1rem;
  text-align: center;
  font-weight: 500;
  font-size: 0.95rem;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#preview-image {
  max-width: 100%;
  height: auto;
  display: block;
  max-height: 600px;
}

.focal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.focal-marker {
  position: absolute;
  left: 50%;
  top: 35%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  box-shadow: 
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 0 0 3px rgba(255, 255, 255, 0.5),
    0 0 15px rgba(0, 0, 0, 0.3),
    0 2px 8px rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.08);
  animation: rainbow-border 3s linear infinite;
}

@keyframes rainbow-border {
  0% { 
    border-color: rgba(255, 0, 0, 0.85);
    box-shadow: 
      0 0 0 1px rgba(0, 0, 0, 0.4),
      0 0 0 3px rgba(255, 0, 0, 0.4),
      0 0 15px rgba(255, 0, 0, 0.3),
      0 2px 8px rgba(0, 0, 0, 0.2);
  }
  14.3% { 
    border-color: rgba(255, 127, 0, 0.85);
    box-shadow: 
      0 0 0 1px rgba(0, 0, 0, 0.4),
      0 0 0 3px rgba(255, 127, 0, 0.4),
      0 0 15px rgba(255, 127, 0, 0.3),
      0 2px 8px rgba(0, 0, 0, 0.2);
  }
  28.6% { 
    border-color: rgba(255, 255, 0, 0.85);
    box-shadow: 
      0 0 0 1px rgba(0, 0, 0, 0.4),
      0 0 0 3px rgba(255, 255, 0, 0.4),
      0 0 15px rgba(255, 255, 0, 0.3),
      0 2px 8px rgba(0, 0, 0, 0.2);
  }
  42.9% { 
    border-color: rgba(0, 255, 0, 0.85);
    box-shadow: 
      0 0 0 1px rgba(0, 0, 0, 0.4),
      0 0 0 3px rgba(0, 255, 0, 0.4),
      0 0 15px rgba(0, 255, 0, 0.3),
      0 2px 8px rgba(0, 0, 0, 0.2);
  }
  57.2% { 
    border-color: rgba(0, 0, 255, 0.85);
    box-shadow: 
      0 0 0 1px rgba(0, 0, 0, 0.4),
      0 0 0 3px rgba(0, 0, 255, 0.4),
      0 0 15px rgba(0, 0, 255, 0.3),
      0 2px 8px rgba(0, 0, 0, 0.2);
  }
  71.5% { 
    border-color: rgba(75, 0, 130, 0.85);
    box-shadow: 
      0 0 0 1px rgba(0, 0, 0, 0.4),
      0 0 0 3px rgba(75, 0, 130, 0.4),
      0 0 15px rgba(75, 0, 130, 0.3),
      0 2px 8px rgba(0, 0, 0, 0.2);
  }
  85.8% { 
    border-color: rgba(148, 0, 211, 0.85);
    box-shadow: 
      0 0 0 1px rgba(0, 0, 0, 0.4),
      0 0 0 3px rgba(148, 0, 211, 0.4),
      0 0 15px rgba(148, 0, 211, 0.3),
      0 2px 8px rgba(0, 0, 0, 0.2);
  }
  100% { 
    border-color: rgba(255, 0, 0, 0.85);
    box-shadow: 
      0 0 0 1px rgba(0, 0, 0, 0.4),
      0 0 0 3px rgba(255, 0, 0, 0.4),
      0 0 15px rgba(255, 0, 0, 0.3),
      0 2px 8px rgba(0, 0, 0, 0.2);
  }
}

.focal-marker::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  box-shadow: 
    0 0 0 1px rgba(0, 0, 0, 0.3),
    0 0 6px rgba(0, 0, 0, 0.3);
}

.focal-text {
  position: absolute;
  left: 50%;
  top: 45%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.5);
  color: #ffffff;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  box-shadow: 
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 2px 8px rgba(0, 0, 0, 0.3),
    0 0 12px rgba(255, 255, 255, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: rainbow-text 3s linear infinite;
}

@keyframes rainbow-text {
  0% { 
    border-color: rgba(255, 0, 0, 0.6);
    box-shadow: 
      0 0 0 1px rgba(0, 0, 0, 0.4),
      0 2px 8px rgba(0, 0, 0, 0.25),
      0 0 12px rgba(255, 0, 0, 0.2);
  }
  14.3% { 
    border-color: rgba(255, 127, 0, 0.6);
    box-shadow: 
      0 0 0 1px rgba(0, 0, 0, 0.4),
      0 2px 8px rgba(0, 0, 0, 0.25),
      0 0 12px rgba(255, 127, 0, 0.2);
  }
  28.6% { 
    border-color: rgba(255, 255, 0, 0.6);
    box-shadow: 
      0 0 0 1px rgba(0, 0, 0, 0.4),
      0 2px 8px rgba(0, 0, 0, 0.25),
      0 0 12px rgba(255, 255, 0, 0.2);
  }
  42.9% { 
    border-color: rgba(0, 255, 0, 0.6);
    box-shadow: 
      0 0 0 1px rgba(0, 0, 0, 0.4),
      0 2px 8px rgba(0, 0, 0, 0.25),
      0 0 12px rgba(0, 255, 0, 0.2);
  }
  57.2% { 
    border-color: rgba(0, 0, 255, 0.6);
    box-shadow: 
      0 0 0 1px rgba(0, 0, 0, 0.4),
      0 2px 8px rgba(0, 0, 0, 0.25),
      0 0 12px rgba(0, 0, 255, 0.2);
  }
  71.5% { 
    border-color: rgba(75, 0, 130, 0.6);
    box-shadow: 
      0 0 0 1px rgba(0, 0, 0, 0.4),
      0 2px 8px rgba(0, 0, 0, 0.25),
      0 0 12px rgba(75, 0, 130, 0.2);
  }
  85.8% { 
    border-color: rgba(148, 0, 211, 0.6);
    box-shadow: 
      0 0 0 1px rgba(0, 0, 0, 0.4),
      0 2px 8px rgba(0, 0, 0, 0.25),
      0 0 12px rgba(148, 0, 211, 0.2);
  }
  100% { 
    border-color: rgba(255, 0, 0, 0.6);
    box-shadow: 
      0 0 0 1px rgba(0, 0, 0, 0.4),
      0 2px 8px rgba(0, 0, 0, 0.25),
      0 0 12px rgba(255, 0, 0, 0.2);
  }
}

/* Error Box */
.error-box {
  text-align: center;
  color: var(--error-color);
}

.error-box h2 {
  color: var(--error-color);
  margin-bottom: 1rem;
}

/* Submission Complete */
.submission-id {
  margin: 1rem 0;
  font-family: monospace;
  background: var(--surface-color);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  display: inline-block;
}

.submission-id code {
  color: var(--primary-color);
  font-weight: 600;
}

#complete-screen .button-group .btn {
  min-width: 200px;
  font-size: 1.05rem;
  padding: 0.875rem 2rem;
}

/* Auth Screen Styling */
.auth-intro {
  color: var(--text-color);
  margin-bottom: 1.5rem;
  font-size: 1rem;
  line-height: 1.6;
}

.auth-requirements {
  list-style: none;
  padding-left: 0;
  margin: 1.5rem 0;
  background: var(--surface-color);
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
}

.auth-requirements li {
  padding: 0.5rem 0;
  padding-left: 1.75rem;
  position: relative;
  color: var(--text-color);
  font-size: 0.95rem;
  line-height: 1.5;
}

.auth-requirements li:before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--primary-color);
  font-weight: bold;
  font-size: 1.1rem;
}

.auth-requirements li code {
  background: rgba(88, 101, 242, 0.1);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: var(--primary-color);
  font-weight: 600;
}

.auth-prompt {
  color: var(--secondary-color);
  margin: 1.5rem 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

.auth-button-container {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.auth-button-container .btn {
  min-width: 200px;
  font-size: 1.05rem;
  padding: 0.875rem 2rem;
}

/* Lookup Screen Styling */
.lookup-intro {
  color: var(--text-color);
  margin-bottom: 1.5rem;
  font-size: 1rem;
  line-height: 1.6;
}

.lookup-form-container {
  background: var(--surface-color);
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.lookup-form-container .form-group {
  margin-bottom: 1.25rem;
}

.lookup-form-container .form-group:last-child {
  margin-bottom: 0;
}

.lookup-form-container label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-color);
  font-size: 0.95rem;
}

.lookup-form-container input[type="text"] {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s;
  background: var(--bg-color);
}

.lookup-form-container input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-color);
}

.lookup-button-container {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.lookup-button-container .btn {
  min-width: 200px;
  font-size: 1.05rem;
  padding: 0.875rem 2rem;
}

/* Upload Screen Styling */
.upload-rules-intro {
  color: var(--text-color);
  margin-bottom: 1.5rem;
  font-size: 1rem;
  line-height: 1.6;
}

.upload-info-box {
  background: var(--surface-color);
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.upload-info-box p {
  margin: 0.25rem 0;
  color: var(--text-color);
  font-size: 0.95rem;
}

.upload-rules-box {
  background: var(--surface-color);
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.upload-rules-box h3 {
  margin-bottom: 0.75rem;
  font-size: 1rem;
  color: var(--text-color);
  font-weight: 600;
}

.upload-rules-box ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.upload-rules-box li {
  padding: 0.5rem 0;
  padding-left: 1.75rem;
  position: relative;
  color: var(--text-color);
  font-size: 0.95rem;
  line-height: 1.5;
}

.upload-rules-box li:before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--primary-color);
  font-weight: bold;
  font-size: 1.1rem;
}

.upload-form-container {
  background: var(--surface-color);
  padding: 1.5rem;
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
  margin-bottom: 1.5rem;
}

.upload-form-container .form-group {
  margin-bottom: 1.25rem;
}

.upload-form-container .form-group:last-child {
  margin-bottom: 0;
}

.upload-form-container label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-color);
  font-size: 0.95rem;
}

.upload-form-container input[type="file"] {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s;
  background: var(--bg-color);
  cursor: pointer;
}

.upload-form-container input[type="file"]:focus {
  outline: none;
  border-color: var(--primary-color);
}

.upload-form-container input[type="checkbox"] {
  margin-right: 0.5rem;
  width: 1.2rem;
  height: 1.2rem;
  cursor: pointer;
}

.upload-button-container {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.upload-button-container .btn {
  min-width: 200px;
  font-size: 1.05rem;
  padding: 0.875rem 2rem;
}

/* Responsive */
@media (max-width: 600px) {
  .container {
    padding: 1rem;
  }

  .card {
    padding: 1.5rem;
  }

  header h1 {
    font-size: 2.25rem;
  }

  .button-group {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .auth-button-container .btn {
    width: 100%;
    min-width: unset;
  }

  .lookup-button-container .btn {
    width: 100%;
    min-width: unset;
  }

  .upload-button-container .btn {
    width: 100%;
    min-width: unset;
  }
}


