/* ========================================
   全体
======================================== */

* {
  box-sizing: border-box;
}


body {
  margin: 0;

  padding: 20px;

  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Noto Sans JP",
    sans-serif;

  background: #fafafa;

  color: #333;
}


.container {
  width: 100%;
  max-width: 900px;

  margin: 0 auto;
}


/* ========================================
   ヘッダー
======================================== */

header {
  text-align: center;

  margin-bottom: 20px;
}


h1 {
  margin: 10px 0;

  font-size: 28px;
}


#phaseText {
  margin: 8px 0;

  color: #666;

  font-size: 14px;
}


#progressText {
  margin: 8px 0;

  font-size: 13px;

  color: #777;
}


.progress {
  width: 100%;

  height: 8px;

  overflow: hidden;

  border-radius: 10px;

  background: #e5e5e5;
}


#progressBar {
  width: 0%;

  height: 100%;

  border-radius: 10px;

  background: #777;

  transition:
    width 0.25s ease;
}


/* ========================================
   比較画面
======================================== */

#compareScreen {
  width: 100%;
}


.faces {
  display: flex;

  align-items: center;

  justify-content: center;

  gap: 20px;

  width: 100%;
}


.face-card {
  width: 42%;

  max-width: 350px;

  padding: 0;

  border: none;

  background: transparent;

  cursor: pointer;
}


.face-card img {
  display: block;

  width: 100%;

  aspect-ratio: 3 / 4;

  object-fit: cover;

  border-radius: 12px;

  background: #eee;

  box-shadow:
    0 3px 12px
    rgba(0, 0, 0, 0.12);

  transition:
    transform 0.15s ease;
}


.face-card:hover img {
  transform:
    scale(1.02);
}


.vs {
  flex-shrink: 0;

  font-size: 22px;

  font-weight: bold;

  color: #888;
}


/* ========================================
   選択ボタン
======================================== */

.choice-buttons {
  display: grid;

  grid-template-columns:
    1fr 1fr;

  gap: 12px;

  width: 100%;

  max-width: 700px;

  margin: 22px auto 0;
}


.choice-buttons button {
  min-height: 55px;

  padding: 12px 15px;

  border: 1px solid #ddd;

  border-radius: 10px;

  background: #fff;

  color: #333;

  font-size: 15px;

  font-weight: 600;

  cursor: pointer;

  box-shadow:
    0 2px 5px
    rgba(0, 0, 0, 0.05);

  transition:
    background 0.15s ease,
    transform 0.1s ease;
}


.choice-buttons button:hover {
  background: #f5f5f5;
}


.choice-buttons button:active {
  transform:
    scale(0.98);
}


/* ========================================
   ひとつ前に戻るボタン
======================================== */

.undo-button {
  display: block;

  width: min(
    400px,
    90%
  );

  margin: 16px auto 0;

  padding: 10px 16px;

  border: 1px solid #ccc;

  border-radius: 8px;

  background: #fff;

  color: #555;

  font-size: 14px;

  cursor: pointer;

  transition:
    opacity 0.2s ease,
    background 0.2s ease;
}


.undo-button:hover:not(:disabled) {
  background: #f5f5f5;
}


.undo-button:active:not(:disabled) {
  transform:
    scale(0.98);
}


.undo-button:disabled {
  opacity: 0.35;

  cursor: not-allowed;
}


/* ========================================
   結果画面
======================================== */

.hidden {
  display: none;
}


#resultScreen {
  text-align: center;
}


#resultTitle {
  margin:
    10px 0 8px;

  font-size: 25px;
}


#resultDescription {
  margin:
    0 0 20px;

  color: #777;

  font-size: 14px;
}


/* ========================================
   TOP9
======================================== */

#rankingGrid {
  display: grid;

  grid-template-columns:
    repeat(3, 1fr);

  gap: 18px;

  width: 100%;

  max-width: 800px;

  margin: 0 auto;
}


.ranking-card {
  position: relative;

  overflow: hidden;

  border-radius: 12px;

  background: #fff;

  box-shadow:
    0 3px 12px
    rgba(0, 0, 0, 0.1);
}


.ranking-card img {
  display: block;

  width: 100%;

  aspect-ratio: 3 / 4;

  object-fit: cover;

  background: #eee;
}


.ranking-number {
  position: absolute;

  top: 8px;

  left: 8px;

  z-index: 2;

  padding: 5px 8px;

  border-radius: 6px;

  background:
    rgba(255, 255, 255, 0.9);

  font-size: 13px;

  font-weight: bold;
}


.ranking-name {
  padding: 10px;

  font-size: 15px;

  font-weight: 600;
}


/* ========================================
   結果ボタン
======================================== */

.result-buttons {
  display: flex;

  flex-direction: column;

  align-items: center;

  gap: 12px;

  margin-top: 25px;
}


.main-button,
.sub-button {
  width: min(
    500px,
    90%
  );

  min-height: 50px;

  padding: 12px 20px;

  border-radius: 10px;

  font-size: 15px;

  font-weight: 600;

  cursor: pointer;
}


.main-button {
  border: none;

  background: #333;

  color: #fff;
}


.main-button:hover {
  opacity: 0.85;
}


.sub-button {
  border: 1px solid #ccc;

  background: #fff;

  color: #555;
}


.sub-button:hover {
  background: #f5f5f5;
}


/* ========================================
   スマホ
======================================== */

@media (
  max-width: 600px
) {

  body {
    padding: 12px;
  }


  h1 {
    font-size: 22px;
  }


  .faces {
    gap: 8px;
  }


  .face-card {
    width: 46%;
  }


  .vs {
    font-size: 16px;
  }


  .choice-buttons {
    grid-template-columns:
      1fr;

    gap: 8px;

    margin-top: 15px;
  }


  .choice-buttons button {
    min-height: 48px;

    font-size: 14px;
  }


  .undo-button {
    margin-top: 12px;

    font-size: 13px;
  }


  #rankingGrid {
    grid-template-columns:
      repeat(3, 1fr);

    gap: 8px;
  }


  .ranking-name {
    padding: 7px 4px;

    font-size: 12px;
  }


  .ranking-number {
    top: 4px;

    left: 4px;

    padding: 3px 5px;

    font-size: 10px;
  }

}
