:root {
  /* White & Red Theme Palette */
  --bg-primary: #f6f8fa;       /* Very light grey background */
  --bg-secondary: #ffffff;     /* White for inputs/sections */
  --bg-card: #ffffff;          /* White for the main card */
  --bg-hover: #fff1f2;         /* Very light red tint for hover states */

  --text-primary: #1f2937;     /* Dark grey/black for main text */
  --text-secondary: #4b5563;   /* Medium grey for secondary text */
  --text-tertiary: #9ca3af;    /* Lighter grey for hints */

  /* RED ACCENTS */
  --accent-red: #dc2626;       /* Vibrant Red */
  --accent-red-hover: #b91c1c; /* Darker Red for hover */
  --accent-red-light: rgba(220, 38, 38, 0.1); /* Light red transparent background */

  --success: #15803d;          /* Green for success messages */
  --error: #ef4444;            /* Red for errors */

  --border: #e5e7eb;           /* Light grey border */
  --border-hover: #d1d5db;

  --shadow: rgba(0, 0, 0, 0.1); /* Soft shadow */
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  line-height: 1.5;
}

.container {
  width: 100%;
  max-width: 600px;
  animation: fadeIn 0.5s ease-in;
}

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

.header {
  text-align: center;
  margin-bottom: 32px;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  /* Updated Gradient to Red */
  background: linear-gradient(135deg, var(--accent-red) 0%, #f87171 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: var(--text-primary); /* Fallback */
  margin-bottom: 8px;
  line-height: 1.2;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 8px 24px var(--shadow);
  overflow: hidden;
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: #f9fafb; 
}

.tab-button {
  flex: 1;
  padding: 16px 24px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-bottom: 2px solid transparent;
}

.tab-button:hover {
  color: var(--accent-red);
  background: var(--bg-hover);
}

.tab-button.active {
  color: var(--accent-red);
  border-bottom-color: var(--accent-red);
  background: var(--bg-card);
}

.tab-content {
  display: none;
  padding: 32px;
  animation: slideIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.form-section {
  margin-bottom: 24px;
}

label {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-size: 0.9rem;
}

/* Input Fields */
textarea,
input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  resize: vertical;
}

textarea:focus,
input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-red);
  box-shadow: 0 0 0 3px var(--accent-red-light);
}

textarea::placeholder,
input[type="text"]::placeholder {
  color: var(--text-tertiary);
}

#code-input {
  font-size: 2rem;
  text-align: center;
  letter-spacing: 0.5em;
  font-weight: 600;
  padding: 20px;
}

/* Divider */
.divider {
  text-align: center;
  margin: 24px 0;
  position: relative;
}

.divider::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 1px;
  background: var(--border);
}

.divider span {
  position: relative;
  background: var(--bg-card);
  padding: 0 16px;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  font-weight: 600;
}

/* File Input */
.file-input-wrapper {
  position: relative;
}

input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.file-input-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  background: #f9fafb;
  border: 2px dashed var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.file-input-label:hover {
  border-color: var(--accent-red);
  background: var(--bg-hover);
  color: var(--accent-red);
}

/* Buttons */
.btn {
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
}

.btn-primary {
  background: var(--accent-red);
  color: white;
  margin-top: 8px;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-red-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

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

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  margin-top: 12px;
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  color: var(--accent-red);
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Results */
.result-box {
  margin-top: 24px;
  padding: 24px;
  background: #fdf2f2; /* Very light red bg for results */
  border: 1px solid #fecaca;
  border-radius: 8px;
  animation: fadeIn 0.4s ease;
}

.success-icon {
  width: 48px;
  height: 48px;
  background: var(--success);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 16px;
}

.result-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 12px;
  text-align: center;
}

.code-display {
  font-size: 3rem;
  font-weight: 700;
  text-align: center;
  color: var(--accent-red);
  letter-spacing: 0.3em;
  padding: 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  user-select: all;
}

.result-hint {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  margin-top: 12px;
}

#received-text {
  margin-bottom: 12px;
  font-family: 'Courier New', monospace;
}

.error-message {
  margin-top: 16px;
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid var(--error);
  border-radius: 8px;
  color: var(--error);
  font-size: 0.9rem;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.footer {
  text-align: center;
  margin-top: 24px;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .header h1 { font-size: 2rem; }
  .tab-content { padding: 24px 20px; }
  .tab-button { padding: 14px 16px; font-size: 0.85rem; }
  .code-display { font-size: 2.5rem; }
  #code-input { font-size: 1.5rem; }
}
/* --- High-End Stacking Notification Styles --- */
.share-notification {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    animation: slideDown 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.share-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.share-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.close-notify {
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #9ca3af;
    transition: all 0.2s;
}

.close-notify:hover {
    background: #fee2e2;
    color: #dc2626;
}

.mini-code {
    font-size: 2.2rem;
    font-weight: 800;
    color: #dc2626;
    text-align: center;
    letter-spacing: 8px;
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    animation: pulseSubtle 3s infinite;
}

.live-stats {
    margin-top: 15px;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: #059669; /* Vibrant Green */
}

.result-hint {
    text-align: center;
    color: #9ca3af;
    font-size: 0.8rem;
    margin-top: 8px;
}

/* 30-Minute Visual Progress Bar */
.share-notification::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: #dc2626;
    width: 100%;
    animation: expireLine 1800s linear forwards;
}

@keyframes expireLine {
    from { width: 100%; }
    to { width: 0%; opacity: 0.3; }
}

@keyframes pulseSubtle {
    0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.05); }
    50% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}