/* main menu */

body.channel-splash {
  background-color: black;
}

.main-menu {
  margin: 0;
  transition: transform 900ms, opacity 400ms, background-color 900ms, visibility 900ms;
  opacity: 1;
  visibility: visible;
  background-image: url(../images/bg-pattern.png);
  background-color: lightgrey;
  width: 100%;
  height: 100vh;
  min-height: 100vh;
}

.main-menu.channel-splash {
  transform: scale(4);
  opacity: 0;
  background-color: black;
  background-image: none !important;
  visibility: hidden;
}

.top-section {
  height: calc(100% - 219px);
  padding: 80px;
  padding-top: 3vh;
  padding-bottom: 0;
  box-sizing: border-box;
}

.wip-modal-overlay {
  position: absolute;
  inset: 0;
  z-index: 1600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(206, 212, 219, 0.66);
  backdrop-filter: blur(7px);
}

.wip-modal-overlay.hidden {
  display: none;
}

.wip-modal-card {
  width: min(560px, 100%);
  padding: 22px 28px 28px;
  border-radius: 28px;
  border: 2px solid rgba(130, 188, 211, 0.9);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(239, 245, 248, 0.97) 100%);
  box-shadow: 0 24px 50px rgba(101, 113, 129, 0.26), inset 0 2px 0 rgba(255, 255, 255, 0.92), inset 0 -14px 24px rgba(184, 196, 210, 0.2);
  text-align: center;
  font-family: 'Asap', sans-serif;
  color: #56636f;
}

.wip-modal-header {
  display: inline-block;
  margin-bottom: 12px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(117, 210, 247, 0.16);
  color: #48b9ee;
  font-size: 16px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.wip-modal-card h2 {
  margin: 0 0 12px;
  color: #5f6974;
  font-size: 42px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.wip-modal-card p {
  margin: 0 auto 24px;
  max-width: 420px;
  line-height: 1.45;
  font-size: 22px;
}

.wip-modal-confirm {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 188px;
  width: auto;
  height: 62px;
  margin: 0;
  padding: 0 30px;
  outline: none;
  border: 2px solid rgba(117, 210, 247, 0.62);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(227, 239, 246, 0.96) 100%);
  color: #4cbff2 !important;
  font-family: 'Asap', sans-serif;
  font-weight: 500;
  font-size: 24px;
  line-height: 1;
  text-decoration: none;
  cursor: url(../images/cursor.png), auto !important;
  box-shadow: 0 10px 16px rgba(115, 127, 140, 0.18), inset 0 2px 0 rgba(255, 255, 255, 0.9);
}

.wip-modal-confirm:before,
.wip-modal-confirm:after {
  display: none;
}

.wip-modal-confirm::-moz-focus-inner {
  border: 0;
  padding: 0;
}

.wip-modal-confirm:hover {
  cursor: url(../images/cursor.png), auto !important;
  transform: scale(1.04);
  box-shadow: 0 14px 22px rgba(115, 127, 140, 0.22), inset 0 2px 0 rgba(255, 255, 255, 0.95);
}

.bottom-section {
  height: 219px;
  background: #d2d6db;
  background-image: url(../images/bottom-bg.png);
}

.col {
  width: 24%;
  height: 100%;
  display: inline-block;
  box-sizing: border-box;
}

.col.first {
  margin-left: 20px;
}

.channel-icon {
  display: block;
  width: 20.2vw;
  height: 11.1vw;
  margin-top: 2vh;
  position: relative;
  margin-left: auto;
  margin-right: auto;
}

.channel-icon.blank {
  background-image: url(../images/channel-spritesheet.png);
  background-size: calc(100% * 3) 100%;
}

.channel-icon.blank:before {
  position: absolute;
  top: 0;
  left: 0;
  width: 20.2vw;
  height: 11.1vw;
  content: '';
  background-image: url(../images/channel-wiilogo.png);
  background-size: 100% 100%;
}

.channel-icon:after {
  position: absolute;
  top: 0;
  left: 0;
  width: 20.2vw;
  height: 11.1vw;
  content: '';
  background-image: url(../images/channel-border.png);
  background-size: 100% 100%;
}

.channel-icon.occupied .hover {
  position: absolute;
  top: 0;
  left: 0;
  width: 20.2vw;
  height: 11.1vw;
  content: '';
  background-image: url(../images/channel-hover.png);
  background-size: 100% 100%;
  z-index: 99;
  opacity: 0;
  transition: 400ms ease;
  transform: scale(0.94);
}

.channel-icon.occupied .hover:hover {
  display: block;
  opacity: 1;
  transform: scale(1.02);
}

.channel-splash .channel-icon.blank {
  background-position: 0 0 !important;
}

.channel-splash .channel-icon.occupied .hover {
  display: none !important;
}

.channel-icon img {
  display: inherit;
  width: inherit;
  height: inherit;
  /* TODO: does not work in Edge/IE11 and has shoddy browser support */
  -webkit-clip-path: polygon(2% 7%, 6% 2%, 52% 1%, 95% 3%, 98% 8%, 100% 49%, 98% 92%, 95% 97%, 50% 99%, 5% 97%, 2% 93%, 0 50%);
  clip-path: polygon(2% 7%, 6% 2%, 52% 1%, 95% 3%, 98% 8%, 100% 49%, 98% 92%, 95% 97%, 50% 99%, 5% 97%, 2% 93%, 0 50%);
}

.bottom-title {
  background-image: url(../images/bottom-title.png);
  width: 1200px;
  height: 220px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
}

.bottom-title span {
  display: none;
}

.left-button {
  position: absolute;
  bottom: 42px;
  left: 0;
  background-image: url(../images/left-button.png);
  width: 185px;
  height: 135px;
  background-size: 100% 100%;
}

.wii-button {
  background-image: url(../images/wii-button.png);
  width: 100px;
  height: 105px;
  position: absolute;
  bottom: 60px;
  left: 60px;
  background-size: 100% 100%;
}

.right-button {
  position: absolute;
  bottom: 42px;
  right: 0;
  background-image: url(../images/right-button.png);
  width: 185px;
  height: 135px;
  background-size: 100% 100%;
}

.mail-button {
  background-image: url(../images/mail-button.png);
  width: 100px;
  height: 105px;
  position: absolute;
  bottom: 60px;
  right: 60px;
  background-size: 100% 100%;
  z-index: 999;
}

.mail-button::after {
  content: '1';
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  color: #84868a;
  font-family: 'Asap', sans-serif;
  letter-spacing: -1px;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  animation: mail-notification-blink 1.1s steps(1, end) infinite;
  pointer-events: none;
}

.corner-button {
  transition: 300ms;
}

.corner-button:hover {
  transform: scale(1.1);
}

@keyframes mail-notification-blink {
  0%, 44% {
    opacity: 1;
  }

  45%, 100% {
    opacity: 0.18;
  }
}

.date {
  position: absolute;
  color: #84868a;
  font-family: 'Asap', sans-serif;
  bottom: 32px;
  left: 50%;
  transform: translate(-50%, 0);
  font-size: 40px;
  letter-spacing: -1px;
}

/* channel splash screen */

.splash-screen {
  position: absolute;
  box-sizing: border-box;
  height: 80vh;
  width: 100%;
  position: absolute;
  top: -80vh;
  left: 0;
  background-size: cover;
  transition: opacity 500ms ease, transform 500ms ease;
  opacity: 0;
  transform: scale(0.3);
}

.channel-splash .splash-screen {
  top: 0;
  opacity: 1;
  transform: scale(1);
}

/* TODO: splash bar animation comes from top for some reason in IE11 */

.splash-bar {
  height: 20vh;
  box-sizing: border-box;
  background-color: lightgrey;
  transition: bottom 500ms ease, opacity 500ms ease;
  border-top: solid 2px black;
  background-image: url(../images/splash-bar.png);
  position: absolute;
  z-index: 99;
  width: 100%;
  bottom: -20vh;
  left: 0;
  opacity: 0;
}

.channel-splash .splash-bar {
  bottom: 0;
  opacity: 1;
}

.border-topleft {
  background-image: url(../images/border-topleft.png);
  width: 306px;
  height: 230px;
  top: 0;
  left: 0;
  position: absolute;
  z-index: 9991;
}

.border-topright {
  background-image: url(../images/border-topright.png);
  width: 306px;
  height: 230px;
  top: 0;
  right: 0;
  position: absolute;
  z-index: 9992;
}

.border-bottomleft {
  background-image: url(../images/border-bottomleft.png);
  width: 306px;
  height: 230px;
  bottom: 0;
  left: 0;
  position: absolute;
  z-index: 9993;
}

.border-bottomright {
  background-image: url(../images/border-bottomright.png);
  width: 306px;
  height: 230px;
  bottom: 0;
  right: 0;
  position: absolute;
  z-index: 9994;
}

.border {
  display: none;
}

.channel-splash .border {
  display: block;
}

.splash-buttons {
  width: 50%;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  padding-top: 4.1vh;
  height: 20vh;
  box-sizing: border-box;
}

/* changes for channel -> menu transition */

.splash-switch .main-menu {
  transition: transform 400ms;
}

.splash-switch .splash-screen {
  top: 0;
}

/* buttons */

.btn {
  background-image: url(../images/btn-texture.png);
  background-size: auto 100%;
  height: 5vw;
  width: 15vw;
  display: inline-block;
  position: relative;
  margin-left: 4.5vw;
  margin-right: 4.5vw;
  text-decoration: none;
  line-height: 100%;
  font-family: 'Asap', sans-serif;
  color: #474747 !important;
  font-size: 2.2vw;
  line-height: calc(4.5vw + 5px);
  cursor: url(../images/cursor.png), auto !important; /* TODO: does not work in IE11, buggy in Chrome OS */
  transform: scale(1);
  transition: 150ms ease;
}

.btn:hover {
  transform: scale(1.1);
}

.btn:before {
  background-image: url(../images/btn-left.png);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  height: 5vw;
  width: 2.2vw;
  display: inline-block;
  content: '';
  position: absolute;
  left: -2.2vw;
}

.btn:after {
  background-image: url(../images/btn-right.png);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  height: 5vw;
  width: 2.2vw;
  display: inline-block;
  content: '';
  position: absolute;
  right: -2.2vw;
}


/* Unsupported display */

.screen-message {
  display: none;
  position: absolute;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-family: sans-serif;
  top: 20px;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  text-align: center;
}

.screen-message.hidden {
  visibility: none;
  top: 100vh;
}

.screen-message p {
  margin-top: 40px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

@media only screen and (max-height: 469px) , screen and (max-width: 1220px) , screen and (width: 1280px) and (height: 1024px) {
    .screen-message {
        display: block !important;
    }
}

/* SFX */

.sfx {
  display: none;
}

/* Animation */

.channel-icon.blank {
  -webkit-animation: play 0.3s steps(3) infinite;
  -moz-animation: play 0.3s steps(3) infinite;
  -ms-animation: play 0.3s steps(3) infinite;
  -o-animation: play 0.3s steps(3) infinite;
  animation: play 0.3s steps(3) infinite;
}

@-webkit-keyframes play {
  from { background-position-x: 0px; }
  to { background-position-x: calc(100% * 3 - 1px); }
}

@-moz-keyframes play {
  from { background-position-x: 0px; }
  to { background-position-x: calc(100% * 3 - 1px); }
}

@-ms-keyframes play {
  from { background-position-x: 0px; }
  to { background-position-x: calc(100% * 3 - 1px); }
}

@-o-keyframes play {
  from { background-position-x: 0px; }
  to { background-position-x: calc(100% * 3 - 1px); }
}

@keyframes play {
  from { background-position-x: 0px; }
  to { background-position-x: calc(100% * 3 - 1px); }
}

/* mini mode */

@media only screen and (max-height: 718px) {
  .top-section {
    height: calc(100% - 130px);
  }

  .bottom-section {
    height: 130px;
    background-image: url(../images/mini-bottom-bg.png);
  }

  .left-button-container {
    transform: scale(0.6);
    transform-origin: left;
  }

  .right-button-container {
    transform: scale(0.6);
    transform-origin: right;
  }

  .left-button, .right-button {
    bottom: 180px;
  }

  .corner-button {
    bottom: 197px;
	}

  .bottom-title {
    transform-origin: top;
    transform: scale(0.65);
  }

  .date {
    font-size: 22px;
    bottom: 17px;
  }
}

@media only screen and (max-height: 826px) {
  .top-section {
    padding-top: 1em !important;
  }
}

@media only screen and (max-height: 640px) {
  .channels {
    transform: scale(0.9);
  }
}

/*
@media only screen and (max-height: 600px) {
  .channels {
    transform: scale(0.8);
		transform-origin: top;
  }
}

@media only screen and (max-height: 524px) {
  .channels {
    transform: scale(0.7);
		transform-origin: top;
  }
} */

/* widescreen fixes */

@media only screen and (min-width: 1720px) {
  .top-section {
    transform: scale(0.9);
    padding-top: 0em !important;
  }
}

/******************/
/*    testing     */
/* needs 2b moved */
/******************/

.channels {
  max-width: 1920px;
  margin-left: auto;
  margin-right: auto;
}

@media only screen and (min-width: 1920px) {
  .channel-icon, .channel-icon *, .channel-icon:after, .channel-icon:before {
    width: 387px !important;
    height: 213px !important;
  }
}

@media only screen and (max-height: 47vw) {
  .channel-icon, .channel-icon *, .channel-icon:after, .channel-icon:before {
    width: 40vh !important;
    height: 22.5vh !important;
    max-width: 439px !important;
    max-height: 247px !important;
  }

  .channels-container {

  }
}

@media only screen and (hover: none) {
  .channel-icon.occupied .hover:hover,
  .corner-button:hover,
  .btn:hover,
  .settings-navbtn:hover,
  .settings-footer .back:hover {
    transform: none;
  }

  .channel-icon.occupied .hover:active {
    opacity: 1;
    transform: scale(1);
  }

  .corner-button:active,
  .btn:active,
  .settings-navbtn:active,
  .settings-footer .back:active {
    transform: scale(0.97);
  }
}

@media only screen and (max-width: 900px) and (orientation: portrait) {
  body {
    cursor: auto;
  }

  .wip-modal-overlay {
    padding: 18px;
    align-items: flex-start;
    padding-top: max(48px, env(safe-area-inset-top, 0px) + 22px);
  }

  .wip-modal-card {
    width: 100%;
    border-radius: 24px;
    padding: 20px 18px 22px;
  }

  .wip-modal-header {
    margin-bottom: 10px;
    font-size: 12px;
  }

  .wip-modal-card h2 {
    font-size: 34px;
  }

  .wip-modal-card p {
    margin-bottom: 20px;
    font-size: 19px;
  }

  .wip-modal-confirm {
    min-width: 170px;
    height: 56px;
    font-size: 21px;
  }

  .main-menu {
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .top-section {
    flex: 1;
    min-height: 0;
    padding: 10px 12px 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .top-section::-webkit-scrollbar {
    display: none;
  }

  .channels {
    display: flex;
    gap: 10px;
    height: 100%;
    width: max-content;
    align-items: flex-start;
  }

  .col {
    width: min(64vw, 300px);
    flex: 0 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .col.first {
    margin-left: 0;
  }

  .channel-icon,
  .channel-icon img {
    width: 100%;
    height: auto;
    aspect-ratio: 20.2 / 11.1;
  }

  .channel-icon {
    margin-top: 0;
    flex: 0 0 auto;
  }

  .channel-icon.blank:before,
  .channel-icon:after,
  .channel-icon.occupied .hover {
    width: 100%;
    height: 100%;
  }

  .bottom-section {
    position: relative;
    height: 146px;
    min-height: 146px;
    padding: 0 14px calc(8px + env(safe-area-inset-bottom));
    background-image: url(../images/mini-bottom-bg.png);
    background-size: 100% 100%;
    background-position: center;
  }

  .bottom-title {
    width: min(88vw, 360px);
    height: 92px;
    margin-top: -2px;
    background-image: url(../images/bottom-title-mobile.svg);
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    overflow: visible;
  }

  .bottom-title span {
    display: block;
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-family: 'Asap', sans-serif;
    font-size: clamp(22px, 5vw, 30px);
    font-weight: 500;
    letter-spacing: -0.02em;
    color: #59cfff;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.95);
  }

  .left-button-container,
  .right-button-container {
    position: absolute;
    bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .left-button-container {
    left: 0;
  }

  .right-button-container {
    right: 0;
  }

  .left-button,
  .right-button {
    width: 98px;
    height: 72px;
    bottom: 0;
  }

  .wii-button,
  .mail-button {
    width: 44px;
    height: 46px;
    bottom: 8px;
  }

  .wii-button {
    left: 27px;
  }

  .mail-button {
    right: 27px;
  }

  .mail-button::after {
    bottom: 7px;
    font-size: 10px;
  }

  .date {
    bottom: calc(20px + env(safe-area-inset-bottom));
    width: calc(100% - 152px);
    font-size: clamp(20px, 5vw, 28px);
    text-align: center;
  }

  .splash-screen {
    height: 74vh;
    top: -74vh;
    background-position: center;
  }

  .splash-bar {
    height: 26vh;
    min-height: 124px;
    bottom: -26vh;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background-size: 100% 100%;
  }

  .splash-buttons {
    width: 100%;
    height: 100%;
    padding-top: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
  }

  .btn {
    width: min(30vw, 140px);
    height: 36px;
    margin: 0;
    font-size: clamp(16px, 4vw, 20px);
    line-height: 36px;
  }

  .btn:before,
  .btn:after {
    width: 18px;
    height: 36px;
  }

  .btn:before {
    left: -18px;
  }

  .btn:after {
    right: -18px;
  }

  .border-topleft,
  .border-topright,
  .border-bottomleft,
  .border-bottomright {
    transform: scale(0.32);
    transform-origin: center;
  }

  .screen-message {
    display: none !important;
  }
}

@media only screen and (max-width: 520px) and (orientation: portrait) {
  .top-section {
    padding: 8px 10px 0;
  }

  .channels {
    gap: 8px;
  }

  .col {
    width: 76vw;
    gap: 8px;
  }

  .bottom-title {
    width: min(92vw, 336px);
    height: 86px;
  }

  .bottom-title span {
    top: 15px;
    font-size: 22px;
  }

  .left-button,
  .right-button {
    width: 92px;
    height: 67px;
  }

  .wii-button,
  .mail-button {
    width: 42px;
    height: 44px;
    bottom: 7px;
  }

  .wii-button {
    left: 26px;
  }

  .mail-button {
    right: 26px;
  }

  .mail-button::after {
    bottom: 7px;
    font-size: 10px;
  }

  .date {
    width: calc(100% - 138px);
    bottom: calc(18px + env(safe-area-inset-bottom));
    font-size: 20px;
  }

  .splash-buttons {
    gap: 14px;
  }

  .btn {
    width: min(32vw, 120px);
    font-size: 15px;
  }

  .border-topleft,
  .border-topright,
  .border-bottomleft,
  .border-bottomright {
    transform: scale(0.26);
  }
}
