@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap");

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #ffffff;
  color: #111111;
}

.container {
  max-width: 480px;
  margin: 6vh auto;
  padding: 0 1.5rem;
}

.panel {
  display: grid;
  gap: 1rem;
}

.title {
  font-size: 3rem;
  font-weight: 600;
  margin: 0;
  text-align: center;
}

.subheader {
  font-size: 1rem;
  font-weight: 400;
  margin: 0;
  text-align: center;
  color: #555555;
}

.form {
  display: grid;
  gap: 1rem;
}

.url-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #cccccc;
  border-radius: 20px;
  background: #ffffff;
  font: inherit;
  color: inherit;
}

.url-input::placeholder {
  color: #aaaaaa;
}

.image-selector {
  position: relative;
  width: 100%;
  aspect-ratio: 1.91;
  border: 1px solid #cccccc;
  border-radius: 20px;
  background-color: #f5f5f5;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  overflow: hidden;
  display: grid;
  place-items: center;
  transition: background-color 150ms ease;
}

.image-selector.drag-active {
  border-color: #111111;
  background-color: rgba(17, 17, 17, 0.05);
}

.image-selector.has-image {
  background-color: #000000;
}

.image-selector.loading {
  opacity: 0.7;
  pointer-events: none;
}

.image-selector-overlay {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  padding: 0;
  background: transparent;
}

.mode-button {
  border: 1px solid rgba(17, 17, 17, 0.9);
  border-radius: 999px;
  padding: 0.5rem 1.25rem;
  background: rgba(255, 255, 255, 0.55);
  color: inherit;
  cursor: pointer;
  font-weight: 600;
  backdrop-filter: blur(6px);
  transition: background 120ms ease, color 120ms ease;
}

.mode-button.active {
  background: rgba(255, 255, 255, 0.6);
  color: inherit;
}

.mode-button:hover,
.mode-button:focus-visible {
  background: rgba(255, 255, 255, 0.7);
  outline: none;
}

.mode-button[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

.hidden {
  display: none;
}

.muted {
  color: #666666;
  font-size: 0.9rem;
  margin: 0;
}

.gallery-modal.hidden {
  display: none;
}

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
}

.gallery-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.gallery-dialog {
  position: relative;
  width: min(calc(100vw - 3rem), 432px);
  max-height: 80vh;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.26);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: 0;
}

@media (max-width: 560px) {
  .container {
    padding: 0 1rem;
  }

  .gallery-dialog {
    width: calc(100vw - 2rem);
    max-width: 100%;
    margin: 10vh 1rem 0;
  }
}

.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.gallery-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.gallery-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.gallery-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.gallery-section-header {
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0 0.25rem;
  text-transform: none;
}

.gallery-section-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
}

.gallery-option-wrap {
  position: relative;
  width: 100%;
  padding: 4px;
}

.gallery-option {
  width: 100%;
  aspect-ratio: 1.91 / 1;
  border-radius: 14px;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  cursor: pointer;
  border: none;
  padding: 0;
  transition: transform 120ms ease, box-shadow 120ms ease;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.0);
}

.gallery-option:hover,
.gallery-option:focus-visible {
  transform: scale(1.02);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
  outline: none;
}

.file-input {
  display: none;
}

body.modal-open {
  overflow: hidden;
}

.submit-button {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 20px;
  border: 1px solid #111111;
  background: #111111;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
}

.submit-button[disabled] {
  opacity: 0.7;
  cursor: progress;
  background: #2a2a2a;
  border-color: #2a2a2a;
}

.submit-button:hover {
  background: #222222;
}

.result-card {
  margin-top: 0;
  padding: 0.85rem 1.25rem;
  border: 1px solid #cccccc;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.65);
  width: 100%;
  text-align: center;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.result-card:hover,
.result-card:focus-visible {
  background: rgba(17, 17, 17, 0.08);
  border-color: rgba(17, 17, 17, 0.45);
  outline: none;
}

.result-card .result-line,
.result-card .result-label,
.result-card .result-value {
  display: none;
}

.result-metadata {
  margin: 0;
  color: #555555;
  display: grid;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.result-metadata-line {
  margin: 0;
}

.result-metadata-line strong {
  font-weight: 600;
  margin-right: 0.25rem;
}

.result-url {
  font-size: 0.9rem;
  line-height: 1.15;
  color: #111111;
  word-break: break-word;
  font-weight: 500;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid #dd4444;
  color: #dd4444;
  font-size: 0.95rem;
}

.result-line {
  margin: 0;
  font-size: 0.95rem;
  color: #111111;
  word-break: break-word;
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.result-label {
  font-weight: 700;
  min-width: 5rem;
}

.result-value {
  font-weight: 400;
  color: #1f2937;
  flex: 1;
}

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: rgba(17, 17, 17, 0.85);
  color: #ffffff;
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  font-size: 0.95rem;
  opacity: 0;
  transition: opacity 150ms ease, transform 150ms ease;
  pointer-events: none;
  z-index: 1100;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

