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

:root {
  --bg: #0f0f12;
  --surface: #1a1a1f;
  --text: #f0f0f2;
  --muted: #888;
  --accent: #22c55e;
  --accent-hover: #16a34a;
  --input-border: #333;
  --radius: 12px;
  --font: "DM Sans", system-ui, sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.app {
  width: 100%;
  max-width: 480px;
}

.form-section,
.qr-section,
.success-section {
  transition: opacity 0.25s ease;
}

.form-section h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 1.5rem;
  text-align: center;
}

label {
  display: block;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

#amount {
  width: 100%;
  font-size: 2rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--input-border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  margin-bottom: 1rem;
  text-align: center;
  letter-spacing: 0.02em;
}

#amount:focus {
  outline: none;
  border-color: var(--accent);
}

#btn-create {
  width: 100%;
  font-size: 1.25rem;
  font-weight: 600;
  padding: 1rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}

#btn-create:hover:not(:disabled) {
  background: var(--accent-hover);
}

#btn-create:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.qr-section {
  position: relative;
}

.btn-close-qr {
  position: absolute;
  top: -0.5rem;
  right: -0.25rem;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn-close-qr:hover,
.btn-close-qr:active {
  background: #333;
}

.btn-close-qr:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.qr-section .amount-display {
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  margin: 0 0 1rem;
  padding-top: 0.5rem;
}

#qr-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  background: #fff;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

#qr-container canvas,
#qr-container img,
#qr-container table {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.qr-section .hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0;
}

.success-section {
  position: fixed;
  inset: 0;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.success-content {
  text-align: center;
  color: #fff;
  padding: 2rem;
}

.success-icon {
  display: inline-block;
  width: 80px;
  height: 80px;
  line-height: 80px;
  font-size: 3rem;
  font-weight: bold;
  border: 4px solid rgba(255,255,255,0.6);
  border-radius: 50%;
  margin-bottom: 1.5rem;
}

.success-content h2 {
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  font-weight: 700;
  margin: 0 0 1.5rem;
  line-height: 1.3;
  letter-spacing: 0.02em;
}

.btn-close-success {
  min-width: 44px;
  min-height: 44px;
  padding: 0.75rem 2rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--accent);
  background: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn-close-success:hover,
.btn-close-success:active {
  opacity: 0.95;
}

.btn-close-success:focus {
  outline: 2px solid rgba(255,255,255,0.8);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}
