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

:root {
  --accent: #6C5CE7;
  --accent-light: #A29BFE;
  --accent-bg: rgba(108, 92, 231, 0.08);
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --bg: #FAFAFA;
  --surface: #FFFFFF;
  --border: #E5E7EB;
  --border-hover: #D1D5DB;
  --error: #EF4444;
  --success: #10B981;
  --radius: 12px;
  --radius-sm: 8px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* === Layout === */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 20px 32px;
}

/* === Header === */
.header {
  text-align: center;
  margin-bottom: 40px;
}

.logo {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.tagline {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-top: 12px;
  line-height: 1.5;
}

.subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* === Rotating Brand Names === */
.rotating-wrapper {
  display: inline-block;
  position: relative;
  width: 130px;
  height: 1.5em;
  vertical-align: bottom;
  overflow: hidden;
}

.rotating-item {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  font-weight: 600;
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.rotating-item.active {
  opacity: 1;
  transform: translateY(0);
}

.brand-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.rotating-item[data-brand="claude"] {
  color: #D97706;
}

.rotating-item[data-brand="chatgpt"] {
  color: #10A37F;
}

.rotating-item[data-brand="gemini"] {
  color: #4285F4;
}

/* === Drop Zone === */
.upload-section {
  margin-bottom: 24px;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
  background: var(--surface);
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.dropzone.dragover .dropzone-icon {
  color: var(--accent);
  transform: translateY(-4px);
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.dropzone-icon {
  width: 48px;
  height: 48px;
  color: var(--text-secondary);
  transition: color 0.2s ease, transform 0.2s ease;
  margin-bottom: 4px;
}

.dropzone-text {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}

.dropzone-hint {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.file-info {
  text-align: center;
  font-size: 0.875rem;
  color: var(--error);
  margin-top: 8px;
  min-height: 1.25em;
}

/* === Sections (shared) === */
.hidden {
  display: none !important;
}

section {
  margin-bottom: 24px;
}

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

.section-header h2 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

/* === Preview === */
.preview-frame-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: white;
}

.preview-frame {
  width: 100%;
  height: 400px;
  border: none;
  display: block;
}

/* === Password Section === */
.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.input-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.2s ease;
  outline: none;
}

.input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.input-group input::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

/* === Buttons === */
.btn-primary {
  width: 100%;
  padding: 14px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn-primary:hover {
  background: #5B4BD5;
}

.btn-primary:active {
  transform: scale(0.99);
}

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

.btn-secondary {
  width: 100%;
  padding: 14px 24px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.2s ease;
}

.btn-text:hover {
  color: var(--error);
}

/* === Result === */
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.result-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--success);
  margin-bottom: 12px;
}

.link-row {
  display: flex;
  gap: 8px;
}

.link-row input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text);
  background: var(--bg);
  outline: none;
  min-width: 0;
}

.btn-copy {
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.2s ease;
  white-space: nowrap;
}

.btn-copy:hover {
  background: #5B4BD5;
}

.btn-copy.copied {
  background: var(--success);
}

.result-meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 12px;
}

/* === Footer === */
.footer {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

.footer p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* === View Page (password prompt) === */
.view-container {
  max-width: 400px;
  margin: 0 auto;
  padding: 120px 20px 32px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.view-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
}

.view-logo {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 24px;
}

.view-card .input-group {
  margin-bottom: 12px;
  text-align: left;
}

.view-error {
  color: var(--error);
  font-size: 0.875rem;
  margin-top: 12px;
}

.view-expired {
  color: var(--text-secondary);
  font-size: 1rem;
  padding: 16px 0;
}

.view-footer {
  margin-top: auto;
  padding-top: 32px;
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.view-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.view-footer a:hover {
  color: var(--text);
}

.report-link {
  opacity: 0.6;
}

.report-link:hover {
  opacity: 1;
}

/* === History === */
.history-section {
  margin-top: 8px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  transition: border-color 0.2s ease;
}

.history-item:hover {
  border-color: var(--border-hover);
}

.history-item-info {
  flex: 1;
  min-width: 0;
}

.history-item-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.history-item-meta .expired {
  color: var(--error);
}

.history-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.btn-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-icon.copied {
  border-color: var(--success);
  color: var(--success);
}

.btn-icon--delete:hover {
  border-color: var(--error);
  color: var(--error);
}

/* === Mobile === */
@media (max-width: 480px) {
  .container {
    padding: 32px 16px 24px;
  }

  .logo {
    font-size: 1.5rem;
  }

  .tagline,
  .subtitle {
    font-size: 1rem;
  }

  .dropzone {
    padding: 36px 16px;
  }

  .preview-frame {
    height: 300px;
  }

  .link-row {
    flex-direction: column;
  }

  .btn-copy {
    width: 100%;
  }

  .history-item {
    flex-wrap: wrap;
    gap: 8px;
  }

  .history-item-actions {
    width: 100%;
  }

  .btn-icon {
    flex: 1;
    text-align: center;
  }
}
