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

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1rem;
}

.container {
  width: 100%;
  max-width: 680px;
}

header {
  text-align: center;
  margin-bottom: 2.5rem;
}

header h1 {
  font-size: 2.25rem;
  font-weight: 700;
  color: #333;
}

.subtitle {
  margin-top: 0.5rem;
  color: #64748b;
  font-size: 0.95rem;
}

/* ── Shorten form ── */
.shorten-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

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

#url-input {
  flex: 1;
  padding: 0.7rem 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #1e293b;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

#url-input:focus {
  border-color: #6366f1;
}

#url-input::placeholder {
  color: #94a3b8;
}

#shorten-btn {
  padding: 0.7rem 1.4rem;
  background: #333;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

#shorten-btn:hover {
  background: #555;
}

.error {
  margin-top: 0.6rem;
  color: #f87171;
  font-size: 0.875rem;
}

/* ── Result ── */
.result {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

#short-url {
  flex: 1;
  font-family: monospace;
  font-size: 0.95rem;
  color: #6366f1;
  word-break: break-all;
}

#copy-btn {
  padding: 0.4rem 0.9rem;
  background: #e2e8f0;
  color: #475569;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

#copy-btn:hover {
  background: #cbd5e1;
}

#copy-btn.copied {
  background: #16a34a;
  color: #fff;
}

/* ── History ── */
.history-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.history-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.clear-btn {
  font-size: 0.8rem;
  color: #94a3b8;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}

.clear-btn:hover {
  color: #f87171;
}

#history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#history-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.875rem;
}

.history-short {
  font-family: monospace;
  color: #6366f1;
  white-space: nowrap;
}

.history-arrow {
  color: #cbd5e1;
  flex-shrink: 0;
}

.history-original {
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.history-copy {
  padding: 0.3rem 0.6rem;
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.history-copy:hover {
  background: #e2e8f0;
}

.history-copy.copied {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}

.empty-msg {
  color: #94a3b8;
  font-size: 0.875rem;
  text-align: center;
  padding: 1rem 0;
}

.hidden {
  display: none !important;
}
