:root {
  --tw-blue: #123f78;
  --tw-blue-dark: #082b55;
  --tw-gold: #c99b2f;
  --tw-gold-light: #efd88e;
  --tw-ivory: #fffdf7;
  --tw-ink: #20242b;
  --tw-card-dark: #102a42;
  --tw-card-dark-deep: #091a2b;
}

.today-word-page {
  position: relative;
  min-height: 72vh;
  overflow: hidden;
  background: #f5f3ed;
  color: var(--tw-ink);
  padding: 46px 20px 76px;
  transition: background-color 700ms ease;
}

.today-word-page.has-result {
  background-color: #b88e2d;
  background-image: url('/images/today-word/wallpaper-gold-foil.webp');
  background-repeat: repeat;
  background-position: center top;
  background-size: 820px 820px;
}

.today-word-page ~ .footer {
  margin-top: 0;
}

.today-word-page.has-result .tw-header {
  margin-bottom: 26px;
}

.today-word-page.has-result .tw-kicker,
.today-word-page.has-result .tw-header h1,
.today-word-page.has-result .tw-header h1 strong,
.today-word-page.has-result .tw-intro {
  color: #102a42;
}

.today-word-page.has-result .tw-intro {
  font-size: 14px;
  line-height: 1.4;
  white-space: nowrap;
}

.today-word-page * {
  box-sizing: border-box;
  letter-spacing: 0;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.tw-header {
  max-width: 920px;
  margin: 0 auto 34px;
  text-align: center;
}

.tw-kicker {
  margin: 0 0 10px;
  color: #74591c;
  font-size: 16px;
  font-weight: 800;
}

.tw-header h1 {
  margin: 0;
  color: var(--tw-blue-dark);
  font-family: "Noto Serif KR", "Batang", serif;
  font-size: 38px;
  line-height: 1.35;
  font-weight: 700;
  word-break: keep-all;
}

.tw-header h1 strong {
  color: #8a6518;
  font-weight: 800;
}

.tw-intro {
  margin: 14px 0 0;
  color: #4d5661;
  font-size: 20px;
  font-weight: 700;
}

.tw-chooser {
  max-width: 1040px;
  margin: 0 auto;
  transition: opacity 240ms ease, transform 240ms ease;
}

.tw-chooser.is-leaving {
  opacity: 0;
  transform: translateY(-12px);
}

.tw-deck {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 16px;
  min-height: 250px;
  padding: 12px 0 24px;
}

.tw-card-button {
  position: relative;
  flex: 0 0 clamp(112px, 12vw, 154px);
  width: clamp(112px, 12vw, 154px);
  aspect-ratio: 2 / 3;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  perspective: 900px;
  transition: opacity 320ms ease, transform 420ms ease, filter 320ms ease;
  -webkit-tap-highlight-color: transparent;
}

.tw-card-button:focus-visible {
  outline: 4px solid #1d70c9;
  outline-offset: 5px;
}

.tw-card-button:hover {
  transform: translateY(-8px);
}

.tw-card-inner {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: 8px;
  transform-style: preserve-3d;
  transition: transform 720ms cubic-bezier(.2, .72, .22, 1);
  box-shadow: 0 12px 22px rgba(18, 45, 79, .22);
}

.tw-card-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid #cba744;
  border-radius: 8px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.tw-card-back {
  background-color: var(--tw-blue);
  background-image: url('/images/today-word/card-back.webp');
  background-position: center;
  background-size: cover;
}

.tw-card-jesus .tw-card-back {
  background-image: url('/images/today-word/jesus.webp');
}

.tw-card-mary .tw-card-back {
  background-image: url('/images/today-word/mary.webp');
}

.tw-card-gabriel .tw-card-back {
  background-image: url('/images/today-word/gabriel.webp');
}

.tw-card-front {
  gap: 9px;
  padding: 12px 8px;
  transform: rotateY(180deg);
  background: var(--tw-ivory);
  color: var(--tw-blue-dark);
  text-align: center;
  font-family: "Noto Serif KR", "Batang", serif;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
}

.tw-front-star {
  color: var(--tw-gold);
  font-size: 34px;
  line-height: 1;
}

.tw-deck.is-picking .tw-card-button:not(.is-selected) {
  opacity: .16;
  filter: grayscale(.75);
  transform: scale(.9);
  pointer-events: none;
}

.tw-deck.is-picking .tw-card-button.is-selected {
  z-index: 2;
  transform: translateY(-7px) scale(1.14);
  pointer-events: none;
}

.tw-card-button.is-selected .tw-card-inner {
  transform: rotateY(180deg);
  box-shadow: 0 16px 34px rgba(129, 95, 19, .35);
}

.tw-status {
  min-height: 28px;
  margin: 0;
  color: #6f5a27;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
}

.tw-result {
  max-width: 780px;
  margin: 4px auto 0;
  animation: twResultIn 820ms cubic-bezier(.16, .76, .24, 1) both;
}

.tw-result[hidden] {
  display: none !important;
}

.tw-word-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid #b88e2f;
  border-radius: 8px;
  background: var(--tw-card-dark);
  box-shadow:
    0 26px 60px rgba(6, 22, 37, .28),
    inset 0 0 0 7px var(--tw-card-dark-deep),
    inset 0 0 0 8px rgba(221, 181, 73, .72);
  padding: 30px 46px 42px;
  text-align: center;
  animation: twSacredCard 960ms cubic-bezier(.16, .76, .24, 1) both;
}

.tw-word-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url('/images/today-word/card-back.webp') center 45% / cover no-repeat;
  opacity: .24;
  mix-blend-mode: screen;
}

.tw-word-card::after {
  content: "";
  position: absolute;
  inset: 13px;
  z-index: -1;
  border: 1px solid rgba(182, 137, 37, .42);
  border-radius: 4px;
  pointer-events: none;
  animation: twFrameGlow 4.8s ease-in-out 1.2s infinite;
}

.tw-word-card > * {
  position: relative;
  z-index: 1;
}

.tw-word-card > .tw-gold-rain {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: .84;
  pointer-events: none;
}

.tw-result-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 11px;
  color: #d4d9de;
  font-size: 14px;
  animation: twSacredContent 620ms ease-out 180ms both;
}

.tw-category {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid rgba(235, 204, 112, .74);
  border-radius: 999px;
  padding: 4px 12px;
  background: rgba(5, 18, 31, .48);
  color: #f2d985;
  font-weight: 800;
}

.tw-sacred-medallion {
  position: relative;
  display: grid;
  width: 112px;
  height: 112px;
  place-items: center;
  margin: 0 auto 14px;
  animation: twMedallionRise 900ms cubic-bezier(.16, .76, .24, 1) 240ms both;
}

.tw-sacred-medallion::before,
.tw-sacred-medallion::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.tw-sacred-medallion::before {
  inset: 5px;
  border: 1px solid rgba(191, 146, 42, .72);
  box-shadow: 0 0 0 5px rgba(229, 207, 144, .22);
  animation: twHaloBreathe 4.2s ease-in-out 1.1s infinite;
}

.tw-sacred-medallion::after {
  inset: 0;
  border: 1px solid rgba(191, 146, 42, .28);
}

.tw-sacred-medallion img {
  width: 86px;
  height: 86px;
  border: 2px solid #d9bd6a;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 18%;
  box-shadow: 0 7px 18px rgba(18, 55, 94, .18);
}

.tw-crown-star {
  position: absolute;
  color: #c39325;
  font-size: 16px;
  line-height: 1;
  text-shadow: 0 0 9px rgba(225, 186, 74, .72);
  animation: twSacredTwinkle 3.1s ease-in-out infinite;
}

.tw-crown-star-left {
  top: 17px;
  left: 2px;
  animation-delay: .4s;
}

.tw-crown-star-center {
  top: -7px;
  left: 50%;
  color: #d3a52f;
  font-size: 20px;
  transform: translateX(-50%);
  animation-delay: .9s;
}

.tw-crown-star-right {
  top: 17px;
  right: 2px;
  animation-delay: 1.4s;
}

.tw-result-label {
  margin: 0;
  color: #f0d278;
  font-size: 16px;
  font-weight: 800;
  animation: twSacredContent 620ms ease-out 430ms both;
}

.tw-word-divider {
  display: grid;
  grid-template-columns: minmax(34px, 92px) auto minmax(34px, 92px);
  align-items: center;
  justify-content: center;
  gap: 11px;
  margin: 16px auto 22px;
  color: #c29327;
  animation: twSacredContent 620ms ease-out 560ms both;
}

.tw-word-divider span {
  display: block;
  width: 92px;
  max-width: 100%;
  height: 1px;
  background: #c9a84e;
  transform-origin: center;
  animation: twLineReveal 900ms ease-out 650ms both;
}

.tw-word-divider b {
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
}

.tw-word-card blockquote {
  max-width: 650px;
  margin: 0 auto 22px;
  color: #fffaf0;
  font-family: "Noto Serif KR", "Batang", serif;
  font-size: 31px;
  font-weight: 700;
  line-height: 1.7;
  word-break: keep-all;
  text-wrap: balance;
  text-shadow: 0 2px 3px rgba(0, 0, 0, .38);
  animation: twVerseReveal 820ms cubic-bezier(.16, .76, .24, 1) 680ms both;
}

.tw-reference {
  display: inline-block;
  color: #f2d67f;
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
  border-bottom: 1px solid #c8a44c;
  animation: twSacredContent 620ms ease-out 940ms both;
}

.tw-reference:focus-visible,
.tw-reference:hover {
  color: #fff4c7;
  border-bottom-color: #fff4c7;
}

.tw-blessing {
  margin: 26px 0 0;
  padding-top: 21px;
  border-top: 1px solid rgba(225, 195, 109, .42);
  color: #e3e7e9;
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
  animation: twSacredContent 620ms ease-out 1100ms both;
}

.tw-blessing::before {
  content: "✦";
  display: inline-block;
  margin-right: 8px;
  color: #edcb68;
  animation: twSacredTwinkle 3.1s ease-in-out 1.5s infinite;
}

.tw-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.tw-actions button {
  min-height: 44px;
  border: 1px solid var(--tw-blue);
  border-radius: 6px;
  padding: 10px 17px;
  background: var(--tw-blue);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.tw-actions button.secondary {
  background: #fff;
  color: var(--tw-blue);
}

.tw-actions button:focus-visible {
  outline: 3px solid #d1a632;
  outline-offset: 3px;
}

.tw-action-status,
.tw-noscript {
  min-height: 24px;
  margin: 12px 0 0;
  color: #4f5964;
  text-align: center;
  font-size: 14px;
}

.tw-effect-layer {
  position: fixed;
  inset: 0;
  z-index: 1200;
  overflow: hidden;
  pointer-events: none;
}

.tw-spark {
  position: absolute;
  width: var(--size, 7px);
  height: var(--size, 7px);
  border-radius: 50%;
  background: var(--color, #e3bc4f);
  box-shadow: 0 0 8px var(--color, #e3bc4f);
  opacity: 0;
  animation: twSpark var(--duration, 1900ms) cubic-bezier(.12, .68, .2, 1) var(--delay, 0ms) forwards;
}

.tw-spark.is-star {
  border-radius: 0;
  clip-path: polygon(50% 0, 61% 35%, 100% 50%, 61% 65%, 50% 100%, 39% 65%, 0 50%, 39% 35%);
}

.tw-spark.is-diamond {
  border-radius: 1px;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.tw-blessing-ring {
  position: absolute;
  width: 36px;
  height: 36px;
  border: var(--ring-width, 3px) solid var(--ring-color, rgba(223, 184, 71, .9));
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: twRing 1700ms ease-out var(--delay, 0ms) forwards;
}

.tw-ray {
  position: absolute;
  width: var(--ray-length, 180px);
  height: 3px;
  border-radius: 999px;
  background: var(--ray-color, #f5d778);
  box-shadow: 0 0 10px var(--ray-color, #f5d778);
  opacity: 0;
  transform-origin: left center;
  animation: twRay 1250ms ease-out var(--delay, 0ms) forwards;
}

.tw-shower {
  position: absolute;
  width: 3px;
  height: var(--drop-height, 22px);
  border-radius: 999px;
  background: var(--color, #f7e8a8);
  box-shadow: 0 0 8px var(--color, #f7e8a8);
  opacity: 0;
  animation: twShower var(--duration, 1700ms) ease-in var(--delay, 0ms) forwards;
}

@keyframes twResultIn {
  from { opacity: 0; transform: translateY(24px) scale(.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes twSacredCard {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(.975);
    box-shadow: 0 4px 14px rgba(15, 40, 68, .08);
  }
  55% {
    box-shadow:
      0 28px 68px rgba(6, 22, 37, .32),
      0 0 30px rgba(210, 169, 61, .28),
      inset 0 0 0 7px var(--tw-card-dark-deep),
      inset 0 0 0 8px rgba(221, 181, 73, .72);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes twMedallionRise {
  from { opacity: 0; transform: translateY(16px) scale(.72); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes twSacredContent {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes twVerseReveal {
  from { opacity: 0; transform: translateY(16px); filter: blur(3px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes twLineReveal {
  from { opacity: 0; transform: scaleX(0); }
  to { opacity: 1; transform: scaleX(1); }
}

@keyframes twHaloBreathe {
  0%, 100% { box-shadow: 0 0 0 5px rgba(229, 207, 144, .18); }
  50% { box-shadow: 0 0 0 9px rgba(229, 207, 144, .32); }
}

@keyframes twSacredTwinkle {
  0%, 100% { opacity: .52; }
  50% { opacity: 1; text-shadow: 0 0 13px rgba(225, 186, 74, .9); }
}

@keyframes twFrameGlow {
  0%, 100% { border-color: rgba(182, 137, 37, .36); }
  50% { border-color: rgba(182, 137, 37, .68); }
}

@keyframes twSpark {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.2); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.25); }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--turn)) scale(.35);
  }
}

@keyframes twRing {
  0% { opacity: .95; width: 36px; height: 36px; }
  100% { opacity: 0; width: var(--ring-size, 520px); height: var(--ring-size, 520px); }
}

@keyframes twRay {
  0% { opacity: 0; transform: rotate(var(--angle)) scaleX(.05); }
  18% { opacity: .92; }
  100% { opacity: 0; transform: rotate(var(--angle)) scaleX(1.2); }
}

@keyframes twShower {
  0% { opacity: 0; transform: translate3d(0, -20px, 0) rotate(12deg); }
  15% { opacity: .9; }
  100% { opacity: 0; transform: translate3d(var(--drift, 0), 260px, 0) rotate(28deg); }
}

@media (max-width: 760px) {
  .today-word-page {
    padding: 34px 14px 58px;
  }

  .tw-header {
    margin-bottom: 23px;
  }

  .tw-header h1 {
    font-size: 30px;
  }

  .tw-intro {
    font-size: 18px;
  }

  .today-word-page.has-result .tw-intro {
    font-size: 12px;
  }

  .tw-deck {
    gap: 12px;
    min-height: 0;
    padding: 8px 0 20px;
  }

  .tw-card-button {
    flex-basis: min(27vw, 108px);
    width: min(27vw, 108px);
  }

  .tw-word-card {
    padding: 24px 22px 34px;
  }

  .tw-sacred-medallion {
    width: 102px;
    height: 102px;
    margin-bottom: 12px;
  }

  .tw-sacred-medallion img {
    width: 78px;
    height: 78px;
  }

  .tw-word-card blockquote {
    font-size: 25px;
    line-height: 1.65;
  }
}

@media (max-width: 380px) {
  .tw-header h1 {
    font-size: 27px;
  }

  .today-word-page.has-result .tw-intro {
    font-size: 11px;
  }

  .tw-card-button {
    flex-basis: 26vw;
    width: 26vw;
  }

  .tw-word-card blockquote {
    font-size: 22px;
  }

  .tw-actions button {
    flex: 1 1 45%;
    padding-inline: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tw-card-button,
  .tw-card-inner,
  .tw-chooser,
  .tw-result,
  .tw-word-card,
  .tw-result-topline,
  .tw-sacred-medallion,
  .tw-sacred-medallion::before,
  .tw-crown-star,
  .tw-result-label,
  .tw-word-divider,
  .tw-word-divider span,
  .tw-word-card blockquote,
  .tw-reference,
  .tw-blessing,
  .tw-blessing::before,
  .tw-word-card::after {
    transition: none !important;
    animation: none !important;
  }

  .tw-spark,
  .tw-blessing-ring,
  .tw-ray,
  .tw-shower,
  .tw-gold-rain {
    display: none !important;
  }
}

@media print {
  .today-word-page {
    min-height: 0;
    padding: 0;
    background: #fff;
  }

  .tw-chooser,
  .tw-actions,
  .tw-action-status,
  .tw-effect-layer {
    display: none !important;
  }

  .tw-header {
    margin-bottom: 20px;
  }

  .tw-word-card {
    background: #fff;
    box-shadow: none;
  }

  .tw-word-card::before {
    display: none;
  }

  .tw-gold-rain {
    display: none !important;
  }

  .tw-result-topline,
  .tw-word-card blockquote,
  .tw-blessing {
    color: #20242b;
    text-shadow: none;
  }

  .tw-category,
  .tw-result-label,
  .tw-reference {
    color: #725719;
  }
}
