:root {
  --outer-bg: linear-gradient(130deg, #ffd9ec 0%, #f0e3ff 46%, #dff8ff 100%);
  --text: #5d476f;
  --text-light: #8e79a5;
  --accent: #9d81d1;
  --card: rgba(255, 255, 255, 0.45);
  --surface: rgba(255, 255, 255, 0.5);
  --primary: #9d81d1;
  --on-primary: #ffffff;
  --sec-cont: rgba(247, 168, 184, 0.25);
  --on-sec-cont: #df6b88;
}

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

html, body {
  width: 100%;
  min-height: 100%;
  font-family: 'Kiwi Maru', "Hiragino Maru Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  color: var(--text);
  overflow-x: hidden;
}

body {
  background: var(--outer-bg) no-repeat fixed;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow-y: auto;
  overscroll-behavior-y: auto;
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(24px);
  z-index: -1;
  animation: float 8s ease-in-out infinite alternate;
}

body::before {
  top: -120px;
  right: -80px;
  background: rgba(255, 166, 208, 0.4);
}

body::after {
  bottom: -130px;
  left: -90px;
  background: rgba(162, 214, 255, 0.4);
  animation-delay: 1.3s;
}

#app {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

.app-header {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 10;
}

.back-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 8px 32px rgba(132, 87, 182, 0.07);
  color: var(--text);
  text-decoration: none;
  font-weight: bold;
  font-size: 0.95rem;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.back-link:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.75);
  color: var(--accent);
}

.back-link svg {
  transition: transform 0.3s ease;
}

.back-link:hover svg {
  transform: translateX(-4px);
}

#qr-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 88px 16px 20px;
}

.qr-card {
  width: min(100%, 400px);
  display: flex;
  flex-direction: column;
  padding: 32px 24px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 36px;
  box-shadow:
    0 24px 60px rgba(132, 87, 182, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.45);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  gap: 24px;
}

.qr-title {
  text-align: center;
  font-size: 1.5rem;
  color: var(--text);
  font-weight: 500;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#qr-text {
  width: 100%;
  font-size: 1rem;
  border-radius: 16px;
  padding: 16px 20px;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  background: var(--surface);
  color: var(--text);
  outline: none;
  font-family: 'Kiwi Maru', sans-serif;
  box-shadow: inset 0 2px 10px rgba(132, 87, 182, 0.04);
  transition: all 0.3s ease;
}

#qr-text:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.8);
}

#qr-text::placeholder {
  color: var(--text-light);
}

.primary-btn {
  background: var(--primary);
  color: var(--on-primary);
  font-size: 1.1rem;
  font-weight: bold;
  font-family: 'Kiwi Maru', sans-serif;
  border: none;
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 12px rgba(157, 129, 209, 0.2);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(157, 129, 209, 0.3);
  filter: brightness(1.05);
}

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

.qr-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  background: rgba(255, 255, 255, 0.6);
  padding: 24px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  animation: fadeUp 0.4s ease forwards;
}

.qr-result.hidden {
  display: none;
  animation: none;
}

#qr-box {
  background: white;
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

#qr-box canvas, #qr-box img {
  display: block;
  max-width: 100%;
}

.secondary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--sec-cont);
  color: var(--on-sec-cont);
  font-size: 1rem;
  font-weight: 500;
  font-family: 'Kiwi Maru', sans-serif;
  border: 1px solid rgba(255, 182, 212, 0.35);
  border-radius: 14px;
  padding: 12px 24px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.secondary-btn:hover {
  background: rgba(247, 168, 184, 0.42);
  transform: translateY(-2px);
}

.secondary-btn:active {
  transform: scale(0.96);
}

@keyframes float {
  from { transform: translateY(0px); }
  to { transform: translateY(16px); }
}
