/*
====================================
Daily Fortune
Build: DF-0020C
Sprint: 4C
Purpose:
- Preserve DF-0020B mobile space rebalance
- Quote loader fixed in JS
====================================
*/

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;

  background: #05070d;

  font-family:
    "SF Mono",
    "JetBrains Mono",
    sans-serif;

  color: #f5e6d3;
}

html {
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

#background-stage {
  position: absolute;
  inset: 0;

  z-index: 0;

  width: 100%;
  height: 100%;

  overflow: hidden;

  background: #05070d;
}

.background-layer {
  position: absolute;
  inset: -18px;

  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;

  transition:
    opacity 0.35s ease,
    filter 0.25s ease,
    transform 0.25s ease;

  will-change:
    opacity,
    filter,
    transform;
}

#background-default-layer {
  opacity: 1;

  background-image:
    linear-gradient(
      rgba(5,7,13,0.16),
      rgba(5,7,13,0.16)
    ),
    url("../assets/backgrounds/default-temple-night.webp"),
    radial-gradient(
      circle at 72% 18%,
      rgba(255,210,125,0.18),
      transparent 15%
    ),
    radial-gradient(
      circle at 30% 78%,
      rgba(255,160,70,0.12),
      transparent 24%
    ),
    linear-gradient(
      135deg,
      rgba(15,18,28,0.72),
      rgba(4,8,14,0.92)
    ),
    linear-gradient(
      180deg,
      #070911,
      #071321 52%,
      #020308
    );
}

#background-default-layer::before,
#background-default-layer::after {
  content: none;
}

#background-custom-layer {
  opacity: 0;
}

#background-dim-layer {
  position: absolute;
  inset: 0;

  background:
    rgba(0,0,0,0.65);

  transition:
    background 0.25s ease;
}

#scene {
  position: absolute;
  inset: 0;

  z-index: 1;

  width: 100%;
  height: 100%;
}

#ui-layer {
  position: relative;
  z-index: 10;

  width: 100%;
  height: 100%;

  padding: 18px;

  display: flex;
  flex-direction: column;
  justify-content: space-between;

  pointer-events: none;
}







#title-group p {
  font-size: 0.78rem;

  opacity: 0.72;

  margin-top: 4px;
}

/*
  Main fortune area
*/

#fortune-area {
  width: 100%;

  display: flex;
  flex-direction: column;
  align-items: center;

  margin-bottom: 92px;
}

#quote-panel {
  width: min(88%, 760px);

  display: flex;
  flex-direction: column;

  overflow: hidden;

  border-radius: 24px;

  background:
    rgba(10,10,14,0.24);

  backdrop-filter: blur(8px);

  border:
    1px solid rgba(255,210,140,0.08);

  box-shadow:
    0 0 30px rgba(255,180,80,0.03);
}

#quote-display {
  min-height: 90px;

  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;

  column-gap: 26px;
  row-gap: 10px;

  padding: 20px 20px 16px;

  color: #fff3d6;
}

#fortune-board-footer {
  border-top:
    1px solid rgba(255,220,160,0.08);

  padding: 12px;

  display: flex;
  justify-content: center;

  pointer-events: auto;
}

/*
  Each fortune-line is one word group.
*/

.fortune-line {
  display: flex;
  justify-content: center;

  gap: 7px;

  margin: 3px 0;
}

.fortune-tile {
  width: 36px;
  height: 46px;

  border-radius: 10px;

  display: flex;
  align-items: center;
  justify-content: center;

  background:
    radial-gradient(
      circle at top,
      rgba(255,210,130,0.10),
      transparent 55%
    ),
    linear-gradient(
      180deg,
      rgba(120,85,40,0.58),
      rgba(60,38,18,0.58)
    );

  border:
    1px solid rgba(255,220,160,0.22);

  color: #fff4d8;

  font-weight: 700;
  font-size: 1rem;

  box-shadow:
    inset 0 0 14px rgba(255,210,120,0.05),
    0 0 14px rgba(255,180,80,0.04);
}

.fortune-tile.empty {
  color: transparent;

  background:
    radial-gradient(
      circle at top,
      rgba(255,210,130,0.04),
      transparent 55%
    ),
    linear-gradient(
      180deg,
      rgba(75,52,28,0.42),
      rgba(35,25,15,0.42)
    );
}

#guess-btn {
  border: none;

  border-radius: 18px;

  cursor: pointer;

  width: 100%;
  max-width: 420px;

  padding: 12px 20px;

  font-size: 1rem;
  font-weight: 600;

  color: #fff3d8;

  background:
    linear-gradient(
      180deg,
      rgba(255,195,95,0.26),
      rgba(255,165,60,0.13)
    );

  border:
    1px solid rgba(255,220,160,0.20);

  backdrop-filter: blur(10px);

  box-shadow:
    0 0 18px rgba(255,180,80,0.06);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

#guess-btn:hover {
  transform: translateY(-2px);

  box-shadow:
    0 0 25px rgba(255,190,90,0.18);
}


/*
  DF-0018A Settings button + right drawer
*/

.icon-button {
  width: 46px;
  height: 46px;

  border: none;
  border-radius: 15px;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;

  color: #ffe4b0;

  background:
    linear-gradient(
      180deg,
      rgba(255,195,95,0.20),
      rgba(255,165,60,0.08)
    );

  border:
    1px solid rgba(255,220,160,0.16);

  backdrop-filter: blur(10px);

  box-shadow:
    0 0 18px rgba(255,180,80,0.04);

  transition:
    transform 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.icon-button:hover {
  transform: translateY(-1px);

  background:
    rgba(255,180,80,0.18);

  box-shadow:
    0 0 24px rgba(255,190,90,0.12);
}


#settings-overlay {
  position: absolute;
  inset: 0;

  z-index: 390;

  background:
    rgba(0,0,0,0.42);

  backdrop-filter: blur(4px);

  opacity: 1;

  transition:
    opacity 0.24s ease;
}

#settings-drawer {
  position: absolute;
  top: 0;
  right: 0;

  z-index: 400;

  width: min(92vw, 380px);
  height: 100%;

  overflow-y: auto;

  padding: 22px;

  background:
    radial-gradient(
      circle at top right,
      rgba(255,190,90,0.10),
      transparent 38%
    ),
    linear-gradient(
      180deg,
      rgba(15,16,24,0.96),
      rgba(7,9,14,0.96)
    );

  border-left:
    1px solid rgba(255,220,160,0.12);

  box-shadow:
    -20px 0 60px rgba(0,0,0,0.45);

  transform: translateX(0);

  transition:
    transform 0.26s ease;
}

#settings-overlay.settings-hidden {
  opacity: 0;
  pointer-events: none;
}

#settings-drawer.settings-hidden {
  transform: translateX(104%);
  pointer-events: none;
}

#settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;

  margin-bottom: 24px;
}

#settings-header h2 {
  color: #ffe6b2;

  font-size: 1.35rem;

  margin-bottom: 6px;
}

#settings-header p {
  color: #ffd89f;

  font-size: 0.78rem;

  opacity: 0.72;

  line-height: 1.35rem;
}

#settings-close {
  font-size: 1.45rem;
}

.settings-section {
  margin-bottom: 26px;

  padding-bottom: 24px;

  border-bottom:
    1px solid rgba(255,220,160,0.08);
}

.settings-section h3 {
  color: #ffe4b0;

  font-size: 1rem;

  margin-bottom: 12px;
}

.settings-note {
  color: #ffd89f;

  opacity: 0.66;

  font-size: 0.76rem;

  line-height: 1.25rem;

  margin-bottom: 14px;
}

.settings-button-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;

  margin-bottom: 18px;
}

.settings-action,
.choice-card {
  border: none;

  border-radius: 15px;

  cursor: pointer;

  color: #fff4df;

  background:
    rgba(255,180,80,0.09);

  border:
    1px solid rgba(255,220,160,0.10);

  padding: 13px 14px;

  text-align: left;

  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.settings-action:hover,
.choice-card:hover {
  transform: translateY(-1px);

  background:
    rgba(255,180,80,0.15);

  border-color:
    rgba(255,220,160,0.20);
}

.settings-action.active {
  background:
    linear-gradient(
      180deg,
      rgba(255,195,95,0.24),
      rgba(255,165,60,0.12)
    );

  border-color:
    rgba(255,220,160,0.28);

  box-shadow:
    0 0 18px rgba(255,180,80,0.06);
}

.range-control {
  display: grid;
  grid-template-columns: 92px 1fr 44px;
  align-items: center;
  gap: 10px;

  margin-top: 14px;

  color: #fff0cc;

  font-size: 0.82rem;
}

.range-control input[type="range"] {
  width: 100%;

  accent-color: #f7c874;
}

.range-control strong {
  color: #ffd89f;

  font-size: 0.78rem;

  text-align: right;
}

.choice-grid {
  display: grid;
  gap: 10px;
}

.wallpaper-choice-grid {
  margin-bottom: 18px;
}

.wallpaper-tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;

  margin-bottom: 18px;
}

.wallpaper-tool {
  padding: 10px 9px;

  font-size: 0.76rem;

  text-align: center;
}

.wallpaper-tool.active {
  background:
    linear-gradient(
      180deg,
      rgba(255,195,95,0.24),
      rgba(255,165,60,0.12)
    );

  border-color:
    rgba(255,220,160,0.28);
}

.choice-card {
  display: flex;
  justify-content: space-between;
  align-items: center;

  width: 100%;
}

.choice-card.active {
  background:
    linear-gradient(
      180deg,
      rgba(255,195,95,0.24),
      rgba(255,165,60,0.12)
    );

  border-color:
    rgba(255,220,160,0.28);

  box-shadow:
    0 0 18px rgba(255,180,80,0.06);
}

.choice-card.active::after {
  content: "✓";

  color: #ffe4b0;

  opacity: 0.92;
}

#settings-status {
  margin-top: 10px;

  color: #ffd89f;

  opacity: 0.48;

  font-size: 0.72rem;

  text-align: center;
}

.hidden {
  display: none !important;
}

/*
  Guess modal
*/

#guess-modal {
  position: absolute;
  inset: 0;

  z-index: 100;

  display: flex;
  align-items: center;
  justify-content: center;

  background:
    rgba(0,0,0,0.45);

  backdrop-filter: blur(10px);
}

#guess-card {
  width: min(92%, 540px);

  padding: 28px;

  border-radius: 28px;

  background:
    rgba(14,14,20,0.84);

  border:
    1px solid rgba(255,220,160,0.08);

  box-shadow:
    0 0 40px rgba(255,180,80,0.08);

  text-align: center;
}

#guess-card h2 {
  margin-bottom: 14px;

  font-size: 1.25rem;

  color: #ffe8bc;
}

.preview-label {
  margin-bottom: 12px;

  color: #ffd89f;

  opacity: 0.85;

  font-size: 0.78rem;

  text-transform: uppercase;

  letter-spacing: 2px;
}

#guess-puzzle-preview {
  margin-bottom: 20px;

  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;

  column-gap: 14px;
  row-gap: 8px;
}

#guess-puzzle-preview .fortune-line {
  gap: 6px;
}

#guess-puzzle-preview .fortune-tile {
  width: 31px;
  height: 39px;

  font-size: 0.82rem;

  border-radius: 8px;
}

#guess-input {
  width: 100%;

  padding: 16px;

  border: none;

  border-radius: 16px;

  outline: none;

  font-size: 1rem;

  background:
    rgba(255,255,255,0.06);

  color: #fff5df;

  margin-bottom: 12px;
}

#guess-message {
  min-height: 22px;

  margin-bottom: 12px;

  font-size: 0.85rem;

  color: #ffd89f;

  opacity: 0.9;
}

#guess-actions {
  display: flex;
  gap: 12px;
}

#guess-actions button {
  flex: 1;

  padding: 14px;

  border: none;

  border-radius: 16px;

  cursor: pointer;

  color: #fff4df;

  background:
    rgba(255,180,80,0.12);
}

#guess-actions button:hover {
  background:
    rgba(255,180,80,0.2);
}

/*
  Reveal screen
*/

#reveal-screen {
  position: absolute;
  inset: 0;

  z-index: 200;

  display: flex;
  align-items: center;
  justify-content: center;

  background:
    rgba(3,5,10,0.93);

  backdrop-filter: blur(14px);
}

#reveal-card {
  width: min(92%, 650px);

  text-align: center;

  padding: 52px 34px;

  border-radius: 34px;

  background:
    radial-gradient(
      circle at top,
      rgba(255,190,90,0.11),
      transparent 38%
    ),
    linear-gradient(
      180deg,
      rgba(25,20,14,0.96),
      rgba(10,10,14,0.96)
    );

  border:
    1px solid rgba(255,220,160,0.12);

  box-shadow:
    0 0 60px rgba(255,180,80,0.10);
}

#reveal-symbol {
  font-size: 2.9rem;

  margin-bottom: 16px;
}

#reveal-card h2 {
  color: #ffe6b2;

  margin-bottom: 24px;

  font-size: 1.45rem;
}

#revealed-fortune {
  font-size: 1.55rem;

  line-height: 2.4rem;

  color: #fff4dc;

  margin-bottom: 30px;
}

#fortune-site {
  opacity: 0.88;

  color: #ffd89f;

  margin-bottom: 10px;
}

#fortune-date {
  opacity: 0.75;

  margin-bottom: 28px;
}

#reveal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

#reveal-actions button {
  border: none;

  border-radius: 18px;

  padding: 14px 24px;

  cursor: pointer;

  color: #fff5df;

  background:
    rgba(255,180,80,0.18);
}

#reveal-actions button:hover {
  background:
    rgba(255,180,80,0.26);
}

#save-card-btn {
  opacity: 1;
}

/*
  Ritual transition
*/

#transition-screen {
  position: absolute;
  inset: 0;

  z-index: 300;

  display: flex;
  align-items: center;
  justify-content: center;

  background:
    rgba(0,0,0,0.88);

  backdrop-filter: blur(12px);
}

#transition-text {
  font-size: 1.8rem;

  color: #ffe4b0;

  text-align: center;
}

#build-footer {
  position: absolute;

  right: 12px;
  bottom: 8px;

  z-index: 999;

  font-size: 11px;

  color: #ffd89f;

  opacity: 0.55;

  pointer-events: none;
}

@media (max-width: 700px) {

  
  #title-group p {
    font-size: 0.72rem;
  }

  #fortune-area {
    margin-bottom: 82px;
  }

  #quote-panel {
    width: 94%;
  }

  #quote-display {
    min-height: 72px;

    padding: 12px 10px 10px;

    column-gap: 18px;
    row-gap: 6px;
  }

  .fortune-line {
    gap: 4px;

    margin: 3px 0;
  }

  .fortune-tile {
    width: 24px;
    height: 34px;

    font-size: 0.82rem;

    border-radius: 8px;
  }

  #guess-puzzle-preview {
    column-gap: 10px;
    row-gap: 6px;
  }

  #guess-puzzle-preview .fortune-tile {
    width: 26px;
    height: 34px;

    font-size: 0.74rem;
  }

  #guess-actions {
    flex-direction: column;
  }

  #revealed-fortune {
    font-size: 1.2rem;

    line-height: 2rem;
  }

  #reveal-card {
    padding: 40px 24px;
  }

  #reveal-actions {
    flex-direction: column;
  }


  
  #settings-drawer {
    width: 92vw;

    padding: 20px;
  }

  .range-control {
    grid-template-columns: 84px 1fr 40px;

    gap: 8px;
  }

  .wallpaper-tools {
    grid-template-columns: repeat(3, 1fr);

    gap: 7px;
  }

  .wallpaper-tool {
    padding: 9px 6px;

    font-size: 0.72rem;
  }

}


@media (max-width: 700px) {
  }


/*
====================================
DF-0019E Stable Header
Scope:
- Header only.
- Does not touch fortune-area, quote-panel, canvas, or gameplay layout.
====================================
*/

#top-bar {
  position: relative;

  z-index: 30;

  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  gap: 12px;

  padding:
    calc(env(safe-area-inset-top, 0px) + 10px)
    calc(env(safe-area-inset-right, 0px) + 24px)
    0
    calc(env(safe-area-inset-left, 0px) + 18px);

  pointer-events: none;
}

#brand-area {
  display: flex;
  flex-direction: column;
  align-items: flex-start;

  gap: 2px;

  min-width: 0;

  pointer-events: none;
}

#brand-logo-link {
  display: inline-flex;

  pointer-events: none;

  text-decoration: none;
}

#brand-header-logo {
  display: block;

  width: clamp(250px, 22vw, 360px);
  height: auto;

  object-fit: contain;
  object-position: left center;

  border-radius: 6px;

  filter:
    drop-shadow(0 0 12px rgba(255,140,80,0.12));
}

#brand-tagline {
  margin:
    -2px
    0
    0
    clamp(36px, 3.8vw, 56px);

  color:
    rgba(255,226,180,0.84);

  font-size: clamp(0.82rem, 1vw, 0.95rem);
  line-height: 1.05rem;

  text-shadow:
    0 0 10px rgba(255,180,80,0.10);
}

#settings-btn {
  flex: 0 0 auto;

  margin-top: 2px;
  margin-right: 4px;

  pointer-events: auto;
}

@media (max-width: 700px) {
  #top-bar {
    padding:
      calc(env(safe-area-inset-top, 0px) + 8px)
      calc(env(safe-area-inset-right, 0px) + 22px)
      0
      calc(env(safe-area-inset-left, 0px) + 12px);

    gap: 8px;
  }

  #brand-header-logo {
    width: clamp(230px, 62vw, 315px);
    height: auto;
  }

  #brand-tagline {
    margin-left: clamp(34px, 11vw, 50px);

    font-size: 0.86rem;
    line-height: 1rem;
  }

  #settings-btn {
    margin-top: 2px;
    margin-right: 4px;
  }
}

@media (max-width: 420px) {
  #brand-header-logo {
    width: clamp(215px, 60vw, 290px);
  }
}



/*
====================================
DF-0020B Strong Mobile Rebalance Overrides
Scope:
- Header logo is not clickable.
- Phone/in-app browser breakpoint widened to 900px.
- Board is moved lower by reducing original margin-bottom.
====================================
*/

#brand-logo-link {
  pointer-events: none;
}

@media (max-width: 900px), (pointer: coarse) {
  #brand-header-logo {
    width: clamp(175px, 42vw, 238px);
    height: auto;
  }

  #brand-tagline {
    margin-left: clamp(24px, 7vw, 38px);

    font-size: 0.78rem;
    line-height: 0.92rem;
  }

  #fortune-area {
    margin-bottom:
      calc(env(safe-area-inset-bottom, 0px) + 30px);
  }

  #quote-panel {
    transform:
      translateY(28px);
  }
}

@media (max-width: 700px), (max-height: 950px) and (pointer: coarse) {
  #brand-header-logo {
    width: clamp(162px, 40vw, 220px);
    height: auto;
  }

  #brand-tagline {
    margin-left: clamp(22px, 6.5vw, 34px);

    font-size: 0.76rem;
    line-height: 0.9rem;
  }

  #fortune-area {
    margin-bottom:
      calc(env(safe-area-inset-bottom, 0px) + 18px);
  }

  #quote-panel {
    transform:
      translateY(36px);
  }
}

@media (max-width: 430px) {
  #brand-header-logo {
    width: clamp(152px, 38vw, 205px);
  }

  #brand-tagline {
    font-size: 0.74rem;
    line-height: 0.88rem;
  }

  #fortune-area {
    margin-bottom:
      calc(env(safe-area-inset-bottom, 0px) + 12px);
  }

  #quote-panel {
    transform:
      translateY(42px);
  }
}
