.tab-bar {
  display: flex;
  gap: 0.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem;
  margin-bottom: 1.25rem;
}

.tab-btn {
  flex: 1;
  background: transparent;
  color: var(--text-muted);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.tab-btn.active {
  background: var(--surface-2);
  color: var(--text);
}

.tab-btn:hover:not(.active):not(:disabled) {
  background: var(--surface-2);
}

.field {
  margin-bottom: 1rem;
}

.file-drop {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.file-drop:hover, .file-drop.drag-over {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.file-drop input[type="file"] {
  display: none;
}

.file-info {
  margin-top: 0.75rem;
  font-size: 0.8375rem;
  color: var(--text-muted);
}

.file-info strong {
  color: var(--text);
}

.file-drop .file-preview {
  display: block;
  margin: 0.875rem auto 0;
  max-width: 100%;
  max-height: 220px;
  border-radius: var(--radius);
  object-fit: contain;
}

.file-drop audio.file-preview {
  max-height: none;
  width: 100%;
}

.ttl-label-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.ttl-label-row label {
  margin-bottom: 0;
}

.ttl-info-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: default;
  line-height: 1;
  user-select: none;
  outline: none;
}

.info-icon svg {
  width: 1.125rem;
  height: 1.125rem;
  opacity: 0.85;
}

.info-icon:hover + .info-tooltip,
.info-icon:focus + .info-tooltip {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.info-tooltip {
  position: absolute;
  left: 1.5rem;
  top: 50%;
  transform: translateY(calc(-50% + 4px));
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
  min-width: 220px;
  max-width: min(280px, calc(100vw - 3rem));
  padding: 0.5rem 0.75rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 10;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.ttl-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ttl-btn {
  flex: 1;
  min-width: 3rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}

.ttl-btn[data-ttl="custom"] {
  flex: 2;
  padding-left: 0.875rem;
  padding-right: 0.875rem;
}

.custom-ttl-row {
  display: flex;
  margin-top: 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}

.custom-ttl-row:focus-within {
  border-color: var(--accent);
}

.custom-ttl-row input[type="text"] {
  width: 80px;
  flex-shrink: 0;
  background: var(--bg);
  border: none;
  border-right: 1px solid var(--border);
  border-radius: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9375rem;
  padding: 0.65rem 0.875rem;
  outline: none;
}

.custom-ttl-row input[type="text"]::placeholder {
  color: var(--text-muted);
}

.custom-ttl-row select {
  flex: 1;
  background: var(--bg);
  border: none;
  border-radius: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9375rem;
  padding: 0.65rem 0.875rem;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  padding-right: 2.25rem;
}

.ttl-btn.selected {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 255, 255, 0.07);
}

.ttl-btn:hover:not(.selected):not(:disabled) {
  border-color: var(--accent);
  color: var(--text);
}

.turnstile-wrap {
  display: flex;
  justify-content: center;
}

.turnstile-wrap:empty {
  display: none;
}

.actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
}

.actions button[type="submit"] {
  flex: 1;
}

@keyframes result-enter {
  0%   { opacity: 0; transform: translateY(12px) scale(0.98); filter: blur(4px); }
  60%  { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.result-card {
  margin-top: 0;
}

.create-new-row {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
}

.result-card.animating {
  animation: result-enter 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.result-card .url-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  margin-top: 0.75rem;
}

.result-card .url-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.result-card .url-box {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-family: 'Fira Code', 'Consolas', monospace;
  padding: 0.6rem 0.875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
  user-select: all;
}

.result-card .copy-btn {
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

.result-card .copy-btn.copied {
  background: rgba(78, 203, 113, 0.15);
  color: var(--success);
}

.result-card .share-btn {
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

.qr-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

#qr-code {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.qr-row canvas {
  border-radius: var(--radius);
  display: block;
}

.qr-row.qr-copied canvas {
  outline: 2px solid var(--success);
  outline-offset: 3px;
}

.qr-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

@keyframes textarea-clear {
  0%   { opacity: 1; transform: scale(1); filter: blur(0); }
  40%  { opacity: 0.4; transform: scale(0.98); filter: blur(1px); }
  100% { opacity: 0; transform: scale(0.96); filter: blur(3px); }
}

textarea.clearing,
.file-drop.clearing {
  animation: textarea-clear 0.4s ease-in forwards;
  pointer-events: none;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #111;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

@media (max-width: 600px) {
  .ttl-group {
    gap: 0.375rem;
  }

  .ttl-btn {
    min-width: 2.75rem;
    font-size: 0.8125rem;
    padding: 0.5rem 0.375rem;
    min-height: 44px;
  }

  .ttl-btn[data-ttl="custom"] {
    flex-basis: 100%;
    flex: 1 0 calc(50% - 0.375rem);
  }

  .result-card .url-row {
    flex-direction: column;
  }

  .result-card .url-box {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .result-card .url-actions {
    width: 100%;
  }

  .result-card .copy-btn,
  .result-card .share-btn {
    flex: 1;
    width: auto;
    justify-content: center;
  }

  .file-drop {
    min-height: 140px;
  }
}
