/* Opening attendance event: the home page's pixel world (sky backdrop, stepped frames, chunky buttons). */
html:has(.attendance-page),
body:has(.attendance-page) { background-color: #f3e8fd; }
body:has(.attendance-page) {
  background-image:
    linear-gradient(to bottom, rgba(243, 232, 253, 0) 0%, rgba(243, 232, 253, 0) 30%, rgba(243, 232, 253, 0.6) 60%, rgba(243, 232, 253, 0.95) 82%, #f3e8fd 100%),
    url("/images/background_top.png");
  background-position: top center, top center;
  background-repeat: no-repeat, no-repeat;
  background-size: 100% max(680px, 100svh), max(1208px, 100vw) auto;
}
body:has(.attendance-page) .viewport-frame { background: transparent; }

.attendance-page {
  --attendance-title: #4c30af;
  --attendance-accent: #5a43bc;
  --attendance-text: #6b6080;
  --attendance-soft: #8a7aa8;
  --attendance-pink: #c4479a;
  --attendance-frame-white: url("/images/pixel_frame_home_service_group_purple.svg?v=2");
  --attendance-frame-card: url("/images/pixel_frame_home_service_purple.svg?v=2");
  color: var(--attendance-text);
  width: min(560px, calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0 120px;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.attendance-page h1, .attendance-page h2, .attendance-page p { margin: 0; }
.attendance-page h1, .attendance-page h2, .attendance-page strong { color: var(--attendance-title); }
.attendance-page h2 { font-size: var(--type-card-title); line-height: 1.4; font-weight: 600; }
.attendance-page a { color: var(--attendance-title); }
.attendance-page__back { margin-bottom: 14px; font-size: var(--type-small); }
.attendance-page__back a { display: inline-flex; min-height: 32px; align-items: center; }

/* Shared stepped-corner frame */
.attendance-hero,
.attendance-board,
.attendance-decorations,
.attendance-notice {
  box-sizing: border-box;
  border: 14px solid transparent;
  border-image-source: var(--attendance-frame-white);
  border-image-slice: 14 fill;
  border-image-width: 1;
  border-image-repeat: stretch;
  image-rendering: pixelated;
}

/* Hero: sky scene on top, invitation below */
.attendance-hero { padding: 0; text-align: center; }
.attendance-hero__scene {
  position: relative;
  display: grid;
  height: 200px;
  margin: -4px -4px 0;
  place-items: end center;
  overflow: hidden;
  background: url("/images/fortune_header_background_today.png") center 40% / cover no-repeat;
  image-rendering: pixelated;
}
.attendance-hero__scene::before {
  position: absolute;
  inset: 0;
  background: url("/images/keyring_reward_sparkles_art.png") center / 300px auto repeat-x;
  content: "";
  opacity: .9;
}
.attendance-hero__scene::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 22px;
  background: linear-gradient(to bottom, rgba(252, 247, 255, 0), #fcf7ff);
  content: "";
}
/* Opening art already holds the sky, Tamami and gifts, so the scene shows it alone. */
.attendance-hero__scene--art {
  display: block;
  height: auto;
  margin: -12px -12px 0;
  background: #c9b6f5;
  /* Fill up to the frame's 2px outline; clip only the artwork to its inner steps. */
  clip-path: polygon(
    12px 0, calc(100% - 12px) 0,
    calc(100% - 12px) 2px, calc(100% - 8px) 2px,
    calc(100% - 8px) 4px, calc(100% - 4px) 4px,
    calc(100% - 4px) 8px, calc(100% - 2px) 8px,
    calc(100% - 2px) 12px, 100% 12px,
    100% 100%, 0 100%, 0 12px,
    2px 12px, 2px 8px, 4px 8px,
    4px 4px, 8px 4px, 8px 2px, 12px 2px
  );
}
.attendance-hero__scene--art::before { content: none; }
.attendance-hero__art {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1024 / 366;
  object-fit: cover;
  object-position: center 40%;
}
.attendance-hero__tamami {
  position: relative;
  z-index: 1;
  width: 146px;
  height: 136px;
  margin-bottom: 4px;
  object-fit: contain;
  image-rendering: pixelated;
  animation: attendance-bob 2.4s steps(2, end) infinite;
}
.attendance-hero__gift-icon {
  position: absolute;
  z-index: 1;
  bottom: 18px;
  left: calc(50% + 58px);
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
}
.attendance-hero__bubble {
  position: absolute;
  z-index: 2;
  top: 18px;
  left: 50%;
  padding: 2px 14px;
  border: 14px solid transparent;
  border-image: url("/images/pixel_frame_input.svg?v=1") 14 fill / 14px / 0 stretch;
  color: var(--attendance-accent);
  font-size: var(--type-small);
  font-weight: 600;
  white-space: nowrap;
  transform: translateX(-50%);
}
.attendance-hero__body { padding: 14px 18px 22px; }
.attendance-hero .attendance-hero__tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--attendance-soft);
  font-size: var(--type-label);
}
.attendance-hero__tag span {
  padding: 1px 8px;
  border: 4px solid transparent;
  border-image: url("/images/pixel_tag_frame_pink.svg") 4 fill / 4px / 0 stretch;
  color: var(--attendance-pink);
  font-size: var(--type-caption);
  font-weight: 700;
  letter-spacing: .06em;
}
.attendance-hero h1 { font-size: var(--type-section-title-lg); font-weight: 700; line-height: 1.35; text-wrap: balance; }
.attendance-hero .attendance-hero__description { max-width: 400px; margin: 10px auto 0; font-size: var(--type-body); line-height: 1.75; }
.attendance-hero__reward {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 6px 20px 8px;
  border: 14px solid transparent;
  border-image: url("/images/pixel_frame_attendance_gold.svg") 14 fill / 14px / 0 stretch;
  text-align: left;
}
.attendance-hero__coin { width: 44px; height: 44px; image-rendering: pixelated; }
.attendance-hero__reward p { color: #8b6a2c; font-size: var(--type-small); line-height: 1.35; }
.attendance-hero__reward strong { color: #b06a10; font-size: var(--type-display-sm); font-weight: 700; line-height: 1.1; }
.attendance-hero__reward strong small { margin-right: 2px; font-size: var(--type-body); font-weight: 600; }
.attendance-hero__reward strong span { font-size: var(--type-section-title); }
.attendance-hero .attendance-hero__hint { margin-top: 12px; color: var(--attendance-accent); font-size: var(--type-small); }

/* Stamp board */
.attendance-board { margin-top: 18px; padding: 14px 10px 16px; scroll-margin-top: 90px; }
.attendance-board__heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.attendance-board__heading p { margin-top: 6px; color: var(--attendance-soft); font-size: var(--type-small); }
.attendance-board__count {
  flex: none;
  padding: 2px 12px;
  border: 14px solid transparent;
  border-image: url("/images/pixel_frame_decoration_quiet.svg") 14 fill / 14px / 0 stretch;
  font-size: var(--type-small);
  white-space: nowrap;
}
.attendance-board__count strong { font-size: var(--type-subtitle); }
.attendance-progress { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; height: 10px; margin-top: 14px; padding: 2px; background: #e6daf8; box-shadow: 0 0 0 2px #b5a1ec; }
.attendance-progress span { background: #fff; }
.attendance-progress span.is-filled { background: repeating-linear-gradient(90deg, #e86ab8 0 6px, #f49acf 6px 12px); }
.attendance-stamps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 18px 0 16px; padding: 0; list-style: none; }
.attendance-stamp {
  --stamp-frame: url("/images/pixel_frame_decoration_quiet.svg");
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0 6px;
  border: 14px solid transparent;
  border-image: var(--stamp-frame) 14 fill / 14px / 0 stretch;
  image-rendering: pixelated;
}
.attendance-stamp__day { color: var(--attendance-soft); font-size: var(--type-caption); font-weight: 600; }
.attendance-stamp__art { display: grid; width: 40px; height: 40px; place-items: center; }
.attendance-stamp__art img { width: 40px; height: 40px; image-rendering: pixelated; }
.attendance-stamp strong { font-size: var(--type-body-lg); font-weight: 700; line-height: 1.2; }
.attendance-stamp small { color: var(--attendance-soft); font-size: var(--type-caption); }
.attendance-stamp--upcoming:not(.attendance-stamp--last) .attendance-stamp__art img { opacity: .55; filter: saturate(.6); }
.attendance-stamp--today { --stamp-frame: url("/images/pixel_frame_decoration_selected.svg"); }
.attendance-stamp--today .attendance-stamp__art img { animation: attendance-bob 1.2s steps(2, end) infinite; }
.attendance-stamp--today small { color: var(--attendance-pink); font-weight: 700; }
.attendance-stamp--received { --stamp-frame: url("/images/pixel_frame_decoration_selected.svg"); }
.attendance-stamp--received .attendance-stamp__art img { transform: rotate(-10deg); }
.attendance-stamp--received small { color: var(--attendance-pink); }
.attendance-stamp--missed { opacity: .5; filter: grayscale(.5); }
.attendance-stamp--last {
  --stamp-frame: url("/images/pixel_frame_attendance_gold.svg");
  grid-column: span 2;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 10px;
}
.attendance-stamp--last .attendance-stamp__day { flex-basis: 100%; text-align: center; }
.attendance-stamp--last .attendance-stamp__art,
.attendance-stamp--last .attendance-stamp__art img { width: 52px; height: 52px; }
.attendance-stamp--last strong { color: #b06a10; font-size: var(--type-card-title); }
.attendance-stamp--last small { flex-basis: 100%; text-align: center; }
.attendance-stamp--last.attendance-stamp--received,
.attendance-stamp--last.attendance-stamp--today { --stamp-frame: url("/images/pixel_frame_attendance_gold.svg"); }
.attendance-board .attendance-board__earned { margin-bottom: 14px; font-size: var(--type-body); text-align: center; }
.attendance-board__earned strong { color: var(--attendance-pink); }
.attendance-board__form { margin: 0; }
.attendance-page .attendance-action {
  --tamami-action-frame: url("/images/pixel_frame_attendance_primary.svg");
  appearance: none;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 54px;
  padding: 0 8px;
  border: 14px solid transparent;
  border-image-source: var(--tamami-action-frame);
  border-image-slice: 14 fill;
  border-image-width: 1;
  border-image-repeat: stretch;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  clip-path: none;
  color: #fff;
  font: inherit;
  font-size: var(--type-body-lg);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  image-rendering: pixelated;
  cursor: pointer;
}
.attendance-action:hover { filter: brightness(1.06); }
.attendance-action:active { transform: translateY(2px); }
.attendance-action:disabled { cursor: default; opacity: .6; transform: none; filter: none; }
.attendance-page a:focus-visible, .attendance-page button:focus-visible, .attendance-page summary:focus-visible { outline: 3px solid var(--attendance-title); outline-offset: 4px; }
.attendance-board .attendance-board__login, .attendance-board .attendance-board__note { margin-top: 12px; color: var(--attendance-soft); font-size: var(--type-small); line-height: 1.7; text-align: center; }
.attendance-board__login a { padding: 12px 4px; text-decoration: underline; }
.attendance-board .attendance-board__status { margin: 0 0 14px; line-height: 1.8; text-align: center; }

/* Decorations preview */
.attendance-decorations { margin-top: 18px; padding: 16px 10px 10px; text-align: center; }
.attendance-decorations > p { margin-top: 8px; color: var(--attendance-soft); font-size: var(--type-small); line-height: 1.75; }
.attendance-decorations__items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0 6px; padding: 0; list-style: none; }
.attendance-decorations__items li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 2px 4px;
  border: 14px solid transparent;
  border-image: var(--attendance-frame-card) 14 fill / 14px / 0 stretch;
  font-size: var(--type-small);
}
.attendance-decorations__items img { width: 72px; height: 72px; object-fit: contain; image-rendering: pixelated; }
.attendance-decorations__items strong { color: var(--attendance-accent); font-size: var(--type-small); }
.attendance-text-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; text-decoration: underline; text-underline-offset: 5px; }

/* Notice */
.attendance-notice { margin-top: 18px; padding: 4px 10px 8px; }
.attendance-notice summary { padding: 10px 0; color: var(--attendance-accent); font-weight: 600; cursor: pointer; }
.attendance-notice ul { margin: 0 0 6px; padding-left: 18px; font-size: var(--type-small); line-height: 1.8; }
.attendance-notice li + li { margin-top: 6px; }

@keyframes attendance-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@media (max-width: 600px) {
  .attendance-page { width: calc(100% - 24px); padding-top: 10px; }
  .attendance-hero__scene { height: 176px; }
  .attendance-hero__scene--art { height: auto; }
  .attendance-hero__art { height: 170px; aspect-ratio: auto; }
  .attendance-hero__tamami { width: 120px; height: 112px; }
  .attendance-hero__gift-icon { left: calc(50% + 46px); width: 34px; height: 34px; }
  .attendance-hero h1 { font-size: var(--type-section-title); }
  .attendance-hero__reward { gap: 10px; padding: 4px 14px 6px; }
  .attendance-hero__coin { width: 36px; height: 36px; }
  .attendance-hero__reward strong { font-size: var(--type-page-title); }
  .attendance-page h2 { font-size: var(--type-subtitle); }
  .attendance-stamps { gap: 6px; }
  .attendance-stamp__art, .attendance-stamp__art img { width: 32px; height: 32px; }
  .attendance-stamp strong { font-size: var(--type-body); }
  .attendance-decorations__items img { width: 60px; height: 60px; }
}
@media (prefers-reduced-motion: reduce) {
  .attendance-hero__tamami, .attendance-stamp--today .attendance-stamp__art img { animation: none; }
  .attendance-action:active { transform: none; }
}
