:root {
  --color-accent: #e8a020;
  --color-text: #3a2e28;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  background: #fdf6ee;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", sans-serif;
  color: var(--color-text);
}

/* スタート画面 */

#start_screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
}

#start_content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 16px;
  flex: 1;
  justify-content: center;
  text-align: center;
}

#start_screen h1 {
  margin: 0;
  font-size: 2em;
  text-align: center;
  line-height: 1.4;
  letter-spacing: 0.05em;
}

#start_content > p {
  margin: 0;
  line-height: 1.7;
}

#start_content > p:last-of-type {
  font-size: 0.75em;
  color: #9e8880;
}

#start_content a {
  color: var(--color-accent);
  text-decoration: none;
  border-bottom: 1px solid var(--color-accent);
}

/* マーキー */
.marquee {
  overflow: hidden;
  width: 100%;
}

.marquee__inner {
  display: flex;
  animation: marquee-left 16s linear infinite;
}
.marquee--reverse {
  transform: scale(1, -1);
}

.marquee--reverse .marquee__inner {
  animation: marquee-right 16s linear infinite;
}

.marquee__list {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  padding: 8px 0; /* 上下のみ */
  margin: 0 8px 0 0; /* 右だけ gap と同じ幅 */
  list-style: none;
}

.marquee__list li img {
  height: 100px;
  width: auto;
  border-radius: 8px;
  display: block;
}

@keyframes marquee-left {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(-1 * var(--list-width)));
  }
}

@keyframes marquee-right {
  from {
    transform: translateX(calc(-1 * var(--list-width)));
  }
  to {
    transform: translateX(0);
  }
}

#start_btn {
  font-size: 1.4em;
  padding: 12px 40px;
  border: none;
  border-radius: 30px;
  background: var(--color-accent);
  color: #fff;
  cursor: pointer;
  animation: mocchiri 3s infinite;
}

@keyframes mocchiri {
  0% {
    transform: scale(1, 0.8);
  }
  20% {
    transform: scale(0.8, 1.1);
  }
  95% {
    transform: scale(1, 1);
  }
  100% {
    transform: scale(1, 0.8);
  }
}

#start_ranking table {
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.95em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#start_ranking th,
#start_ranking td {
  padding: 6px 20px;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  text-align: center;
}

#start_ranking th {
  background: var(--color-text);
  color: #fff;
  letter-spacing: 0.05em;
  font-weight: bold;
}

/* ゲーム画面 */

#game_board {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 8px;
  padding: 8px;
  box-sizing: border-box;
  min-height: 0;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)),
    url("img/back.webp");
  background-size: cover;
  background-position: center;
}

img {
  user-select: none;
}

/* スマホ縦画面 */
@media (max-width: 600px) and (orientation: portrait) {
  #game_board {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 5px;
    padding: 5px;
  }
}

.card {
  display: grid;
  border: 1px solid silver;
  border-radius: 10px;
  text-align: center;
  font-size: 26px;
  font-weight: bold;
  box-shadow: gray 2px 2px;
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  overflow: hidden;
  min-height: 0;
}

.back {
  background-color: #d4c4b0;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  min-height: 0;
}

/* 結果 */

.finish {
  opacity: 0;
  cursor: default;
}

#result {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
  font-size: 1.3em;
  font-weight: bold;
  gap: 12px;
}

#result p {
  margin: 0;
}

#result table {
  border-collapse: collapse;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.9em;
}

#result th,
#result td {
  padding: 6px 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  text-align: center;
}
/* 1位 */
#start_ranking tr:nth-child(2) {
  background: #ffd700;
}
/* 2位 */
#start_ranking tr:nth-child(3) {
  background: #c0c0c0;
}
/* 3位*/
#start_ranking tr:nth-child(4) {
  background: #c47222;
}

#result button {
  font-size: 1em;
  padding: 10px 32px;
  border: none;
  border-radius: 30px;
  background: var(--color-accent);
  color: #fff;
  cursor: pointer;
  margin-top: 4px;
}

/* 𝕏 でシェア */
#result_share button:nth-of-type(1) {
  background: #000;
  border: 2px solid rgba(255, 255, 255, 0.6);
}

/* Bluesky でシェア */
#result_share button:nth-of-type(2) {
  background: #0085ff;
}

/* シェアボタン横並び */
#result_share {
  display: flex;
  gap: 12px;
}

/* 戻るリンク */
#result_links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 0.75em;
  font-weight: normal;
  margin-top: 4px;
}

#result_links a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
}

/* Aboutページ */
body#about {
  display: block;
  height: auto;
  max-width: 780px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  line-height: 1.8;
  color: #222;
}

body#about h2 {
  font-size: 1.2em;
  margin: 0.5em 0;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--color-accent);
}

body#about p {
  margin: 0 0 1em;
}

body#about a {
  color: var(--color-accent);
}

body#about table {
  border-collapse: collapse;
  width: 100%;
}

body#about td {
  padding: 8px;
  vertical-align: middle;
}

body#about td:first-child {
  width: 120px;
  text-align: center;
}

body#about td img {
  height: 200px;
  width: auto;
  display: block;
  margin: 0 auto;
}

#about_back {
  display: inline-block;
  margin-bottom: 24px;
  font-size: 0.9em;
  color: var(--color-accent);
  text-decoration: none;
}

#about_back::before {
  content: "← ";
}
