:root {
  --bg: #f4f2ee;
  --card: #fffdf8;
  --ink: #1f2328;
  --muted: #5e6470;
  --line: #d8d4cb;
  --accent: #0f8c6d;
  --accent-weak: #d9f4ec;
  --warn: #d68200;
  --ready: #0d6f57;
  --shadow: 0 12px 28px rgba(28, 34, 43, 0.08);
  --radius: 18px;
  --ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1100px 500px at 15% -10%, #fdf5dd 0%, transparent 55%),
    radial-gradient(1200px 650px at 90% -20%, #e4f4ff 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  font-family: Manrope, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: rgba(15, 140, 109, 0.2);
}

.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  min-height: 100dvh;
  padding: env(safe-area-inset-top, 14px) 14px max(20px, env(safe-area-inset-bottom, 14px));
  touch-action: manipulation;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -44px;
  background: #ffffff;
  color: #0c3459;
  border: 1px solid #cde0f8;
  border-radius: 8px;
  padding: 8px 10px;
  z-index: 1000;
}

.skip-link:focus-visible {
  top: 8px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.brand {
  font-family: Fraunces, Georgia, serif;
  font-weight: 700;
  font-size: 1.1rem;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: #ffffffcc;
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 600;
}

.ghost-btn:hover {
  background: #ffffff;
}

.headline h1 {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(1.45rem, 2.8vw, 2rem);
  text-wrap: balance;
}

.brand-banner {
  margin: 4px 0 12px;
  padding: 8px 10px;
  border: 1px solid #e3dfd7;
  border-radius: 12px;
  background: #fffefb;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.brand-logo {
  display: block;
  height: 18px;
  width: auto;
  max-width: 42%;
}

.brand-logo.poap {
  height: 16px;
}

.brand-cross {
  color: #7b818a;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
}

.headline p,
.meta {
  margin: 6px 0 0;
  color: var(--muted);
}

.meta {
  margin-top: 14px;
  font-size: 0.92rem;
}

.event-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.event-card {
  background: var(--card);
  border: 1px solid #ece8df;
  border-radius: 12px;
  box-shadow: 0 6px 14px rgba(28, 34, 43, 0.06);
  padding: 9px 10px;
  opacity: 0;
  transform: translateY(12px) scale(0.985);
  animation: reveal 260ms var(--ease-out) forwards;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.event-main {
  min-width: 0;
}

.event-title {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.event-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted #b6bdc8;
}

.event-link:hover {
  border-bottom-color: #516172;
}

.event-link:focus-visible,
.ghost-btn:focus-visible,
.flow-btn:focus-visible {
  outline: 2px solid #2d7ac7;
  outline-offset: 2px;
}

.event-when {
  margin-top: 3px;
  color: #3b4149;
  font-size: 0.76rem;
  line-height: 1.2;
}

.event-facts {
  margin-top: 3px;
  display: grid;
  gap: 2px;
}

.event-fact {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-fact strong {
  color: #4b535f;
  font-weight: 700;
}

.event-status-row {
  margin-top: 5px;
}

.event-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #d9dce0;
  padding: 2px 8px;
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: #f3f5f7;
  color: #616a76;
}

.event-status[data-state="enable"] {
  background: #ecf4ff;
  border-color: #ccdef7;
  color: #20548c;
}

.event-status[data-state="waiting"] {
  background: #f7f2e9;
  border-color: #eadbc0;
  color: #7a5a1c;
}

.event-status[data-state="show_qr"] {
  background: #e9fbf4;
  border-color: #b8ead8;
  color: #0b6a52;
}

.event-actions {
  display: flex;
  flex-direction: column;
  justify-items: end;
  align-items: center;
  gap: 6px;
}

.compose-preview {
  width: 100px;
  height: 100px;
  border: 1px solid #d8d4cb;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  background: #f6f7f8;
}

.compose-image,
.compose-skeleton {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.compose-image {
  object-fit: cover;
  opacity: 0;
  transition: opacity 180ms cubic-bezier(0.215, 0.61, 0.355, 1);
}

.compose-image[data-ready="true"] {
  opacity: 1;
}

.compose-skeleton {
  background: linear-gradient(
    90deg,
    #eceff2 20%,
    #f8fafb 50%,
    #eceff2 80%
  );
  background-size: 220% 100%;
  animation: shimmer 1.2s linear infinite;
}

.compose-caption {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 4px;
  z-index: 2;
  font-size: 0.61rem;
  font-weight: 700;
  line-height: 1.2;
  color: #4e5763;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(216, 220, 226, 0.8);
  border-radius: 6px;
  padding: 2px 4px;
}

.flow-btn {
  border: 1px solid transparent;
  border-radius: 10px;
  min-width: 112px;
  padding: 8px 10px;
  font-weight: 700;
  font-size: 0.73rem;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    opacity 160ms ease;
  will-change: transform, opacity;
}

.flow-btn[data-state="enable"] {
  background: #ecf4ff;
  color: #18457a;
  border-color: #cde0f8;
}

.flow-btn[data-state="enable"]:hover {
  background: #dcecff;
}

.flow-btn[data-state="waiting"] {
  background: #f2f4f6;
  color: #6c7582;
  border-color: #dbe0e6;
  animation: waitingPulse 1000ms ease-in-out infinite;
}

.flow-btn[data-state="show_qr"] {
  background: #e9fbf4;
  color: #0b6a52;
  border-color: #b8ead8;
}

.flow-btn[data-state="show_qr"]:hover {
  background: #d8f6e9;
}

.flow-btn:active,
.ghost-btn:active {
  transform: scale(0.98);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.75;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }

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

@media (min-width: 640px) {
  .app-shell {
    padding-left: 22px;
    padding-right: 22px;
  }

  .event-card { padding: 10px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }

  .event-card {
    opacity: 1;
    transform: none;
  }

  .flow-btn[data-state="waiting"] {
    animation: none !important;
  }
}

@keyframes waitingPulse {
  0% { opacity: 1; }
  50% { opacity: 0.7; }
  100% { opacity: 1; }
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
