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

:root {
  --sky: #E3F3FF;
  --ink: #0b1220;
  --muted: #6b7280;
  --glass-bg: rgba(255,255,255,0.58);
  --glass-border: rgba(255,255,255,0.55);
  --glass-shadow: 0 20px 40px rgba(11,18,32,0.12);
  --blur: 18px;
}

html {
  height: 100%;
}

body {
  margin: 0;
  padding: 3rem 0 6rem 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--ink);
  background: var(--sky);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  gap: 16px;
  min-height: 100svh;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url('/assets/bgclouds.png');
  background-repeat: repeat;
  background-position: center;
  background-size: 680px auto;
  opacity: 0.7;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, rgba(0,0,0,0.6) 30%, rgba(0,0,0,0) 70%);
          mask-image: radial-gradient(circle at 50% 50%, rgba(0,0,0,0.6) 30%, rgba(0,0,0,0) 70%);
}

@media (max-width: 480px) {
  body::before {
    background-size: 520px auto;
  }
}

.card {
  width: min(92vw, 560px);
  padding: 24px 24px 20px;
  border-radius: 22px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  position: relative;
  z-index: 10;
  margin-bottom: 2.5rem;
}

.hero {
  text-align: center;
  margin: 0;
  position: relative;
  z-index: 10;
}

.hero h1 {
  margin: 0.15rem 0 0.2rem 0;
  font-size: 3.5rem;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: #1a202c;
  text-shadow: 0 2px 4px rgba(255,255,255,0.8);
  font-family: ui-rounded, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial;
}

.hero p {
  margin: 0;
  color: #2d3748;
  font-size: 1.1rem;
  opacity: 0.9;
  font-weight: 500;
}

.row {
  display: flex;
  gap: 0.6rem;
}

.row > * {
  flex: 1;
}

input,
button {
  width: 100%;
  padding: 1rem 1.1rem;
  border-radius: 12px;
  border: 1px solid #d1d5db66;
  outline: none;
  background: rgba(255,255,255,0.8);
  font-size: 1.1rem;
  box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset;
}

input::placeholder {
  font-size: 1.1rem;
}

input:focus {
  border-color: #9ac5ff;
  box-shadow: 0 0 0 3px rgba(154,197,255,0.35);
}

button {
  background: #1a202c;
  color: #fff;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
  font-weight: 500;
}

button:hover {
  background: #2d3748;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

button.secondary {
  background: linear-gradient(180deg, #6b7280, #4b5563);
  border-color: #4b5563;
}

button.secondary:hover {
  filter: brightness(1.1);
}

button.danger {
  background: linear-gradient(180deg, #dc2626, #b91c1c);
  border-color: #b91c1c;
}

button.danger:hover {
  filter: brightness(1.1);
}

button[hidden] {
  display: none !important;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.card-header button {
  width: auto !important;
  flex: 0 0 auto;
  white-space: nowrap;
}

.user-email {
  margin: 0.25rem 0 0 0;
  font-size: 1rem;
  font-weight: 600;
  word-break: break-word;
}

.key-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

.key-actions button {
  width: min(100%, 280px) !important;
}

@media (max-width: 520px) {
  .card-header {
    justify-content: space-between;
  }
}

.app-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  padding: 2.5rem 0 1.5rem;
}

.app-loading-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(11, 18, 32, 0.15);
  border-top-color: rgba(11, 18, 32, 0.6);
  animation: spin 0.8s linear infinite;
}

body.app-ready .app-loading {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 100;
}

.modal[hidden] {
  display: none;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 18, 32, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  z-index: 10;
  width: min(92vw, 420px);
  padding: 24px;
  border-radius: 18px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
}

.modal-actions {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.modal-actions button {
  width: auto !important;
  padding: 0.65rem 1.25rem;
  font-size: 0.95rem;
}

.error-text {
  color: #b91c1c;
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

.form-fields {
  margin-bottom: 1rem;
}

.form-fields label {
  display: block;
  margin-bottom: 0.45rem;
  color: #374151;
  font-size: 0.95rem;
  font-weight: 500;
}

.form-fields input + label {
  margin-top: 0.85rem;
}

.form-warning {
  margin: 0.6rem 0 1.1rem 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #374151;
  text-align: center;
}

h1 {
  margin: 0 0 0.35rem 0;
  font-size: 1.75rem;
}

.muted {
  color: var(--muted);
  font-size: 0.95rem;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.section {
  margin-top: 1.25rem;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  display: none;
}

body.app-ready .section.is-active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

body.app-ready .section:not(.is-active) {
  display: none;
}

.tutorial {
  margin-top: 1rem;
  padding-top: 0;
}

.tutorial-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.1rem;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(11, 18, 32, 0.08);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: none;
  font-size: 0.98rem;
  font-weight: 600;
  color: #1a202c;
  box-shadow: 0 2px 8px rgba(11, 18, 32, 0.08);
}

.tutorial-toggle:hover {
  transform: none;
  box-shadow: 0 4px 12px rgba(11, 18, 32, 0.12);
  background: rgba(255, 255, 255, 0.65);
}

.tutorial-toggle:active {
  transform: none;
  box-shadow: 0 2px 8px rgba(11, 18, 32, 0.08);
}

.tutorial-toggle:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.4);
  outline-offset: 2px;
}

.tutorial-toggle-icon {
  font-size: 0.9rem;
  line-height: 1;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  color: #6b7280;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.tutorial-toggle.open .tutorial-toggle-icon {
  transform: rotate(180deg);
}

.tutorial-panel {
  margin-top: 1rem;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(11, 18, 32, 0.08);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(11, 18, 32, 0.08);
  max-height: 0;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.4s ease;
}

.tutorial-panel.open {
  max-height: 1400px;
  opacity: 1;
}

.tutorial-slides {
  position: relative;
  overflow: hidden;
  transition: height 0.4s ease;
}

.tutorial-slide {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  padding: 1.2rem 1.2rem 0 1.2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  transform: translateX(15px);
}

.tutorial-slide.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}



.tutorial-step-title {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: #1a202c;
}

.tutorial-slide-content img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(11, 18, 32, 0.1);
  border: 1px solid rgba(11, 18, 32, 0.06);
  margin-bottom: 1rem;
  display: block;
  min-height: 300px;
  background: rgba(0, 0, 0, 0.02);
  object-fit: contain;
  max-width: 100%;
}

.tutorial-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem;
  background: rgba(255, 255, 255, 0.3);
}

.tutorial-nav-btn {
  width: auto !important;
  padding: 0.5rem;
  background: transparent;
  border: 1px solid rgba(11, 18, 32, 0.15);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: none;
  color: #1a202c;
}

.tutorial-nav-btn:hover {
  transform: none;
  box-shadow: none;
  background: rgba(11, 18, 32, 0.05);
}

.tutorial-nav-btn:active {
  transform: none;
  box-shadow: none;
}

.tutorial-nav-btn[disabled] {
  opacity: 0.3;
  cursor: not-allowed;
}

.tutorial-nav-btn[disabled]:hover {
  background: transparent;
}

.tutorial-progress {
  font-size: 0.88rem;
  font-weight: 600;
  color: #6b7280;
}

.tutorial-copy {
  margin-bottom: 1.5rem;
}

.tutorial-copy p {
  margin: 0 0 0.85rem 0;
  font-size: 0.96rem;
  line-height: 1.65;
  color: #2d3748;
}

.tutorial-copy p:last-child {
  margin-bottom: 0;
}

.tutorial-copy strong {
  color: #1a202c;
  font-weight: 600;
}

.tutorial-copy a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.tutorial-copy a:hover {
  text-decoration: underline;
}

.success {
  color: #065f46;
}

.error {
  color: #7f1d1d;
}

.faq-container {
  width: min(92vw, 560px);
  margin-top: 1.25rem;
  position: relative;
  z-index: 10;
}

.faq-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #1a202c;
  text-shadow: 0 1px 2px rgba(255,255,255,0.8);
}

.faq-item {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(11,18,32,0.08);
  transition: box-shadow 0.2s ease;
}

.faq-item:hover {
  box-shadow: 0 4px 12px rgba(11,18,32,0.12);
}

.faq-question {
  padding: 0.9rem 1.1rem;
  font-weight: 600;
  font-size: 1rem;
  color: #1a202c;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: background 0.2s ease;
}

.faq-question:hover {
  background: rgba(255,255,255,0.3);
}

.faq-icon {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
  color: #6b7280;
}

.faq-item.open .faq-icon {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 1.1rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #374151;
}

.faq-item.open .faq-answer {
  max-height: 500px;
  padding: 0 1.1rem 0.9rem 1.1rem;
}

.faq-answer a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}

.faq-answer a:hover {
  text-decoration: underline;
}

@media (max-width: 520px) {
  .card {
    padding: 18px;
    border-radius: 18px;
  }

  .row {
    gap: 0.5rem;
  }

  .tutorial-step-content {
    padding: 0 1rem;
  }
  
  .tutorial-step.open .tutorial-step-content {
    padding: 0 1rem 1rem 1rem;
  }
}

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

.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;
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  margin-top: auto;
  z-index: 10;
  position: relative;
}

.footer p {
  margin: 0.25rem 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

.footer p:first-child {
  font-size: 0.9rem;
}

.footer a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.footer a:hover {
  opacity: 0.7;
}
