/**
Copyright (c) 2015-2025 Crossword Nexus & Crossweird LLC

BSD-3 License

This file contains shared styles always loaded (mobile or desktop)
**/

:root {
    --main-bg-color: #ffffff;
    --header-bg-color: #E9E3DC;
    --content-bg-color: #E9E3DC;
    --main-hilite-color: #e3a67b;
    --button-bg-color: #cbc4bd;
    --button-text-color: #000000;
    --button-hover-color: #B1A79C;
    --button-note-timer-color: #EEEEEE;
    --button-note-timer-hover: #99999;
    --button-note-timer-border: #888888;
    --button-menu-bg-color: #FFFFFF;
    --top-text-wrapper-bg-color: #fff5d7;
    --top-text-wrapper-text-color: #000000;
    --clues-holder-bg-color: #EDE7DF;
    --clue-active-color: #ffeb3f;
    --clue-active-text-color: #000000;
    --clue-hover-color: #c3c3c3;
    --cluenote-text-color: #000000;
    --clue-scrollbar-color-track: #ffffff;
    --clue-scrollbar-color-thumb: #bf3028;
    --clue-scrollbar-color-thumb-hover: #bf3028;
    --main-text-color: #000000;
    --grid-selected-square-color: #da854a;
    --grid-selected-word-color: #eabc9b;
    --grid-block-color: #3F3F3F;
    --grid-none-color: #FFE8F2;
    --modal-header-bg-color: #999999;
    --modal-header-text-color: #000000;
    --modal-content-bg-color: #E9E3DC;

    --keyboard-button-bg-color: #cbc4bd;
 }

.cw-main,
.cw-main * {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  box-sizing: content-box;
  /* for consistency */
}

.selected-word-border {
  animation: glow 1.5s ease-in-out infinite;
  stroke-linejoin: round;
  rx: 2;
  ry: 2;
  pointer-events: none;
}

input.cw-hidden-input {
  opacity: 0;
  position: fixed;
  top: -100px;
  left: -100px;
  width: 0;
  height: 0;
  z-index: -1;
}

div.crossword {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.crossword {
  transition: background-color 0.3s ease, color 0.3s ease;
}

.cw-cluenote-button {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  padding: 4px 4px;
  border-radius: 4px;
  background-color: none;
  background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAXAAAAFwBhyfMcAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAACXSURBVDiNzdI9CsJQEEXhzyI7CP5sxYXYuA4t3JO9XbS21ARBXILgAoRYJA9CiOElNh6YZuDcO8UwjBkyPLEZ6EpwQdmYbayc1gFrvBsBrxh5iiv2HSFZrBwaQ8iq3i+GyO2QpE+eo+iQy3qfjmkucRt79p/LCfIvcqF6316WY5sDu19kOLTkPObswAQP3HHCEWfVr0fxAbSiWClHz+v4AAAAAElFTkSuQmCC');
  background-position: center;
  background-repeat: no-repeat;
}

.cw-cluenote-button:hover {
  background-color: var(--main-hilite-color);
}

div.cw-open-holder {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 4;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

div.cw-overflow {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: white;
  z-index: -1;
}

div.cw-main.loading div.cw-open-holder,
div.cw-main.loaded div.cw-open-holder {
  display: none;
}

.cw-open-puzzle {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 20px;
  text-align: center;
}

.cw-open-puzzle-instructions {
  font-size: 22px;
  margin-bottom: 1em;
}

.cw-open-puzzle-formats {
  font-size: 13px;
  margin-top: 1em;
  opacity: 0.7;
}

.cw-open-holder input {
  visibility: hidden;
  position: absolute;
  justify-content: center;
}

/* drag-and-drop style */
div.has-advanced-upload {
  outline: 2px dashed gray;
  outline-offset: -10px;
}

div.is-dragover {
  background-color: #fff5d7;
}

.cw-main {
  background-color: var(--main-bg-color);
  font-weight: 400;
  color: var(--main-text-color);
  bottom: 0;
  display: flex;
  flex-direction: column;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.cw-main.loading {
  visibility: hidden;
}

/**
* Modal box
**/
/* The Modal (background) */
.cw-modal {
  display: none;
  /* Hidden by default */
  position: fixed;
  /* Stay in place */
  z-index: 1;
  /* Sit on top */
  padding-top: 30px;
  /* location of the box */
  left: 0;
  top: 0;
  width: 100%;
  /* Full width */
  height: 100%;
  /* Full height */
  overflow: auto;
  /* Enable scroll if needed */
  background-color: rgb(0, 0, 0);
  /* Fallback color */
  background-color: rgba(0, 0, 0, 0.4);
  /* Black w/ opacity */
}

/* Modal Content/Box */
.modal-content {
  position: relative;
  background: var(--modal-content-bg-color);
  margin: auto;
  padding: 0;
  border: 1px solid #888;
  width: 80%;
  max-width: 600px;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
  border-radius: 5px;
  overflow: hidden;
  -webkit-animation-name: animatetop;
  -webkit-animation-duration: 0.4s;
  animation-name: animatetop;
  animation-duration: 0.3s;
}

/* Modal Header */
.modal-header {
  padding: 2px 16px;
  background-color: var(--modal-header-bg-color);
  color: var(--modal-header-text-color);
  text-align: center;
  height: 40px;
  font-size: max(1.1em, 14px);
  font-weight: 500;
}

/* Modal Body */
.modal-body {
  padding: 2px 16px;
  margin: 1em;
  font-size: max(0.8em, 12px);
}

/* Modal Footer */
.modal-footer {
  border-top: 1px solid #e5e5e5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
}

/* Modal Title */
.modal-title {
  line-height: 40px;
  /* same as the containing div, to vertically center */
}

/* Modal Animation */
@-webkit-keyframes animatetop {
  from {
    top: -300px;
    opacity: 0;
  }

  to {
    top: 0;
    opacity: 1;
  }
}

@keyframes animatetop {
  from {
    top: -300px;
    opacity: 0;
  }

  to {
    top: 0;
    opacity: 1;
  }
}

@keyframes blinking {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

.blink {
  animation: blinking 1.5s infinite;
}

/* The Close Button */
.modal-close {
  color: white;
  float: right;
  font-size: 28px;
  font-weight: bold;
}

.modal-close:hover,
.modal-close:focus {
  color: #333333;
  text-decoration: none;
  cursor: pointer;
}

/* The modal footer button */
#modal-button {
  /* the footer is 40px, so these numbers are to center it */
  margin: 5px auto;
  padding: 8px 16px;
  background-color: var(--button-bg-color);
  color: var(--button-text-color);
  border-radius: 8px;
  font-size: 14px;
}

#modal-button:hover {
  background-color: var(--button-background-color-hover);
  transition: all 0.3s ease-in-out;
}

/**
* Popup menus
**/
.cw-menu-container {
  position: relative;
}

.cw-menu {
  background-color: var(--button-menu-bg-color);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.3);
  padding: 0.2em 0;
  position: absolute;
  z-index: 1;
  /* Smooth dropdown animation */
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
  /* Keep it in the flow so transitions work */
  display: block;
}

/* When active */
.cw-menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

.cw-menu hr {
  border: 0;
  border-top: 1px solid var(--clue-active-color);
}

.cw-menu-item {
  background: none;
  border: none;
  border-radius: 4px;
  color: inherit;
  /* avoid Safari active style */
  cursor: pointer;
  display: block;
  font-size: 0.8em;
  margin: 0;
  min-width: 7em;
  padding: 0.3em 0.6em;
  text-align: left;
}

.cw-menu-item:hover {
  background-color: var(--button-hover-color);
  transition: all 0.3s ease-in-out;
}

/**
* Buttons
**/
.cw-buttons-holder {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 5px auto;
  padding: 0px 0px 6px 0px;
}

.cw-buttons-holder>*:not(:first-child) {
  margin-left: 0px;
}

.cw-buttons-holder .cw-button {
  flex: 1 1 0;
  max-width: 120px;
  height: 15px;
  text-align: center;
  font-size: 1rem;
}

.cw-button {
  --button-background-color-hover: var(--button-hover-color);
  background-color: var(--button-bg-color);
  color: var(--button-text-color);
  padding: 0.3em 0.7em;
  font-size: 0.65em;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  box-shadow: 0 1px 6px 1px rgba(0, 0, 0, 0.1);
  transition: background-color 0.25s ease, transform 0.1s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.2em;
}

.cw-button-timer {
  background-color: var(--button-note-timer-color);
  --button-background-color-hover: var(--button-note-timer-hover);
  color: var(--timer-text-color);
  font-size: 0.8em;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--button-note-timer-border);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.cw-button:hover {
  background-color: var(--button-background-color-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cw-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* large button for initial overlay */
.cw-button-open-puzzle {
    background-color: #52b323;
    --button-background-color-hover: #58ba28;
    --button-shadow-color: #368c0e;
    color: white;
    font-size: 32px;
}

/* medium-sized green button for active timer */
.cw-button-timer.running {
  --button-background-color-hover: var(--button-hover-color);
  color: var(--timer-running-text-color);
  text-shadow: var(--timer-runnning-text-shadow);
}

/* small gray button for notes */
.cw-button-notepad {
  background-color: var(--button-note-timer-color);
  --button-background-color-hover: var(--button-note-timer-hover);
  border: 1px solid var(--button-note-timer-border);
  margin: 0px;
}

/* left emoji icon */
.cw-button-icon {
  font-size: 1.25em;
  line-height: 0;
  /* never stretch button vertically */
  margin-right: 0.25em;
  width: 1.25em;
  /* standardize spacing between Chrome and Firefox */
}

/* right arrow icon for dropdown triggers */
.cw-arrow {
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  display: inline-block;
  margin-left: 0.2em;
  padding: 2px;
  transform: rotate(45deg);
  -webkit-transform: rotate(45deg);
}

/** Header stuff **/
.cw-header {
  align-items: center;
  border-bottom: 1px solid #777;
  display: flex;
  flex-direction: row !important;
  padding: 0.5em 10px;
  flex-direction: column;
  white-space: nowrap;
  background-color: var(--content-bg-color);
}

.cw-title,
.cw-author,
.cw-copyright {
    flex: 0 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cw-title {
    font-weight: bold;
}

.cw-header-separator {
    flex: 0 0 auto;
}

.cw-flex-spacer {
    flex-grow: 1;
}

.cw-header-content {
  display: flex;
  align-items: center;
  flex-direction: column;
}

/** Top text **/
.cw-top-text-wrapper {
  position: absolute;
  width: 100%;
  top: 0;
  text-align: center;
  align-items: center;
  display: inline-flex;
  height: 65px;
  background: var(--top-text-wrapper-bg-color);
  color: var(--top-text-wrapper-text-color);
  flex-shrink: 0;
  border-radius: 4px;
  box-shadow: 0px -2px 15px 6px rgba(0, 0, 0, 0.15);
}

.cw-clue-number {
  flex-shrink: 0;
  text-align: right;
  min-width: 1.7rem;
  margin-left: 0.3rem;
  margin-right: 0.7rem;
  font-weight: 600;
}

.cw-clue-text {
  flex: 1 1 auto;
  word-wrap: break-word;
  margin-right: 3px;
}

/** Clues **/
.cw-clues {
  display: flex;
  flex: 1 1 100%;
  flex-direction: column;
  margin-left: 10px;
  min-height: 1px;
  min-width: 1px;
}

.cw-clues-title {
  align-items: flex-end;
  box-sizing: border-box;
  display: flex;
  flex-shrink: 0;
  height: 1.6em;
  padding: 4px 0;
  position: relative;
  font-weight: 600;
  font-size: 1.2rem;
}

.cw-clues-items {
  flex: 1 1 auto;
  min-height: 1px;
  overflow-y: auto;
  overflow-x: hidden;
}

.cw-clue {
  margin-bottom: 1px;
  cursor: pointer;
  display: flex;
  border-radius: 4px;
}

.cw-clue.active {
  background: var(--clue-active-color);
  color: var(--clue-active-text-color);
  margin-right: 3px;
  transition: all 0.1s ease-in-out;
}

.cw-clue.passive {
  /* box-shadow: 0 0 0 2px var(--clue-active-color) inset; */
  margin-right: 3px;
  transition: all 0.1s ease-in-out;
  background: #ccc;
}

.cw-clue.completed {
  color: gray;
  opacity: 0.6;
  text-decoration: line-through;
}

.cw-clue:not(.active):not(.passive):hover {
    background: var(--clue-hover-color);
    transition: all 0.3s ease-in-out;
}

/** Input **/
.cw-input{
    outline: 1px solid var(--clue-hover-color);
    border: none;
    display: inline-flex;
    width: 90%;
    border-radius: 4px;
    padding: 5px 10px;
    margin-top: 4px;
    font-size: .9rem;
    font-weight: 800;
    left: 5px;
    opacity: .8;
}

.cw-input:hover, .cw-input:focus {
  outline: 2px solid var(--clue-active-color);
  opacity: 1;
}

.cw-button-prev-clue,
.cw-button-next-clue {
    display: none;
}

/** Letter spin **/
@keyframes letter-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.cw-cell-letter.spin {
  animation: letter-spin 0.6s ease-in-out forwards;
  transform-origin: center;
}

/** Inputs **/
input[type='checkbox'] {
  accent-color: #000000;
}

input[type='radio'] {
  accent-color: #000000;
}

/* Settings */
.settings-setting {
  padding-top: 5px;
  padding-bottom: 5px;
}

.settings-description {
  font-weight: 600;
}

.settings-label {
  display: block;
}

/** Size-specific **/
.cw-main {
    font-size: 19px;
}

.cw-max-width-1200.cw-main {
  font-size: 18px;
}

.cw-max-width-1200 .cw-buttons-holder {
  gap: 3px;
}

.cw-max-width-1200 .cw-buttons-holder .cw-button {
  font-size: 0.88rem;
}

.cw-max-width-1200 .cw-button-icon {
    margin-right: 0.1rem;
    font-size: 1rem;
    width: 1rem;
}

.cw-max-width-1200 .cw-top-text-wrapper {
  height: 55px;
}

.cw-max-width-1200 .cw-top-text {
  padding: 5px 10px 5px 10px;
}

.cw-max-width-1200 .cw-clues {
  width: 300px;
}

.cw-max-width-1200 .cw-clues-holder {
  width: auto;
}

.cw-max-width-1080.cw-main {
  font-size: 17px;
}

.cw-max-width-1080 .cw-button-icon {
    display: none;
}

.cw-max-width-1080 .cw-top-text-wrapper {
  height: 45px;
}

.cw-max-width-1080 .cw-top-text {
  padding: 4px 8px 4px 8px;
}

.cw-max-width-1080 .cw-clues {
  width: 220px;
}

.cw-max-width-850 .cw-clues-holder {
  flex-direction: column;
}

.cw-max-width-850 .cw-copyright {
    display: none;
}

.cw-max-width-600 .cw-header {
    display: none;
}

.cw-max-width-600 .cw-clues-holder {
    display: none;
}

.cw-max-width-420 .cw-buttons-holder .cw-button {
  font-size: 0.85rem;
}
