@font-face {
  font-family: 'NotionHand';
  src:
    url('./assets/fonts/NotionHand Community.ttf') format('truetype'),
    url('./assets/fonts/NotionHand-Community.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'NotionInter';
  src: url('./assets/fonts/NotionInter-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'NotionInter';
  src: url('./assets/fonts/NotionInter-Regular.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'NotionInter';
  src: url('./assets/fonts/NotionInter-SemiBold.otf') format('opentype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'NotionInter';
  src: url('./assets/fonts/NotionInter-SemiBold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root,
[data-theme="light"] {
  --bg-page: #F7F6F3;
  --bg-card: #FFFFFF;
  --bg-subtle: #F7F6F3;
  --bg-hover: #EFEFEF;
  --border-color: #E9E9E7;
  --focus-ring: rgba(35, 131, 226, 0.28);
  --text-primary: #37352F;
  --text-heading: #1A1A1A;
  --text-secondary: #787774;
  --text-muted: #9B9A97;
  --btn-primary-bg: #1A1A1A;
  --btn-primary-text: #FFFFFF;
  --btn-primary-hover: #2F2F2F;
  --badge-discord-bg: #E7F3F8;
  --badge-discord-text: #183347;
  --badge-discord-dot: #2383E2;
  --badge-acu-bg: #FBF3DB;
  --badge-acu-text: #402C1B;
  --badge-acu-dot: #CB912F;
  --error-bg: #FDEBEC;
  --error-border: #F5C5C8;
  --error-text: #D44C47;
  --success-bg: #EDF3EC;
  --success-text: #1C3829;
  --success-dot: #448361;
  --radius-card: 12px;
  --radius-control: 8px;
  --shadow-subtle: 0 1px 2px rgba(15, 15, 15, 0.04);
  --doodle-opacity: 0.11;
  --icon-invert: 0;
}

[data-theme="dark"] {
  --bg-page: #191919;
  --bg-card: #202020;
  --bg-subtle: #252525;
  --bg-hover: #2F2F2F;
  --border-color: #2F2F2F;
  --focus-ring: rgba(35, 131, 226, 0.45);
  --text-primary: rgba(255, 255, 255, 0.81);
  --text-heading: #FFFFFF;
  --text-secondary: #9B9B9B;
  --text-muted: #6E6E6E;
  --btn-primary-bg: #2383E2;
  --btn-primary-text: #FFFFFF;
  --btn-primary-hover: #1B6EC2;
  --badge-discord-bg: #1D282E;
  --badge-discord-text: #529CCA;
  --badge-discord-dot: #529CCA;
  --badge-acu-bg: #372E20;
  --badge-acu-text: #DFAB01;
  --badge-acu-dot: #DFAB01;
  --error-bg: #362121;
  --error-border: #592D2D;
  --error-text: #FF7369;
  --success-bg: #1E3126;
  --success-text: #4DAB9A;
  --success-dot: #4DAB9A;
  --shadow-subtle: 0 2px 6px rgba(0, 0, 0, 0.28);
  --doodle-opacity: 0.12;
  --icon-invert: 1;
}

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

body {
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: 'NotionInter', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  position: relative;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* 1-Second Notion Love Loading Screen */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: var(--bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.loading-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: invert(var(--icon-invert));
  animation: notionLovePulse 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.loading-caption {
  font-family: 'NotionHand', cursive;
  font-size: 22px;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

@keyframes notionLovePulse {
  0% {
    opacity: 0;
    transform: scale(0.78) rotate(-6deg);
  }
  55% {
    opacity: 1;
    transform: scale(1.08) rotate(3deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* Background Notion Community Doodles Layer */
.doodles-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.doodle {
  position: absolute;
  width: 60px;
  height: 60px;
  object-fit: contain;
  opacity: var(--doodle-opacity);
  filter: invert(var(--icon-invert));
  user-select: none;
  will-change: transform;
  transition: opacity 0.25s ease, filter 0.25s ease;
}

.doodle-1 {
  top: 7%;
  left: 6%;
  width: 66px;
  height: 66px;
  animation: doodleDriftA 5.5s ease-in-out infinite;
}

.doodle-2 {
  top: 10%;
  right: 7%;
  width: 58px;
  height: 58px;
  animation: doodleDriftB 6.2s ease-in-out infinite 0.4s;
}

.doodle-3 {
  top: 44%;
  left: 4%;
  width: 54px;
  height: 54px;
  animation: doodleDriftC 5.8s ease-in-out infinite 0.9s;
}

.doodle-4 {
  top: 46%;
  right: 4.5%;
  width: 56px;
  height: 56px;
  animation: doodleDriftA 6.6s ease-in-out infinite 1.3s;
}

.doodle-5 {
  bottom: 9%;
  left: 8%;
  width: 58px;
  height: 58px;
  animation: doodleDriftB 5.2s ease-in-out infinite 0.6s;
}

.doodle-6 {
  bottom: 8%;
  right: 8%;
  width: 62px;
  height: 62px;
  animation: doodleDriftC 6.0s ease-in-out infinite 1.1s;
}

.doodle-7 {
  top: 21%;
  left: 16%;
  width: 48px;
  height: 48px;
  animation: doodleDriftC 6.8s ease-in-out infinite 1.7s;
}

.doodle-8 {
  bottom: 22%;
  right: 15%;
  width: 50px;
  height: 50px;
  animation: doodleDriftA 5.6s ease-in-out infinite 0.8s;
}

@keyframes doodleDriftA {
  0%, 100% {
    transform: translate3d(0, 0, 0) rotate(-7deg) scale(1);
  }
  50% {
    transform: translate3d(8px, -18px, 0) rotate(8deg) scale(1.05);
  }
}

@keyframes doodleDriftB {
  0%, 100% {
    transform: translate3d(0, 0, 0) rotate(6deg) scale(1);
  }
  50% {
    transform: translate3d(-10px, 16px, 0) rotate(-8deg) scale(1.04);
  }
}

@keyframes doodleDriftC {
  0%, 100% {
    transform: translate3d(0, 0, 0) rotate(-5deg);
  }
  33% {
    transform: translate3d(9px, -12px, 0) rotate(5deg);
  }
  66% {
    transform: translate3d(-7px, 10px, 0) rotate(-9deg);
  }
}

/* Main Content Wrapper */
.page-wrapper {
  width: 100%;
  max-width: 620px;
  position: relative;
  z-index: 1;
}

.bento-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bento-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow-subtle);
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Header Card */
.brand-row {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 14px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  filter: invert(var(--icon-invert));
  transition: transform 0.2s ease, filter 0.2s ease;
}

.brand-logo:hover {
  transform: rotate(-8deg) scale(1.06);
}

.brand-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-heading);
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--success-text);
  background-color: var(--success-bg);
  padding: 4px 10px;
  border-radius: 999px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--success-dot);
}

/* Theme Toggle Button */
.theme-toggle {
  appearance: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border-color);
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  background-color: var(--bg-hover);
  color: var(--text-heading);
}

.theme-icon {
  width: 15px;
  height: 15px;
}

[data-theme="light"] .icon-sun {
  display: none;
}

[data-theme="dark"] .icon-moon {
  display: none;
}

.heading-group {
  margin-bottom: 6px;
}

.handwritten-kicker {
  display: inline-block;
  font-family: 'NotionHand', cursive;
  font-size: 21px;
  line-height: 1.2;
  color: var(--text-secondary);
  margin-bottom: 2px;
  transform: rotate(-1deg);
}

.main-heading {
  font-family: 'NotionInter', 'Inter', sans-serif;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-heading);
}

.sub-heading {
  font-size: 14px;
  color: var(--text-secondary);
}

.sub-heading strong {
  font-weight: 600;
  color: var(--text-primary);
}

/* Controls Card */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.filter-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-control);
  padding: 6px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-heading);
}

.filter-btn.active {
  background-color: var(--text-heading);
  border-color: var(--text-heading);
  color: var(--bg-card);
}

.filter-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.discord-dot {
  background-color: var(--badge-discord-dot);
}

.acu-dot {
  background-color: var(--badge-acu-dot);
}

/* Search Input */
.search-form {
  width: 100%;
}

.input-wrapper {
  display: flex;
  align-items: center;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-control);
  padding: 4px 4px 4px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.input-wrapper:focus-within {
  background-color: var(--bg-card);
  border-color: #2383E2;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.at-prefix {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  user-select: none;
  margin-right: 4px;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-heading);
  padding: 8px 6px;
  outline: none;
  min-width: 0;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.verify-btn {
  appearance: none;
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
  flex-shrink: 0;
}

.verify-btn:hover {
  background-color: var(--btn-primary-hover);
}

/* Error Banner */
.error-banner {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background-color: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: var(--radius-control);
  color: var(--error-text);
  font-size: 13px;
  font-weight: 600;
}

.error-banner[hidden] {
  display: none !important;
}

.error-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* Preview Card */
.preview-card[hidden] {
  display: none !important;
}

.preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.verified-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--success-text);
  margin-bottom: 2px;
}

.attendee-name {
  font-family: 'NotionHand', cursive;
  font-size: 30px;
  font-weight: 400;
  line-height: 1.15;
  color: var(--text-heading);
  margin: 2px 0;
}

.attendee-handle {
  font-size: 13px;
  color: var(--text-muted);
}

.meta-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.event-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.event-badge.badge-discord {
  background-color: var(--badge-discord-bg);
  color: var(--badge-discord-text);
}

.event-badge.badge-acu {
  background-color: var(--badge-acu-bg);
  color: var(--badge-acu-text);
}

.date-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: 6px;
}

/* Live Certificate Canvas Preview */
.canvas-preview-container {
  width: 100%;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-control);
  overflow: hidden;
  margin-bottom: 16px;
  line-height: 0;
}

.preview-canvas {
  width: 100%;
  height: auto;
  display: block;
}

.preview-actions {
  display: flex;
  width: 100%;
}

.download-btn {
  appearance: none;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border: 1px solid var(--btn-primary-bg);
  border-radius: var(--radius-control);
  padding: 12px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.download-btn:hover {
  background-color: var(--btn-primary-hover);
}

.download-btn:active {
  transform: translateY(1px);
}

.download-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.download-icon {
  width: 16px;
  height: 16px;
}

@media (max-width: 768px) {
  .doodle-7,
  .doodle-8 {
    display: none;
  }
}

@media (max-width: 480px) {
  .bento-card {
    padding: 18px;
  }

  .status-pill {
    display: none;
  }

  .meta-badges {
    align-items: flex-start;
    flex-direction: row;
  }
}
