/* ボタン共通デザイン */
#game-container button {
  display: block;
  width: 64%;
  margin: 10px auto;
  padding: 8px 24px;
  font-size: 15px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  color: rgb(255, 255, 255);
  box-shadow: 0 1px 4px rgba(200,80,120,0.10);
  transition: background 0.2s, color 0.2s;
}

/* ボタンアイコン用 */
.btn-icon {
  display: inline-block;
  margin-right: 8px;
  font-size: 1.3em;
  vertical-align: middle;
}

#game-container #restart-btn {
  background: #e67e22;
  color: #fff;
}

/* 横一列クリアボタンの有効・無効状態 */
#row-clear-btn {
  background: #2980b9!important;
  color: #fff;
  margin: 18px auto 0 auto;
  opacity: 1;
  transition: background 0.2s, color 0.2s, opacity 0.2s;
}
#row-clear-btn:disabled {
  background: #bbb;
  color: #eee;
  cursor: not-allowed;
  opacity: 0.3;
}
#phrase-area {
  margin: 12px auto;
  padding: 8px 8px;
  font:bold 16px/1.5 'Noto Sans JP', sans-serif;
}
#phrase-area .phrase-triangle-up{
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-bottom: 18px solid #c0392b;
  z-index: 1;
}
#game-container {
  width: 340px;
  margin: 32px auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  padding: 24px 16px 32px 16px;
  text-align: center;
}
#puzzle-area {
  width: 320px;
  height: 320px;
  margin: 0 auto;
  position: relative;
  background: #eee;
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
  display: grid;
  /* JSでgrid-template-columns/rowsを上書きする */
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 2px;
  filter: blur(1px) brightness(0.95);
  transition: filter 0.5s;
}
#puzzle-area.clear {
  filter: none;
}
.puzzle-piece {
  width: 106px;
  height: 106px;
  box-sizing: border-box;
  background-size: 320px 320px;
  background-repeat: no-repeat;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
  cursor: pointer;
  transition: box-shadow 0.2s;
}

/* piece_rowに応じてJSで上書きするためのクラス（例: piece_row=4ならpuzzle-size-4） */
.puzzle-size-2 #puzzle-area {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}
.puzzle-size-3 #puzzle-area {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}
.puzzle-size-4 #puzzle-area {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
}

.puzzle-piece:active {
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
 .empty {
  background: #2d2d2d;
  cursor: default;
  filter: none !important;
}
#clear-message {
  margin-top: 24px;
}
/* --- パズルサンプル用CSS --- */
.puzzle-sample-grid {
  display: grid;
  gap: 2px;
  margin: 0 auto;
  grid-template-columns: repeat(3, 32px);
  grid-template-rows: repeat(3, 32px);
  justify-content: center;
  align-content: center;
}
/* piece_rowに応じてサンプルグリッドも変更 */
.puzzle-size-2 .puzzle-sample-grid {
  grid-template-columns: repeat(2, 32px);
  grid-template-rows: repeat(2, 32px);
}
.puzzle-size-3 .puzzle-sample-grid {
  grid-template-columns: repeat(3, 32px);
  grid-template-rows: repeat(3, 32px);
}
.puzzle-size-4 .puzzle-sample-grid {
  grid-template-columns: repeat(4, 32px);
  grid-template-rows: repeat(4, 32px);
}
.puzzle-sample-piece {
  width: 32px;
  height: 32px;
  background: #eee;
  border: 1px solid #aaa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  color: #333;
}
.puzzle-sample-piece.empty {
  background: #fff;
  border: 1px dashed #bbb;
  color: #bbb;
}
.puzzle-sample-image {
  margin: 18px auto 0 auto;
  border: 2px solid #aaa;
  border-radius: 8px;
  overflow: hidden;
  width: 108px;
  height: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}
.puzzle-sample-image img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
}
/* --- ヒント表示用 --- */
.hint-container {
  margin: 18px auto 0 auto;
  padding: 16px 12px 12px 12px;
  border: 2px solid #f8b5d6;
  border-radius: 12px;
  background: #fff0fa;
  box-shadow: 0 2px 8px rgba(248,181,214,0.10);
  max-width: 320px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hint-title {
  font-size: 15px;
  font-weight: bold;
  color: #c0392b;
  margin-bottom: 10px;
}

#show-hint-btn {
  background: #f98cc2 !important;
  color: #fff !important;
  margin-bottom: 18px;
}
#game-container #show-hint-btn:hover {
  background: #e67ea2;
}

/* --- シンプルなセリフ表示用CSS --- */
.phrase-box {
  background: #f9f9f9;
  /* border: 2px solid #bbb; */
  color: #333;
  padding: 16px 20px;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(180,180,180,0.10);
  font-size: 16px;
  font-family: inherit;
  margin: 0 auto 18px auto;
  width: 100%;
  max-width: 320px;
  text-align: left;
  position: relative;
}
.phrase-box.triangle::after {
  content: "";
  position: absolute;
  left: 32px;
  bottom: -16px;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 16px solid #f9f9f9;
  filter: drop-shadow(0 2px 2px #bbb);
}

/* --- woman三角（▲）最優先 --- */
.phrase-woman .phrase-box.triangle::after {
  content: "" !important;
  position: absolute !important;
  left: 32px !important;
  bottom: -16px !important;
  width: 0 !important;
  height: 0 !important;
  border-left: 12px solid transparent !important;
  border-right: 12px solid transparent !important;
  border-top: 16px solid #fce4ec !important;
  filter: drop-shadow(0 2px 2px #f98cc2) !important;
  z-index: 2 !important;
}
.phrase-woman .phrase-box::after {
  content: "";
  position: absolute;
  left: 32px;
  top: -16px;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-bottom: 16px solid #fce4ec;
  z-index: 2;
}
/* serifu_typeによるデザイン分岐 */
.phrase-woman .phrase-box {
  background: #fce4ec;
  /* border: 2px solid #f98cc2; */
  color: #c0392b;
}
.phrase-woman .phrase-box.triangle::after {
  content: "";
  position: absolute;
  left: 32px;
  bottom: -16px;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 16px solid #fce4ec;
  filter: drop-shadow(0 2px 2px #f98cc2);
}

.phrase-man .phrase-box {
  background: #eee;
  /* border: 2px solid #bbb; */
  color: #666;
}

/* --- 男（man）考え事風バルーン --- */
.phrase-man .phrase-box {
  position: relative;
  margin: 10px 0 10px 14px;
  padding: 15px 18px;
  background: #e1e1e1;
  border-radius: 30px;
  font-style: italic;
  font-size: 15px;
  box-shadow: 0 2px 8px rgba(180,180,180,0.10);
  text-align: left;
}
.phrase-man .phrase-box:before {
  content: "";
  position: absolute;
  left: -38px;
  width: 13px;
  height: 12px;
  bottom: 0;
  background: #e1e1e1;
  border-radius: 50%;
}
.phrase-man .phrase-box:after {
  content: "";
  position: absolute;
  left: -24px;
  width: 20px;
  height: 18px;
  bottom: 3px;
  background: #e1e1e1;
  border-radius: 50%;
}
.phrase-man .phrase-box.no-triangle::after {
  display: none !important;
}