:root {
      --bg: #101014;
      --card: #1b1b23;
      --text: #f4f4f6;
      --muted: #a7a7b1;
      --accent: #ffffff;
      --danger: #ff3b30;
      --on: #FF0098;
      --off: #3a3a45;
    }

    @font-face {
      font-family: "YokohamaDotsJPN";
      src: url("/assets/fonts/YokohamaDotsJPN.otf") format("opentype");
      font-weight: normal;
      font-style: normal;
    }

    * { box-sizing: border-box; }

    html,
    body {
      margin: 0;
      overflow: hidden;
      position: fixed;
      inset: 0;
      overscroll-behavior: none;
    }

    body {
      min-height: 100vh;
      background: linear-gradient(
        to bottom,
        #4C65E0 0 18%,
        #8A9DFF 18% 38%,
        #36C3F9 38% 58%,
        #4F4291 58% 100%
      );

      color: var(--text);
      padding: 20px 20px 110px;
    }

    main {
      overflow-x: clip;
      flex: 1;
      display: flex;
      flex-direction: column;
    }

    .bg-tiles {
      position: fixed;
      inset: 0;
      z-index: -10;
      pointer-events: none;
      display: flex;
      overflow: hidden;
    }
    
    .bg-tile {
      flex: 0 0 auto;
      height: 100vh;
      width: auto;
      aspect-ratio: 256 / 1024;
      background-repeat: no-repeat;
      background-size: 100% 100%;
      image-rendering: pixelated;
    }
    
    .tile-03 {
      background-image: url("/assets/ambient/bkg/03-mute.png");
    }

    .tile-02 {
      background-image: url("/assets/ambient/bkg/02-mute.png");
    }

    body,
    button,
    input,
    select,
    textarea {
      font-family: "YokohamaDotsJPN", sans-serif;
    }

    .bg-left,
    .bg-right,
    .side-left,
    .side-right {
      position: fixed;
      inset: 0 auto 0 0;
      height: 100vh;
      pointer-events: none;
      user-select: none;
    }

    .bg-left,
    .bg-right {
      z-index: -1;
    }

    .side-left,
    .side-right {
      z-index: -2;
    }

    .bg-left,
    .side-left {
      left: 0;
    }   

    .bg-right,
    .side-right {
      left: auto;
      right: 0;
    }

    .scroll {
      position: fixed;
      inset: 0;
      overflow-y: auto;  
      display: flex;
      flex-direction: column;
      padding-top: 220px;
      padding-bottom: 0;
    }

    .top {
      position: fixed;
      top: 60px;
      left: 50%;
      transform: translateX(-50%);
      width: calc(100% - 80px);
      max-width: 600px;
      z-index: 99;
    }
  
    .top-menu {
      display: grid;
      grid-template-columns: 1fr auto 1fr;
      align-items: center;
      width: 100%;  
    }

    .top-btn {
      border: 0;
      background: transparent;
      padding: 0;
      color: var(--text);
      cursor: pointer;
      display: grid;
      place-items: center;
      image-rendering: pixelated;
    }

    .fx-toggle {
      position: relative;
      justify-self: start;
      width: 86px;
      height: 86px;
      background: transparent;
      overflow: hidden;
    }

    .reset-icon {
      position: relative;
      justify-self: end;
      width: 86px;
      height: 86px;
      background: transparent;
      overflow: hidden;
    }

    .fx-toggle::before,
    .reset-icon::before {
      content: "";
      position: absolute;
      inset: 0;
      background-color: var(--off);
      mask-image: url("/assets/ambient/button-m.png");
      mask-size: contain;
      mask-repeat: no-repeat;
      mask-position: center;
      -webkit-mask-image: url("/assets/ambient/button-m.png");
      -webkit-mask-size: contain;
      -webkit-mask-repeat: no-repeat;
      -webkit-mask-position: center;
    }

    .fx-toggle.active::before {
      background-color: var(--on);
    }

    .fx-toggle img,
    .reset-icon img {
      position: relative;
      z-index: 1;
      width: 60%;
      height: 60%;
      object-fit: contain;
      image-rendering: pixelated;
    }

    .big-plus {
      justify-self: center;
      width: 132px;
      height: 132px;
    }

    .big-plus img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      display: block;
      image-rendering: pixelated;
    }

    .reset-icon::before {
      background-color: var(--danger);
    }

    .reset-icon {
      display: none;
    }

    .reset-icon.visible {
      display: grid;
    }

    #fileInput {
      display: none;
    }

    #recordContainer {
      position: fixed;
      right: 60px;
      top: 60px;
      width: 86px;
      height: 86px;
      z-index: 999;
      pointer-events: none;
    }

    #recordTest,
    #recTimer {
      position: absolute;
      inset: 0;

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

    #recordTest {
      pointer-events: auto;
    }

    #recordTest img {
      width: 86px;
      height: 86px;
      image-rendering: pixelated;
    }

    #recTimer {
      display: none;
      pointer-events: none;
      font-size: 52px;
      color: white;
      font-weight: bold;
    }

    .tracks-wrap {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      padding: 20px;
    }

    .tracks {
      width: calc(100% - 40px);
      max-width: 600px;
      grid-template-columns: repeat(1, 1fr);
      margin: 0 auto;
      display: grid;
      gap: 8px;
      direction: rtl;
      padding: 8px;
    }

    .track {
      direction: ltr;
      position: relative;
      border: 32px solid transparent;
      border-image-source: url("/assets/ambient/bkg.png");
      border-image-slice: 32 fill;
      border-image-repeat: stretch;
      padding: 0;
      image-rendering: pixelated;
    }

    .track-main {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 180px;
      gap: 20px;
      align-items: stretch;
    }

    .track-info {
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 0;
    }

    .name {
      font-size: 20px;
      color: var(--muted);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      margin: 0 0 20px;
    }

    .slider-row {
      display: grid;
      grid-template-columns: 42px minmax(0, 1fr) 42px;
      gap: 0;
      align-items: center;
      color: var(--muted);
      font-size: 20px;
    }

    .fx-row {
      display: none;
    }

    .fx-row.visible {
      display: grid;
    }

    .track-actions {
      display: flex;
      flex-direction: column;
      gap: 20px;
    }

    .slider-row {
      display: grid;
      grid-template-columns: 24px minmax(0, 1fr) 24px;
      gap: 0;
      align-items: center;
    }

    .slider-icon {
      display: block;
      width: 24px;
      height: 24px;
      object-fit: contain;
      image-rendering: pixelated;
    }

    input[type="range"] {
      margin: 0;
      padding: 0;
    }

    input[type="range"] {
      width: 100%;
      height: 42px;
      appearance: none;
      -webkit-appearance: none;
      background: transparent;
      cursor: pointer;
    }

    input[type="range"]::-webkit-slider-runnable-track {
      height: 14px;
      background: var(--off);
    }

    input[type="range"]::-webkit-slider-thumb {
      appearance: none;
      -webkit-appearance: none;
      width: 40px;
      height: 40px;
      background-image: url("/assets/ambient/button-m.png");
      background-size: contain;
      background-repeat: no-repeat;
      background-position: center;
      background-color: transparent;
      margin-top: -13px;
      border: 0;
      border-radius: 0;
      image-rendering: pixelated;
    }

    input[type="range"]::-moz-range-thumb {
      width: 40px;
      height: 40px;
      background-image: url("/assets/ambient/button-m.png");
      background-size: contain;
      background-repeat: no-repeat;
      background-position: center;
      background-color: transparent;
      border: 0;
      border-radius: 0;
    }

    .btn {
      cursor: pointer;
      border: 12px solid transparent;
      border-image-source: url("/assets/ambient/button-n.png");
      border-image-slice: 12 fill;
      border-image-repeat: stretch;
      background: transparent;
      display: grid;
      place-items: center;
      overflow: hidden;
      min-height: 0;
      image-rendering: pixelated;
    }

    .btn-icon {
      width: 40px;
      height: 40px;
      bottom: 4px;
      object-fit: contain;
      image-rendering: pixelated;
      pointer-events: none;
      display: block;
      position: relative;
      z-index: 1;
    }

    .loop-btn,.play-btn {
      height: 56px;
      flex: 0 0 56px;
    }

    .track.fx-track .play-btn {
      height: auto;
      flex: 1;
    }

    .track:not(.fx-track) .track-info {
      min-height: 116px;
    }

    .track:not(.fx-track) .volume-row {
      margin-top: auto;
    }

    .btn.active {
      border-image-source: url("/assets/ambient/button-p.png");
    }

    .volume-row {
      display: grid;
    }

    .hint {
      display: none;
    }

    .fx-warning {
      max-width: 760px;
      margin: 20px auto 0;
      color: var(--danger);
      font-size: 13px;
      line-height: 1.4;
      text-align: center;
      display: none;
    }

    .fx-warning.visible {
      display: block;
    }

    @media (max-width: 768px) {
      .scroll {
        padding-top: 20;
        padding-bottom: 120px;
      }
  
      .top {
        top: auto;
        bottom: 20px;
      }

      .bg-tiles {
        display: none;
      }

      .big-plus {
        width: 116px;
        height: 116px;
      }

      .fx-toggle,
      .reset-icon {
        width: 64px;
        height: 64px;
      }

      .tracks-wrap {
        justify-content: flex-end;
        min-height: 100%;
      }

      .track-main {
        grid-template-columns: 1fr;
        gap: 20px;
      }

      .track:not(.fx-track) .track-info {
        min-height: 0;
      }

      .name {
        margin-bottom: 0;
      }

      .track-actions {
        flex-direction: row;
      }

      .loop-btn,
      .play-btn {
        flex: none;
      }

      .volume-row {
        display: none;
      }

      .track.fx-track .volume-row {
        display: grid;
      }

      #recordContainer {
        right: 20px;
        bottom: 20px;
        width: 64px;
        height: 64px;
      }

      #recordTest img {
        width: 64px;
        height: 64px;
      }

      #recTimer {
        font-size: 38px;
      }
    }