:root {
  /* OKLCH Colors (No absolute blacks or whites) */
  --primary-indigo: oklch(22% 0.04 250);
  --secondary-indigo: oklch(35% 0.07 250);
  --accent-gold: oklch(76% 0.12 85);
  --accent-gold-hover: oklch(70% 0.14 85);
  --bg-cream: oklch(98% 0.01 70);
  --card-bg: oklch(100% 0.005 70);
  --border-color: oklch(88% 0.01 250);
  --input-focus: oklch(80% 0.08 85);
  --text-dark: oklch(22% 0.04 250);
  --text-muted: oklch(50% 0.03 250);
  --text-light: oklch(98% 0.01 70);
  --success-bg: oklch(95% 0.02 140);
  --success-border: oklch(85% 0.05 140);
  --success-text: oklch(30% 0.08 140);

  --gradient-stop-1: #FFB900;
  --gradient-stop-2: #FFD700;
  --gradient-stop-3: #FFF6D6;
  --gradient-stroke-1: #FFA800;
  --gradient-stroke-2: #FFF8D6;

  --star-empty-stroke: #FFE58F;
  --star-hover-fill: #FFB900;

  --bg-texture: url("data:image/svg+xml,%3Csvg viewBox='0 0 250 250' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='washiNoise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.035 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23washiNoise)'/%3E%3C/svg%3E");

  --font-serif: 'Noto Serif JP', serif;
  --font-sans: 'Noto Sans JP', sans-serif;

  --transition-smooth: all 0.35s cubic-bezier(0.25, 1, 0.5, 1);
  --transition-elastic: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

body {
  background-color: var(--bg-cream);
  background-image: var(--bg-texture);
  color: var(--text-dark);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  line-height: 1.6;
}

/* Premium Main Card Container */
.container {
  width: 100%;
  max-width: 480px;
  background: var(--card-bg);
  background-image: var(--bg-texture);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 3rem 2rem;
  box-shadow: 0 12px 40px oklch(34% 0.089 259 / 4%);
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: cardFadeIn 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Top accent line */
.container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-indigo), var(--accent-gold), var(--primary-indigo));
}

header {
  margin-bottom: 2.5rem;
}

.logo-wrapper {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.logo {
  max-width: 100%;
  height: var(--logo-height, 90px);
  object-fit: contain;
  filter: drop-shadow(0 2px 8px oklch(34% 0.089 259 / 6%));
}

h1 {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-indigo);
  margin-bottom: 0.75rem;
  letter-spacing: 0.05em;
}

/* Accessibility utility to visually hide elements while keeping them screen-reader accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 320px;
  margin: 0 auto;
  font-weight: 300;
  line-height: 1.5;
}

/* Rating Area */
.rating-section {
  margin-bottom: 2.5rem;
  animation: itemFadeIn 0.6s 0.2s both;
}

.stars-container {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  direction: rtl;
  /* Allows hover selection in reverse (css trick) */
}

.star-btn {
  background: none;
  border: none;
  cursor: pointer;
  outline: none;
  padding: 0.25rem;
  transition: var(--transition-elastic);
  border-radius: 50%;
}

.star-btn:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 4px;
}

.star-icon {
  width: 44px;
  height: 44px;
  fill: none;
  stroke: #FFE58F;
  stroke-width: 1.5;
  transition: var(--transition-smooth);
}

/* Star Hover/Active Magic (with direction: rtl, we target hover and all subsequent stars) */
.star-btn:hover .star-icon,
.star-btn:hover~.star-btn .star-icon {
  fill: #FFB900 !important;
  stroke: none !important;
  transform: scale(1.22) rotate(6deg);
  /* Extra pop on hover */
  filter: drop-shadow(0 0 10px rgba(255, 185, 0, 0.65)) drop-shadow(0 2px 4px rgba(255, 185, 0, 0.35));
}

.star-btn.selected .star-icon,
.star-btn.selected~.star-btn .star-icon {
  fill: url(#gold-gradient) !important;
  stroke: none !important;
  filter: drop-shadow(0 0 8px oklch(76% 0.12 85 / 45%)) drop-shadow(0 2px 3px oklch(76% 0.12 85 / 25%));
}

.stars-container.has-rating .star-btn:not(.selected):not(:hover) .star-icon {
  fill: none;
  stroke: #FFE58F;
  filter: none;
}

/* Feedback Flow Forms */
.flow-section {
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition: var(--transition-smooth);
}

.flow-section.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
  animation: slideUp 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.feedback-text {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.25rem;
  text-align: left;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--secondary-indigo);
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

input,
textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--card-bg);
  color: var(--text-dark);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px oklch(76% 0.12 85 / 15%);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

/* Button System (Impeccable & Copywriting talents) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.95rem 1.75rem;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-decoration: none;
  letter-spacing: 0.03em;
  gap: 0.5rem;
}

.btn-primary {
  background-color: var(--primary-indigo);
  color: var(--text-light);
}

.btn-primary:hover {
  background-color: var(--secondary-indigo);
  box-shadow: 0 4px 12px oklch(34% 0.089 259 / 12%);
  transform: translateY(-1px);
}

.btn-accent {
  background: linear-gradient(135deg, var(--gradient-stop-3) 0%, var(--gradient-stop-2) 50%, var(--gradient-stroke-1) 100%);
  color: var(--primary-indigo);
  border: 1px solid var(--star-empty-stroke);
  box-shadow: 0 4px 15px rgba(255, 168, 0, 0.2);
}

.btn-accent:hover {
  background: linear-gradient(135deg, #FFF5B8 0%, #FFE259 50%, #FFB733 100%);
  box-shadow: 0 6px 20px rgba(255, 168, 0, 0.35);
  transform: translateY(-2px);
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--secondary-indigo);
}

.btn-outline:hover {
  border-color: var(--secondary-indigo);
  background-color: oklch(34% 0.089 259 / 2%);
}

.btn-full {
  width: 100%;
}

/* Glowing border CTA buttons using Udon Shin brand colors */
.glowing-btn {
  position: relative;
  z-index: 1;
  overflow: visible;
  color: var(--btn-text-color, var(--primary-indigo)) !important;
}

.glowing-btn::before,
.glowing-btn::after {
  content: '';
  position: absolute;
  left: -2px;
  top: -2px;
  border-radius: 10px;
  /* Slightly larger than button's 8px to align beautifully */
  background: linear-gradient(45deg,
      var(--primary-indigo),
      var(--gradient-stop-1),
      var(--gradient-stop-2),
      var(--gradient-stop-3),
      var(--primary-indigo),
      var(--gradient-stop-1),
      var(--gradient-stop-2),
      var(--gradient-stop-3),
      var(--primary-indigo));
  background-size: 400%;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  z-index: -1;
  animation: borderGlow 48s linear infinite;
  pointer-events: none;
  transition: opacity 0.3s ease, filter 0.3s ease;
}

.glowing-btn::after {
  filter: blur(8px);
  opacity: 0.65;
}

.glowing-btn:hover::after {
  filter: blur(12px);
  opacity: 0.85;
}

.glowing-btn:disabled::before,
.glowing-btn:disabled::after {
  opacity: 0 !important;
}

@keyframes borderGlow {
  0% {
    background-position: 0 0;
  }

  50% {
    background-position: 400% 0;
  }

  100% {
    background-position: 0 0;
  }
}

/* Button Icons */
.btn-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Thank You State */
.thank-you-card {
  padding: 1.5rem 0;
}

.success-banner {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.success-banner svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.compliant-choices {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.compliant-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 1.25rem 0;
}

.compliant-divider::before,
.compliant-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}

.compliant-divider:not(:empty)::before {
  margin-right: .75em;
}

.compliant-divider:not(:empty)::after {
  margin-left: .75em;
}

/* Footer credit */
.footer-credit {
  margin-top: 2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.6;
}

/* Animations */
@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes itemFadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Admin Dashboard Specific Vibe (Dark Slate Menu) */
.admin-body {
  background-color: oklch(15% 0.02 250);
  color: oklch(90% 0.01 250);
}

.admin-container {
  max-width: 720px;
  background-color: oklch(18% 0.03 250);
  border-color: oklch(25% 0.03 250);
  color: oklch(90% 0.01 250);
}

.admin-container h1 {
  color: var(--accent-gold);
}

.admin-card {
  background-color: oklch(22% 0.03 250);
  border: 1px solid oklch(28% 0.03 250);
  border-radius: 12px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.admin-card h2 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: oklch(95% 0.01 250);
  margin-bottom: 1.25rem;
  border-bottom: 1px solid oklch(28% 0.03 250);
  padding-bottom: 0.5rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 600px) {
  .admin-grid {
    grid-template-columns: 2fr 1.2fr;
  }
}

/* Toggle Switch Styling */
.switch-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: oklch(20% 0.03 250);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.switch-label-desc {
  font-size: 0.75rem;
  color: oklch(75% 0.02 250);
  margin-top: 0.25rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: oklch(35% 0.03 250);
  transition: .4s;
  border-radius: 28px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: oklch(90% 0.01 250);
  transition: .4s;
  border-radius: 50%;
}

input:checked+.slider {
  background-color: var(--accent-gold);
}

input:checked+.slider:before {
  transform: translateX(24px);
  background-color: oklch(18% 0.03 250);
}

.qr-canvas-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: oklch(22% 0.03 250);
  border: 1px dashed oklch(35% 0.03 250);
  border-radius: 8px;
  padding: 1.5rem;
  min-height: 220px;
}

#qr-canvas {
  background: white;
  padding: 8px;
  border-radius: 4px;
  max-width: 100%;
}

.qr-placeholder {
  color: oklch(75% 0.02 250);
  font-size: 0.85rem;
  text-align: center;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: var(--accent-gold);
  color: var(--primary-indigo);
  padding: 0.75rem 1.5rem;
  border-radius: 20px;
  font-weight: 500;
  font-size: 0.9rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.subtle-link {
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.6;
  text-decoration: underline;
  cursor: pointer;
  display: inline-block;
  transition: var(--transition-smooth);
}

.subtle-link:hover {
  color: var(--primary-indigo);
  opacity: 1;
}

/* Mobile-specific Optimizations (Screen width <= 480px) */
@media (max-width: 480px) {
  body {
    padding: 0.75rem;
  }
  
  .container {
    padding: 2.25rem 1.25rem;
  }
  
  h1 {
    font-size: 1.6rem;
  }
  
  .subtitle {
    font-size: 0.88rem;
  }

  .star-icon {
    width: 38px;
    height: 38px;
  }

  /* Prevent Mobile Safari from zooming in on input/textarea focus */
  input,
  textarea {
    font-size: 16px;
  }
}

/* Eliminate WebKit Tap Highlight Gray Overlay on Mobile Devices */
.star-btn,
.btn,
.subtle-link {
  -webkit-tap-highlight-color: transparent;
}

/* Haptic button tap feedback simulation on active touch */
.glowing-btn:active,
.btn:active {
  transform: scale(0.98);
  transition: transform 0.08s ease;
}