* {
  margin: 0;
  padding: 0
}

body {
  overflow-x: hidden;
  overflow-y: scroll;
  background-image: url(bg.jpg);
  background-color: #393;
  background-size: 177.7777777778vh 100vh;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-position: center top;
  margin-right: 140px;
}

@media(min-aspect-ratio: 24/32) {
  body {
    font-size: 3.125vh
  }
}

@media(max-aspect-ratio: 24/32) {
  body {
    font-size: 4.1666666667vw
  }
}

div#container {
  display: flex;
  padding: 0em;
  margin: 0em auto
}

div#board-box {
  position: relative;
  width: 24em;
  height: 32em;
  -webkit-flex-shrink: 0;
  flex-shrink: 0
}

div#record-box {
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  border: 1px solid #000;
  padding: 0em
}

div#record-box ol {
  padding: 0em 0em 0em 2em;
  overflow-y: auto
}

div#record-box p {
  padding: .5em
}

div#record-box p#dead-msg {
  display: none
}

@media(min-aspect-ratio: 1/1) {
  div#container {
    -webkit-justify-content: center;
    justify-content: center
  }

  div#record-box {
    margin: 1em 0em;
    width: 8em
  }
}

@media(max-aspect-ratio: 1/1) {
  div#container {
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-align-items: center;
    align-items: center
  }

  div#record-box {
    margin: 1em;
    width: 20em
  }
}

div#about-overlay {
  z-index: 1;
  display: none;
  position: fixed;
  top: 0em;
  left: 0em;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, .75)
}

div#about-dialog {
  position: fixed;
  width: 20em;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  padding: 1em 0em 0em 0em
}

div#about-dialog ul {
  padding: 0em 0em 0em 2em
}

p#about-image-container {
  text-align: center;
  padding: 0em;
  margin: 0em
}

span#about-image {
  display: inline-block;
  width: 10em;
  height: 8em;
  background-image: url(sprites.png);
  background-repeat: no-repeat;
  background-position: 0em -45em;
  background-size: 10em;
  padding: 0em;
  margin: 0em
}

span#about-image.dead {
  background-position: 0em -53em
}

p.name {
  text-align: center;
  vertical-align: middle;
  line-height: 3em
}

#board, .board, .piece {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

table {
  border-collapse: collapse;
  table-layout: fixed;
  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  cursor: default
}

td.cell {
  padding: 0em;
  border: 1px solid #000;
  width: 6em;
  height: 6em
}

td.cell div.cell {
  display: table-cell;
  position: relative;
  text-align: center;
  vertical-align: middle;
  width: 6em;
  height: 6em;
  padding: 0em;
  margin: auto
}

td.cell div.cell span.hint {
  font-size: xx-small;
  position: absolute;
  right: 2px;
  top: 2px
}

td.cell div.possible {
  background: hsla(0, 100%, 80%, .5)
}

td.hand {
  width: 2em
}

td.hand div.hand {
  width: 2em;
  height: 2em;
  overflow: visible
}

td.hand div.hand span.piece {
  font-size: .5em
}

td.aux {
  text-align: center;
  width: .5em
}

span.piece {
  display: inline-block;
  width: 4em;
  height: 4em;
  overflow: hidden;
  cursor: pointer;
  -ms-user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  margin: auto;
  background-image: url(sprites.png);
  background-repeat: no-repeat;
  background-position: 0em 0em;
  background-size: 8em;
  border-style: solid;
  border-width: 1px
}

span.piece.player {
  background-color: #fcc;
  border-color: #933
}

span.piece.player:hover {
  background-color: #fdd;
  border-color: #f99
}

span.piece.master {
  background-color: #ccf;
  border-color: #339
}

span.piece.lion.player {
  background-position: 0em 0em
}

span.piece.lion.master {
  background-position: -4em 0em
}

span.piece.elephant.player {
  background-position: 0em -4em
}

span.piece.elephant.master {
  background-position: -4em -4em
}

span.piece.giraffe.player {
  background-position: 0em -8em
}

span.piece.giraffe.master {
  background-position: -4em -8em
}

span.piece.chick.player {
  background-position: 0em -12em
}

span.piece.chick.master {
  background-position: -4em -12em
}

span.piece.chick.player.promoted {
  background-position: 0em -16em
}

span.piece.chick.master.promoted {
  background-position: -4em -16em
}

.player-text {
  color: #900
}

.master-text {
  color: #009
}

.ui-helper-hidden {
  display: none
}

.ui-helper-hidden-accessible {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px
}

.ui-helper-reset {
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  line-height: 1.3;
  text-decoration: none;
  font-size: 100%;
  list-style: none
}

.ui-helper-clearfix:before,
.ui-helper-clearfix:after {
  content: "";
  display: table;
  border-collapse: collapse
}

.ui-helper-clearfix:after {
  clear: both
}

.ui-helper-zfix {
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  position: absolute;
  opacity: 0;
  filter: Alpha(Opacity=0)
}

.ui-front {
  z-index: 100
}

.ui-state-disabled {
  cursor: default !important;
  pointer-events: none
}

.ui-icon {
  display: inline-block;
  vertical-align: middle;
  margin-top: -0.25em;
  position: relative;
  text-indent: -99999px;
  overflow: hidden;
  background-repeat: no-repeat
}

.ui-widget-icon-block {
  left: 50%;
  margin-left: -8px;
  display: block
}

.ui-widget-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%
}

.ui-button {
  padding: .4em 1em;
  display: inline-block;
  position: relative;
  line-height: normal;
  margin-right: .1em;
  cursor: pointer;
  vertical-align: middle;
  text-align: center;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  overflow: visible
}

.ui-button,
.ui-button:link,
.ui-button:visited,
.ui-button:hover,
.ui-button:active {
  text-decoration: none
}

.ui-button-icon-only {
  width: 2em;
  box-sizing: border-box;
  text-indent: -9999px;
  white-space: nowrap
}

input.ui-button.ui-button-icon-only {
  text-indent: 0
}

.ui-button-icon-only .ui-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -8px;
  margin-left: -8px
}

.ui-button.ui-icon-notext .ui-icon {
  padding: 0;
  width: 2.1em;
  height: 2.1em;
  text-indent: -9999px;
  white-space: nowrap
}

input.ui-button.ui-icon-notext .ui-icon {
  width: auto;
  height: auto;
  text-indent: 0;
  white-space: normal;
  padding: .4em 1em
}

input.ui-button::-moz-focus-inner,
button.ui-button::-moz-focus-inner {
  border: 0;
  padding: 0
}

.ui-draggable-handle {
  -ms-touch-action: none;
  touch-action: none
}

div#record-box {
  flex-shrink: 0;
  border: 1px solid #000;
  padding: 0em;
  width: 20em;
  /* 幅を広げる */
  max-height: 30em;
  /* 高さ制限 */
  overflow-y: auto;
}

div#record-box ol {
  padding: 0.5em 1em;
  word-break: break-all;
  /* 長い文字列の折り返し対応（必要なら） */
  font-size: 0.8em;
}

.board {
  position: relative;
}

/* ニワトリ（成ったヒヨコ）の画像指定 */
span.piece.hen.player {
  background-position: 0em -16em; /* chick.promoted と同じ */
}

span.piece.hen.master {
  background-position: -4em -16em; /* chick.promoted と同じ */
}

#turn-timer {
  width: 10em;
  font-weight: bold;
  font-size: 1.2em;
  text-align: center;
  white-space: nowrap;
}

#control-panel {
  background-color: rgba(255, 255, 255, 0.95);
  padding: 1em 1.5em;
  border: 2px solid #333;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  width: 12em;
  box-sizing: border-box;
}

#record-container {
  border: 1px solid #ccc;
  padding: 0.5em 1em;
  border-radius: 6px;
  background-color: #f9f9f9;
  font-size: 0.9em;
  overflow-y: auto;
  width: 12em;
  max-height: 8em;
  box-sizing: border-box;
}

#record-container h3 {
  margin-top: 0;
  font-size: 1.1em;
  text-align: center;
}

#record li {
  margin-bottom: 0.3em;
  line-height: 1.4;
}
#record-container ol {
  padding-left: 2em;
}

#restart-btn {
  font-size: 1.2em;
  display: none;
}

#survey-btn  {
  font-size: .8em;
  display: none;
}

#winner-name {
  font-size: 1.2em;
}

#side-panel {
  display: flex;
  flex-direction: column;
  align-items: center; /* 横中央寄せ（お好みで） */
  gap: 1em; /* 要素間の余白 */
  margin: 1em;
}

#game-count-display {
  font-size: 1.2em;
}

#replay-buttons {
  display: none;
  gap: .2em;
  margin-top: .5em;
  justify-content: center;
  width: 100%;
}

#prev-board {
  font-size: .8em;
}

#next-board {
  font-size: .8em;
}

#start-recognition {
  font-size: .8em;
  display: none;
}

.cell.highlight {
  background-color: rgba(245, 150, 150, 0.5);
}

#system-speech-box {
  width: 11em;
  max-width: 90vw;
  border: 1px solid #000;
  padding: 8px;
  margin-top: 8px;
  height: 140px;
  overflow-y: auto;
  background-color: rgba(255, 255, 255, 0.95);
}

.system-speech {
  font-size: .6em;
  margin-bottom: 6px;
  white-space: pre-wrap;
}

#review-bestmove-box {
  width: 12em;
  max-width: 90vw;
  border: 1px solid #ccc;
  padding: 8px;
  margin-top: 8px;
  background: #f9f9f9;
  font-size: .8em;
}
#review-bestmove-text { white-space: pre-wrap; }

#help-buttons {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#help-buttons .help-btn {
  display: inline-block;
  padding: 4px 6px;
  border: 1px solid #333;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.95);
  color: #000;
  text-decoration: none;
  font-size: 0.6em;
  box-shadow: 0 0 8px rgba(0,0,0,0.2);
  white-space: nowrap;
}

#help-buttons .help-btn:hover {
  filter: brightness(1.03);
}