/* Daily check-in entry in the site header and its dialog. */

.header-checkin {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid #edbd00;
  border-radius: 17px;
  background: linear-gradient(180deg, #ffe36b, var(--brand-yellow));
  box-shadow: inset 0 1px 0 #fff8cf, 0 2px 7px rgb(176 128 0 / 20%);
  color: #6b4a00;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: transform .14s ease, box-shadow .14s ease, background-color .14s ease;
}

.header-checkin:hover {
  background: linear-gradient(180deg, #ffe88a, #ffc91a);
  box-shadow: inset 0 1px 0 #fffbe0, 0 4px 12px rgb(176 128 0 / 28%);
  transform: translateY(-1px);
}

.header-checkin:active {
  transform: translateY(0);
}

.header-checkin .icon {
  width: 18px;
  height: 18px;
}

.header-checkin-dot {
  position: absolute;
  top: -2px;
  right: -1px;
  width: 8px;
  height: 8px;
  border: 2px solid #f5f5f3;
  border-radius: 50%;
  background: var(--accent);
  animation: checkin-dot 2.4s ease-out infinite;
}

.header-checkin.is-done {
  border-color: #d8ddd7;
  background: #eceeea;
  box-shadow: none;
  color: #748076;
  font-weight: 600;
}

.header-checkin.is-done:hover {
  background: #e3e7e2;
  box-shadow: none;
  color: #55645a;
  transform: none;
}

.header-checkin.is-done .icon {
  color: #4d8a63;
}

.checkin-icon-done,
.header-checkin.is-done .checkin-icon-todo {
  display: none;
}

.header-checkin.is-done .checkin-icon-done {
  display: inline-block;
}

@keyframes checkin-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgb(204 0 0 / 38%); }
  45% { box-shadow: 0 0 0 5px rgb(204 0 0 / 0%); }
}

/* Dialog */
.checkin-modal {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  visibility: hidden;
  opacity: 0;
  transition: opacity .18s ease, visibility .18s ease;
}

.checkin-modal.open {
  visibility: visible;
  opacity: 1;
}

.checkin-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(28 26 22 / 48%);
  backdrop-filter: blur(3px);
}

.checkin-dialog {
  position: relative;
  width: min(420px, 100%);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  padding: 26px 26px 18px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 60px rgb(0 0 0 / 24%);
  transform: translateY(16px) scale(.97);
  transition: transform .24s cubic-bezier(.2, .9, .3, 1.1);
}

.checkin-modal.open .checkin-dialog {
  transform: none;
}

.checkin-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #999;
}

.checkin-close:hover {
  background: #f1f1ed;
  color: #444;
}

.checkin-close .icon {
  width: 18px;
  height: 18px;
}

.checkin-head {
  display: flex;
  align-items: center;
  gap: 13px;
  padding-right: 34px;
}

.checkin-emblem {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffe36b, var(--brand-yellow));
  box-shadow: inset 0 1px 0 #fff8cf;
  color: #6b4a00;
}

.checkin-emblem .icon {
  width: 25px;
  height: 25px;
}

.checkin-head-copy h2 {
  margin: 0;
  color: #2f2f2f;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.checkin-head-copy p {
  margin: 3px 0 0;
  color: #8b8b86;
  font-size: 12px;
  line-height: 1.6;
}

.checkin-balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 17px;
  padding: 9px 14px;
  border-radius: 10px;
  background: #f7f7f4;
}

.checkin-balance span {
  color: #888;
  font-size: 13px;
}

.checkin-balance strong {
  color: var(--accent);
  font-size: 21px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.checkin-form {
  display: grid;
  gap: 10px;
  margin-top: 13px;
}

.checkin-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e3e3dd;
  border-radius: 12px;
  background: #fff;
  text-align: left;
  transition: border-color .14s ease, background-color .14s ease, transform .14s ease, box-shadow .14s ease;
}

.checkin-option:hover {
  border-color: #d0d0c8;
  box-shadow: 0 4px 14px rgb(0 0 0 / 7%);
  transform: translateY(-1px);
}

.checkin-option:active {
  transform: translateY(0);
}

.checkin-option:disabled {
  cursor: wait;
  opacity: .6;
  transform: none;
}

.checkin-option.is-fixed:hover {
  border-color: #cc000066;
  background: #fff8f8;
}

.checkin-option.is-random {
  border-color: #efd58c;
  background: linear-gradient(135deg, #fffdf7, #fff6dd);
}

.checkin-option.is-random:hover {
  border-color: #e7bf4e;
  background: linear-gradient(135deg, #fffdf2, #fff0c4);
}

.checkin-option-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #f9eeee;
  color: var(--accent);
}

.checkin-option-icon .icon {
  width: 21px;
  height: 21px;
}

.is-random .checkin-option-icon {
  background: var(--brand-yellow);
  color: #6b4a00;
}

.checkin-option-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.checkin-option-copy strong {
  color: #333;
  font-size: 15px;
  font-weight: 700;
}

.checkin-option-copy small {
  color: #94948e;
  font-size: 12px;
}

.checkin-option-badge {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.is-random .checkin-option-badge {
  color: #a57300;
}

.checkin-result {
  margin-top: 13px;
  padding: 16px 14px 15px;
  border: 1px solid #e7e5da;
  border-radius: 12px;
  background: linear-gradient(180deg, #fffdf5, #fbfaf6);
  text-align: center;
}

.checkin-result-label {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  background: #e5f3e9;
  color: #2f7d4f;
  font-size: 12px;
  font-weight: 600;
}

.checkin-roll {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  margin: 8px 0 4px;
  color: var(--accent);
}

.checkin-roll-sign {
  font-size: 26px;
  font-weight: 700;
}

.checkin-roll-number {
  min-width: 90px;
  font-size: 62px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -2px;
  line-height: 1.1;
  text-align: center;
}

.checkin-roll-unit {
  color: #a07d2a;
  font-size: 13px;
  font-weight: 600;
}

.checkin-roll.is-rolling .checkin-roll-number {
  filter: blur(.7px);
  opacity: .82;
}

.checkin-roll.is-landed .checkin-roll-number {
  animation: checkin-pop .5s cubic-bezier(.2, 1.5, .4, 1) both;
}

.checkin-roll.is-landed::before,
.checkin-roll.is-landed::after {
  position: absolute;
  top: 14px;
  color: #f0b400;
  font-size: 15px;
  line-height: 1;
  content: "✦";
  opacity: 0;
  animation: checkin-spark .75s ease-out .08s both;
}

.checkin-roll.is-landed::before {
  left: 16%;
}

.checkin-roll.is-landed::after {
  right: 16%;
  top: 32px;
  color: var(--accent);
  font-size: 11px;
  animation-delay: .18s;
}

.checkin-result-balance {
  margin: 2px 0 0;
  color: #8b8b86;
  font-size: 12px;
}

.checkin-result-balance strong {
  color: #444;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.checkin-result-note {
  margin: 7px 0 12px;
  color: #9b9b94;
  font-size: 12px;
}

.checkin-result-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.checkin-result-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid #deded7;
  border-radius: 8px;
  background: #fff;
  color: #666;
  font-size: 13px;
}

.checkin-result-link:hover {
  border-color: #c9c9c0;
  color: #333;
}

.checkin-result-done {
  min-height: 36px;
  padding: 6px 20px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.checkin-result-done:hover {
  background: var(--accent-dark);
}

.checkin-error {
  margin: 12px 0 0;
  padding: 9px 12px;
  border: 1px solid #ebccd1;
  border-radius: 8px;
  background: #f7e6e7;
  color: #a94442;
  font-size: 12px;
  line-height: 1.6;
}

.checkin-tip {
  margin: 13px 0 0;
  color: #aaa9a1;
  font-size: 11px;
  text-align: center;
}

@keyframes checkin-pop {
  0% { opacity: .3; transform: scale(.35) rotate(-7deg); }
  55% { opacity: 1; transform: scale(1.16) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes checkin-spark {
  0% { opacity: 0; transform: translateY(6px) scale(.4); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-16px) scale(1.15); }
}

@media (max-width: 700px) {
  .header-checkin {
    order: 2;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
  }

  .header-checkin-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .checkin-dialog {
    padding: 22px 18px 15px;
    border-radius: 14px;
  }

  .checkin-head {
    gap: 11px;
  }

  .checkin-emblem {
    width: 42px;
    height: 42px;
  }

  .checkin-emblem .icon {
    width: 22px;
    height: 22px;
  }

  .checkin-roll-number {
    font-size: 54px;
  }

  .checkin-option {
    padding: 11px 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .header-checkin-dot,
  .checkin-roll.is-landed .checkin-roll-number,
  .checkin-roll.is-landed::before,
  .checkin-roll.is-landed::after {
    animation: none;
  }

  .checkin-modal,
  .checkin-dialog {
    transition: none;
  }
}
