/* 背景 */
body {
  font-family: "Segoe UI", sans-serif;
  margin: 0;
  padding: 0;
  text-align: center;
  background: #f7f9fc no-repeat center center fixed;
  background-size: cover;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* メインコンテナ */
.container {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px 70px;
  box-sizing: border-box;

  @media (max-width: 767px) {
    padding-top: 20px;
    max-width: 100%
  }
  
  h1 {
    color: #2c3e50;
    margin: 0 0 30px 0;
    font-size: 28px;
    font-weight: 700;

    @media (max-width: 767px) {
      font-size: 24px;
    }
  }

  /* 注意表示 */
  .notice {
    background: #fff8e5;
    color: #8a6d3b;
    border: 1px solid #ffe08a;
    border-radius: 10px;
    padding: 15px;
    margin: 0 auto;
    font-size: 14px;
    line-height: 1.6;
    width: 85%;
    box-sizing: border-box;

    @media (max-width: 767px) {
      font-size: 13px;
      padding: 12px;
      width: min(100%, 500px);
      max-width: 100%;
    }

    a {
      color: rgb(49, 49, 255);
      text-decoration: none;

      &:hover {
        color: rgb(0, 0, 203);
        text-decoration: underline;
      }
    }

  }

  .spacer {
    display: flex;
    align-items: center;
    margin: 0 auto;
    color: #999;
    font-size: 14px;
    padding: 15px 0;

    @media (max-width: 767px) {
      font-size: 12px;
      padding: 12px 0;
    }

    .spacer-line {
      flex: 1;
      height: 1px;
      background-color: #ccc;
    }
    .spacer-text {
      padding: 0 10px;
    }
  }


  .region-select {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: 15px;

    .region-select-label {
      margin-right: 5px;
      font-size: 15px;
      line-height: 1;
    }

    select {
      width: 150px;
      height: 40px;
      border: 2px solid #737374;
      border-radius: 5px;
      padding: 5px;
      appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24' fill='%23333333'%3E%3Cpath d='M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 5px center;

      &:focus {
        outline: none;
        border-color: #1979ff;
        box-shadow: 0 0 0 3px rgba(25, 121, 255, 0.1);
      }
    }
  }

  .checker {
    width: calc(85% - 30px * 2 - 2px);
    margin: 0 auto;
    border-radius: 12px;
    border: 2px solid #dfdfdf;
    background: #ffffff;
    padding: 40px 30px;

    @media (max-width: 767px) {
      width: min(calc(100% - 30px * 2 - 4px), 500px);
      max-width: 100%;
    }

    button {
      background: #3498db;
      color: #fff;
      border: none;
      cursor: pointer;
      transition: all 0.3s ease;
      font-weight: bold;
      font-size: 16px;

      &:hover {
        background: #2980b9;
        box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
      }
      &:active {
        transform: scale(0.98);
      }
      &:disabled,
      &:disabled:hover
      &:disabled:active {
        opacity: 0.6;
        cursor: not-allowed;
        background: #3498db;
        box-shadow: none;
        transform: none;
      }
    }

    .loginButton {
      width: 100%;
      height: 50px;
      border-radius: 25px;
      margin: 0 auto ;
      display: block;
      box-sizing: border-box;

      @media (max-width: 767px) {
        height: 45px;
        font-size: 16px;
      }
    }

    .input {
      width: 100%;
      margin: 0 auto;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;

      .input-row {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        box-sizing: border-box;

        #submit {
          width: 80px;
          height: 50px;
          border-radius: 8px;
          flex-shrink: 0;

          &:disabled,
          &:disabled:hover
          &:disabled:active {
            font-size:14px;
          }

          @media (max-width: 767px) {
            width: 75px;
            height: 45px;
            font-size: 16px;
          }
        }
      }

      input {
        flex: 1;
        min-width: 0;
        height: 50px;
        border: 2px solid #737374;
        border-radius: 8px;
        padding: 0 15px;
        box-sizing: border-box;
        font-size: 16px;
        transition: all 0.3s ease;

        &:focus {
          outline: none;
          border-color: #1979ff;
          box-shadow: 0 0 0 3px rgba(25, 121, 255, 0.1);
        }

        @media (max-width: 767px) {
          font-size: 16px;
          height: 45px;
        }
      }

      .inputerror {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: #757575;
        font-size: 14px;
        margin-top: 8px;
        margin-left: 0;
        text-align: center;
        gap: 6px;

        .error_text {
          flex: 1;
          line-height: 1.4;

          a {
            color: rgb(49, 49, 255);
            text-decoration: none;
            &:hover {
              color: rgb(0, 0, 203);
              text-decoration: underline;
            }
          }
        }
        /* error iconは不使用 */
        .error_icon {
          display: none;
          margin-top: 2px;
          flex-shrink: 0;
          width: 12px;
          height: 12px;
        }
      }

    }
  }
  #result {
    display: none;
    margin: 30px auto 0;
    background: #f9f9f9;
    border-radius: 12px;
    border: 1px solid #dfdfdf;
    padding: 25px;
    /*box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);*/
    font-size: 16px;
    line-height: 1.8;
    width: 100%;
    box-sizing: border-box;

    @media (max-width: 767px) {
      font-size: 15px;
      margin-top: 20px;
      padding: 15px;
      padding-bottom: 0;
      background: #f7f9fc;
      border: none;
      border-radius: 0px;
    }

    .result-row {
      display: grid;
      grid-template-columns: 1fr auto 1fr;
      justify-items: center;
      align-items: center;
      margin: 12px 0;
      gap: 8px;
      text-align: center;

      @media (max-width: 767px) {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin: 15px 0;
        padding: 12px;
        background: #ffffff;
        border-radius: 8px;
      }

      .label {
        font-weight: 600;
        color: #2c3e50;
        text-align: right;
        width: 100%;

        @media (max-width: 767px) {
          text-align: center;
          width: 100%;
          font-size: 13px;
          color: #666;
          font-weight: 500;
        }
      }
      .colon {
        color: #2c3e50;
        font-weight: 600;

        @media (max-width: 767px) {
          display: none;
        }
      }
      .value {
        font-weight: bold;
        color: #2c3e50;
        text-align: left;
        width: 100%;

        @media (max-width: 767px) {
          text-align: center;
          width: 100%;
          font-size: 18px;
          font-weight: 700;
          color: #2c3e50;
        }
      }

    }
  }

}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 15px;
  background: #f0f5ff;
  border-radius: 8px;
}

.history-name {
  font-weight: 600;
  color: #2c3e50;
  font-size: 14px;
  word-break: break-word;
}

.history-note {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.6;
  color: #7f8c8d;
}

.history-date {
  flex-shrink: 0;
  background: #3498db;
  color: #fff;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
}

/* 不使用 */
#input input.error {
  border-color: #f17e7e;
  &:focus {
    box-shadow: 0 0 0 3px rgba(241, 126, 126, 0.1);
  }
}

/* トーナメントセクション */
.tournament-section {
  font-size: 15px;
}

.tournament-title {
  font-size: 18px;
  font-weight: 700;
  color: #2c3e50;
  margin: 0 0 20px 0;
  text-align: center;
}

.tournament-item {
  margin-bottom: 20px;
  padding: 15px;
  background: #f0f5ff;
  border-radius: 8px;
}

.tournament-name {
  font-weight: 700;
  color: #2c3e50;
  font-size: 15px;
  margin-bottom: 10px;
}

.rounds-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.round-badge {
  display: inline-block;
  background: #3498db;
  color: #fff;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
}

/* infoエリア */
#info {
  margin-top: 30px;
  font-size: 14px;
  color: #555;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;

  @media (max-width: 767px) {
    margin-top: 20px;
  }
}

#info a {
  color: #3498db;
  text-decoration: none;
  font-weight: bold;
  transition: color 0.3s ease;
}

#info a:hover {
  color: #2980b9;
  text-decoration: underline;
}

/* フッター */
#footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0;
  font-size: 12px;
  padding: 12px 0;
  color: #777;
  background: #f7f9fc;
  border-top: 1px solid #e0e0e0;
  text-align: center;
}

#footer a {
  color: #3498db;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

#footer a:hover {
  color: #2980b9;
  text-decoration: underline;
}

/* ローディング表示 */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  gap: 15px;
}

.loading-container p {
  font-size: 16px;
  color: #2c3e50;
  margin: 0;
}

/* スピナー本体 */
.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(52, 152, 219, 0.1);
  border-left-color: #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* 回転アニメーション */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 767px) {

  .inputerror {
    font-size: 12px;
  }

  .result-row .label {
    text-align: center;
    width: 100%;
    font-size: 13px;
    color: #666;
    font-weight: 500;
  }

  .result-row .colon {
    display: none;
  }

  .result-row .value {
    text-align: center;
    width: 100%;
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
  }

  .sub-rank {
    font-size: 12px;
    color: #888;
    margin-top: 6px;
  }
}

.container .checker .input input[type="file"] {
  display: block;
  height: 50px;
  line-height: normal;
  padding: 0;
  overflow: hidden;
}

.container .checker .input input[type="file"]::file-selector-button {
  display: inline-block;
  height: 100%;
  margin: 0 12px 0 0;
  border: none;
  border-right: 1px solid #d9d9d9;
  padding: 0 14px;
  box-sizing: border-box;
  vertical-align: middle;
  background: #f3f6fb;
  color: #2c3e50;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.container .checker .input .input-row #uploadReplayButton {
  width: 80px;
  height: 50px;
  border-radius: 8px;
  flex-shrink: 0;
}

@media (max-width: 767px) {
  .container .checker .input input[type="file"] {
    height: 45px;
    line-height: normal;
  }

  .container .checker .input .input-row #uploadReplayButton {
    width: 75px;
    height: 45px;
    font-size: 16px;
  }
}

.result-session-id {
  display: block;
  font-family: Consolas, "Courier New", monospace;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-all;
}

.session-id-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border-radius: 8px;
  padding: 14px;
}

.session-id-label {
  width: 100%;
  text-align: center;
  font-size: 13px;
  color: #666;
  font-weight: 500;
}

.session-id-value {
  display: block;
  width: 100%;
  text-align: center;
  font-family: Consolas, "Courier New", monospace;
  font-size: 18px;
  font-weight: 700;
  color: #2c3e50;
  line-height: 1.5;
  word-break: break-all;
}

.session-copy-wrap {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}

.copy-session-button {
  background: #3498db;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-session-button:hover {
  background: #2980b9;
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.28);
}

.copy-session-button:active {
  transform: scale(0.98);
}

.replay-path-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 12px;
}

.replay-path-text {
  font-family: Consolas, "Courier New", monospace;
  font-size: 11px;
}

.replay-path-copy-row {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 2px;
}

.mini-copy-button {
  background: #8a6d3b;
  color: #fff;
  border: none;
  appearance: none;
  border-radius: 10px !important;
  padding: 8px 10px !important;
  font-size: 13px !important;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin: 0;
}

.mini-copy-button:hover {
  background: #7b5f2f;
}