@import url('https://fonts.googleapis.com/css2?family=Notable&family=Source+Serif+4:wght@400;700&display=swap');

html {
  box-sizing: border-box;
  font-size: 16px;
}

*, *:before, *:after {
  box-sizing: inherit;
}

body, h1, h2, h3, h4, h5, h6, p {
  margin: 0;
  padding: 0;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: white;
}

a:hover {
  color: #A7CBD7;
}

body {
  background: url("/static/images/bg.webp");
  background-color: #1c1c1c;
  color: white;
  font-family: 'Source Serif 4', serif;
  font-size: 16px;
  line-height: 1.6;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.03rem;
  /* iOS safe area support */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

h1 {
  font-size: 36px;
  line-height: 40px;
}

h2 {
  font-size: 27px;
  margin-bottom: 20px;
}

.page-content {
  max-width: 900px;
  margin: 50px auto;
  background-color: #1C1C1C;
  border: 10px solid #2F2F2F;
  border-radius: 15px;
  padding: 50px 70px;
  min-height: 300px;
}

@media only screen and (max-width: 992px) {
  .page-content {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    padding: 25px 15px;
  }
}


header {
  margin-bottom: 50px;
  text-align: center;
}

header h1 {
  font-family: 'Notable', sans-serif;
  font-size: 42px;
  background: linear-gradient(90deg, #FFF 10.27%, #A7CBD7 88.52%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

header a.logo {
  display: block;
  text-decoration: none;
  color: white;
  margin-bottom: 40px;
}

header p {
  margin: 10px auto;
  text-align: center;
}

.header-tagline {
  margin-bottom: 30px;
}

.header-description {
  margin-top: 30px;
}

section {
  margin: 70px 0;
}

.ouija-board {
  text-align: center;
  margin: 50px 0;
}

.ouija-board img,
.ouija-board form {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.ouija-board form {
  margin-top: 30px;
}

.ouija-board form textarea {
  display: block;
  width: 100%;
  padding: 25px;
  font-size: 18px;
  background-color: transparent;
  outline: none;
  color: white;
  border: 4px solid #404040;
  border-radius: 10px;
  min-height: 150px;
  font-family: 'Source Serif 4', serif;
  resize: none;
}

.ouija-board form textarea:disabled {
  background-color: #3c3c3c;
}

.ouija-board form .button-wrapper {
  display: flex;
  justify-content: right;
}

.ouija-board form button {
  position: relative;
  background-color: #2F2F2F;
  color: white;
  width: 170px;
  height: 50px;
  padding: 0 20px;
  text-transform: uppercase;
  border-radius: 10px;
  margin: 20px 0 0 0;
  font-weight: bold;
  cursor: pointer;
  border: none;
  font-family: 'Source Serif 4', serif;
  font-size: 18px;
  box-shadow: 2px 2px 0px #464646;
  text-align: left;
}

.ouija-board form button:active,
.ouija-board form.processing button {
  top: 2px;
  left: 2px;
  box-shadow: none;
}

.ouija-board form button:hover {
  background-color: #3c3c3c;
}

.ouija-board form button:disabled {
  background-color: #3c3c3c;
}

.ouija-board form button::after {
  content: "⭈";
  color: white;
  position: absolute;
  top: 13px;
  right: 20px;
  font-size: 24px;
  margin-top: -10px;
  opacity: 0.3;
}

.ouija-board form.processing button::after {
  animation-duration: 0.5s;
  animation-name: buttonProcessing;
  animation-iteration-count: infinite;
  animation-timing-function: ease-out;
}

@keyframes buttonProcessing {
  0% {
    content: "⩩";
  }
  50% {
    content: "⍼";
  }
  75% {
    content: "⧍";
  }
  100% {
    content: "⌭";
  }
}

#ouija-board-output {
  font-size: 46px;
  letter-spacing: 10px;
  font-weight: bold;
  min-height: 75px;
  color: #A7CBD7;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}

@media only screen and (max-width: 992px) {
  #ouija-board-output {
    font-size: 24px;
  }
}

#ouija-board-system-message {
  display: none;
  color: #ffff8f;
}

#ouija-board-system-message.active {
  display: block;
}

.share-story-button {
  background: linear-gradient(135deg, #A7CBD7 0%, #8BB5C3 100%);
  color: #1c1c1c;
  height: 50px;
  padding: 0 30px;
  text-transform: uppercase;
  border-radius: 10px;
  margin: 20px auto;
  font-weight: bold;
  cursor: pointer;
  border: none;
  font-family: 'Source Serif 4', serif;
  font-size: 18px;
  box-shadow: 2px 2px 0px #464646;
  transition: all 0.2s ease;
}

.share-story-button:hover {
  transform: translateY(-2px);
  box-shadow: 3px 3px 0px #464646;
}

.share-story-button:active {
  transform: translateY(0);
  box-shadow: 1px 1px 0px #464646;
}

.examples {
  display: flex;
  flex-wrap: wrap;
  row-gap: 20px;
  column-gap: 10px;
  justify-content: space-between;
  margin: 20px 0;
}

.examples .example {
  position: relative;
  width: 48%;
  min-height: 100px;
  background-color: #dfdfdf;
  color: black;
  border-radius: 4px;
  padding: 20px;
}

.examples .example::before,
.examples .example::after {
  display: block;
  position: absolute;
  left: 5px;
  right: 5px;
  content: "";
  border: 1px solid #cbcbcb;
}

.examples .example::before {
  top: 5px;
}

.examples .example::after {
  bottom: 5px;
}

.examples .example:hover {
  opacity: 0.9;
}

@media only screen and (max-width: 992px) {
  .examples .example {
    width: 100%;
  }
}

/* Articles feed */
.articles {
  margin-top: 80px;
}

.articles .article-link {
  display: block;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.articles .article-link:hover {
  transform: translateY(-2px);
}

.articles article {
  display: flex;
  column-gap: 20px;
  row-gap: 20px;
  background-color: #252525;
  border: 2px solid #2F2F2F;
  border-radius: 10px;
  padding: 30px;
  margin-bottom: 30px;
  transition: border-color 0.2s ease;
}

.articles article:hover {
  border-color: #404040;
}

.articles article .article-preview .article-preview-image {
  width: 150px;
  height: 150px;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  border-radius: 8px;
  filter: grayscale(100%) contrast(0.9);
  transition: filter 0.3s ease;
}

.articles article:hover .article-preview-image {
  filter: grayscale(80%) contrast(1);
}

.articles article .article-info {
  flex: 1;
}

.articles article .article-title {
  font-size: 22px;
  font-weight: bold;
  line-height: 28px;
  color: white;
  margin-bottom: 15px;
}

.articles article .article-summary {
  color: #b8b8b8;
  line-height: 1.6;
}

@media only screen and (max-width: 992px) {
  .articles article {
    flex-wrap: wrap;
    padding: 20px;
  }

  .articles article .article-preview {
    width: 100%;
  }

  .articles article .article-preview .article-preview-image {
    width: 100%;
    height: 200px;
  }

  .articles article .article-title {
    font-size: 18px;
    line-height: 24px;
  }
}

/* Article content pages */
article .article-content p {
  margin: 20px 0;
}

article .article-content h2 {
  margin-top: 30px;
}

article .article-content img {
  width: 100%;
}

hr {
  margin: 50px 0;
  border-color: #555555;
}

.disclaimer {
  margin-top: 20px;
  font-size: 14px;
}

.products-list {
  display: flex;
  column-gap: 20px;
  row-gap: 20px;
  justify-content: space-between;
  margin-top: 50px;
  flex-wrap: wrap;
}

@media only screen and (max-width: 992px) {
  .products-list {
    flex-direction: column;
    justify-content: space-around;
  }
}

.products-list a.product {
  display: block;
  text-decoration: none;
  min-width: 300px;
}

@media only screen and (max-width: 992px) {
  .products-list a.product {
    text-align: center;
  }
}

.products-list .product .product-preview img {
  height: 350px;
  border: 15px solid white;
}

.products-list .product .product-preview img:hover {
  -webkit-filter: opacity(.8);
  filter: opacity(.8);
}

.products-list .product button {
  width: 50%;
  background-color: white;
  border: none;
  padding: 10px 0;
  margin-top: 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
}

.products-list .product button:hover {
  background-color: #A7CBD7;
}

.products-list .product .product-price {
  position: relative;
}

.products-list .product .product-price span {
  position: absolute;
  bottom: 0;
  font-size: 8px;
  bottom: 10px;
  margin-left: 2px;
}

/* CozyRoom popup */
.cozyroom-popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
}

.cozyroom-popup.active {
  display: block;
}

.cozyroom-popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
}

.cozyroom-popup-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.cozyroom-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: white;
  font-size: 30px;
  cursor: pointer;
  padding: 0;
  width: 35px;
  height: 35px;
  line-height: 35px;
  text-align: center;
  border-radius: 50%;
  opacity: 0.8;
  transition: all 0.2s ease;
  z-index: 10;
}

.cozyroom-popup-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

/* Share Story popup */
.share-story-popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
}

.share-story-popup.active {
  display: block;
}

.share-story-popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
}

.share-story-popup-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.share-story-popup-content img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  transition: opacity 0.2s ease;
}

.share-story-popup-content img.loading {
  opacity: 0;
}

.share-story-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.55));
  border-radius: 10px;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.share-story-loader.active {
  opacity: 1;
  pointer-events: auto;
}

.share-story-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(167, 203, 215, 0.3);
  border-top-color: #A7CBD7;
  border-radius: 50%;
  animation: shareStorySpin 0.9s linear infinite;
}

.share-story-loading-text {
  color: #A7CBD7;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 13px;
}

@keyframes shareStorySpin {
  to {
    transform: rotate(360deg);
  }
}

.share-story-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: white;
  font-size: 30px;
  cursor: pointer;
  padding: 0;
  width: 35px;
  height: 35px;
  line-height: 35px;
  text-align: center;
  border-radius: 50%;
  opacity: 0.8;
  transition: all 0.2s ease;
  z-index: 10;
}

.share-story-popup-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

.download-story-button {
  background: linear-gradient(135deg, #A7CBD7 0%, #8BB5C3 100%);
  color: #1c1c1c;
  height: 50px;
  padding: 0 30px;
  text-transform: uppercase;
  border-radius: 10px;
  margin: 20px auto 0;
  font-weight: bold;
  cursor: pointer;
  border: none;
  font-family: 'Source Serif 4', serif;
  font-size: 18px;
  box-shadow: 2px 2px 0px #464646;
  transition: all 0.2s ease;
  display: block;
}

.download-story-button:disabled {
  background: #2F2F2F;
  color: #8a8a8a;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.download-story-button:hover {
  transform: translateY(-2px);
  box-shadow: 3px 3px 0px #464646;
}

.download-story-button:active {
  transform: translateY(0);
  box-shadow: 1px 1px 0px #464646;
}

@media only screen and (max-width: 992px) {
  .cozyroom-popup-content {
    width: 95%;
  }

  .cozyroom-popup-close {
    top: 5px;
    right: 5px;
    font-size: 28px;
    width: 32px;
    height: 32px;
    line-height: 32px;
  }
}

.cozyroom-promo {
  margin: 100px 0;
  background-color: #121212;
  padding: 20px;
  border-radius: 10px;
}

.cozyroom-popup .cozyroom-promo {
  margin: 0;
}

.cozyroom-promo .cozyroom-promo-header {
  display: flex;
  justify-content: space-between;
  column-gap: 5px;
}

.cozyroom-promo .cozyroom-promo-header .header-space {
  width: 40%;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.cozyroom-promo .cozyroom-promo-footer {
  text-align: center;
  margin-top: 20px;
}

.cozyroom-promo-button {
  position: relative;
  background-color: #2F2F2F;
  color: white;
  width: 170px;
  height: 50px;
  padding: 0 20px;
  text-transform: uppercase;
  border-radius: 10px;
  margin: 0;
  font-weight: bold;
  cursor: pointer;
  border: none;
  font-family: 'Source Serif 4', serif;
  font-size: 18px;
  box-shadow: 2px 2px 0px #464646;
  text-align: left;
}

.cozyroom-promo-button::after {
  content: "⭈";
  color: white;
  position: absolute;
  top: 13px;
  right: 20px;
  font-size: 24px;
  margin-top: -10px;
  opacity: 0.3;
}

.cozyroom-promo-button:hover {
  background-color: #3c3c3c;
}

.cozyroom-promo-button:active {
  top: 2px;
  left: 2px;
  box-shadow: none;
}

.cozyroom-promo .character-chat {
  display: flex;
  column-gap: 20px;
  margin: 20px 0;
}

.cozyroom-promo .character .character-video {
  max-width: 180px;
}

.cozyroom-promo .character .character-video video {
  width: 100%;
}

.cozyroom-promo .chat .messages .message .message-text {
  padding: 12px 16px;
  background-color: #2b2b2b;
  border-radius: 10px;
  margin-top: 5px;
  font-size: 16px;
}

.cozyroom-promo .cozyroom-promo-header {
  text-align: center;
}

.cozyroom-promo .cozyroom-promo-footer {
  text-align: center;
}

/* Horror flicker effect - lights going out */
.horror-flicker {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: black;
  pointer-events: none;
  opacity: 0;
  z-index: 9999;
}

/* Quick, jarring flicker - single frame blackout */
.horror-flicker.flicker-quick {
  animation: flicker-quick 0.15s steps(1, jump-end);
}

/* Medium intensity - couple quick flashes */
.horror-flicker.flicker-medium {
  animation: flicker-medium 0.4s steps(2, jump-end);
}

/* Strong flicker - longer disruption */
.horror-flicker.flicker-strong {
  animation: flicker-strong 0.8s steps(3, jump-end);
}

@keyframes flicker-quick {
  0% { opacity: 0; }
  50% { opacity: 0.7; }
  100% { opacity: 0; }
}

@keyframes flicker-medium {
  0% { opacity: 0; }
  20% { opacity: 0.8; }
  40% { opacity: 0; }
  60% { opacity: 0.6; }
  100% { opacity: 0; }
}

@keyframes flicker-strong {
  0% { opacity: 0; }
  15% { opacity: 0.9; }
  25% { opacity: 0.2; }
  40% { opacity: 0.85; }
  55% { opacity: 0; }
  70% { opacity: 0.75; }
  100% { opacity: 0; }
}

/* Canvas smoothing for better quality on mobile */
#ouija-board-canvas {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: auto;
  -ms-interpolation-mode: bicubic;
}
