body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #fff;
    margin: 0; /* Remove margin */
    height: 100vh; /* Full viewport height */
    overflow: hidden; /* Hide scrollbars */
    box-sizing: border-box;
}

#puzzle-title {

    font-size: 24px;
    color: #333;
    text-align: center;
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    width: 100%;
}

#puzzle-container {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    border: 2px solid #333;
    background-color: #ccc;
    /* Width, height, and top position are now set by JavaScript */
}

.tile {
    position: absolute; /* Tiles are positioned absolutely */
    /*background-image: url('src.jpg');  背景画像として設定 */
    cursor: pointer;
    box-sizing: border-box;
    border: 1px solid #333;
    transition: top 0.3s ease-in-out, left 0.3s ease-in-out, transform 0.2s ease-in-out; /* Animate position and transform changes */
    /* Width, height, and background-size are now set by JavaScript */
}

.tile.no-transition {
    transition: none;
}

.empty {
    background-image: none; /* 空白タイルは背景画像なし */
    background-color: transparent;
    cursor: default;
    border: none;
}

#shuffle-button {
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
}

#win-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
        font-size: 3vw; /* Responsive font size */ /* Responsive font size */
    font-weight: bold;
    padding: 3vw 5vw;
    border-radius: 15px;
    z-index: 100;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: opacity 2s ease-out;
}

.hidden {
    display: none;
}

@keyframes tile-flash {
  50% {
    filter: brightness(2.5);
  }
}

.tile.flashing {
  animation: tile-flash 1s ease-in-out;
}

#replay-button {
    position: absolute;
    top: 12px;
    right: 12px;
    cursor: pointer;
    z-index: 100;
    width: 48px; /* Adjust as needed */
    height: 48px; /* Adjust as needed */
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

#replay-button.transparent {
    opacity: 0;
    pointer-events: none;
}

#solution-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* background-image: url('src.jpg'); */
    background-size: 100% 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
    z-index: 50;
}

/* Hamburger Menu */
#hamburger-menu {
    position: fixed;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background-color: rgba(51, 51, 51, 0.8);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    z-index: 200;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 0;
    transition: background-color 0.3s ease;
}

#hamburger-menu:hover {
    background-color: rgba(51, 51, 51, 1);
}

#hamburger-menu span {
    display: block;
    width: 24px;
    height: 3px;
    background-color: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

#back-button {
    position: fixed;
    top: 8px;
    left: 8px;
    width: 10vw;
    max-width: 120px;;
    height: auto;
    cursor: pointer;
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 7px;
    padding: 0;
    transition: background-color 0.3s ease;
    color: white;
    font-size: 28px;
    font-weight: bold;
    font-style: italic;
    font-family: Georgia, serif;
}

#back-button:hover {
    background-color: rgba(33, 150, 243, 1);
}

/* Modal */
#image-modal, #info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 300;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.5s ease;
}

#image-modal.hidden, #info-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

#image-modal.hidden .modal-content, #info-modal.hidden .modal-content {
    transform: scale(0.9);
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(1);
    transition: transform 0.5s ease;
}

.modal-content h2 {
    margin: 0 0 20px 0;
    font-size: 24px;
    text-align: center;
    color: #333;
}

#close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 36px;
    color: #666;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 36px;
    height: 36px;
}

#close-modal:hover {
    color: #333;
}

#image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.image-option {
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
    aspect-ratio: 1;
}

.image-option:hover {
    border-color: #4CAF50;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.image-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-option.selected {
    border-color: #2196F3;
    box-shadow: 0 0 20px rgba(33, 150, 243, 0.5);
}

/* Info Modal Content */
.info-content {
    max-width: 600px;
    text-align: center;
}

.info-content #info-title {
    margin-top: 1rem;
    margin-bottom: 20px;
    color: #333;
}

.info-content #info-desc {
    font-size: 16px;
    line-height: 1.6;
    color: #666;
    margin-top: 16px;
    margin-bottom: 20px;
    white-space: pre-wrap;
    text-align: left;
}

.info-content #info-link {
    display: inline-block;
    padding: 10px 20px;
    background-color: #2196F3;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.info-content #info-link:hover {
    background-color: #1976D2;
}

.info-content #info-link.hidden {
    display: none;
}

#close-info-modal{
  display: block;
  position: absolute;
  top: 5px;
  right: 5px;
  font-weight:bold;
  font-size: 20px;;
  aspect-ratio: 1;

}

/* Art Info Display */
#art-info {
    position: fixed;
    width:100vw;
    left: 50%;
    transform: translateX(-50%);
    

}
#art-info .baloon{
    max-width: 600px;
    width: 90%;
    padding: 15px 20px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-inline:auto;
}

#art-info-title {
    margin: 0 0 6px 0;
    font-size: 14px;
    color: #333;
    font-weight: bold;
}

#art-info-title:empty {
    display: none;
}

#art-info-desc {
    font-size: 12px;
    line-height: 1.5;
    color: #666;
    margin: 0 0 6px 0;
    text-align: left;
}

#art-info-desc:empty {
    display: none;
}

#art-info-link {
    font-size: 12px;
    /* display: inline-block;
    padding: 6px 12px;
    background-color: #2196F3;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    transition: background-color 0.3s ease; */
}

#art-info-link:hover {
    background-color: #1976D2;
}

#art-info-link.hidden {
    display: none;
}

#art-info:empty {
    display: none;
}

/* Max size mode - hide UI elements and maximize puzzle */
body.max-size-mode #puzzle-title,
body.max-size-mode #hamburger-menu,
body.max-size-mode #art-info,
body.max-size-mode #back-button,
body.max-size-mode #replay-button {
    display: none !important;
}

.back_to_index{
    width: 70%;
    max-width:200px;
    display: block;
    margin-top: 8px;
    margin-inline: auto;
}

.small_title{
    width:50vw;
    max-width: 600px;
    margin-inline: auto;
}

.logo_small{
    width:min(40vw , 300px);
    display: block;
    margin-inline:auto;
    margin-bottom: 16px;
}
#fullScreenHeader {
    position:relative;
    font-size: 14px;;
}

#fullScreenFooter  {
    bottom: -10px;;
}
#fullScreenFooter .footer-links {
    border-top:solid 1px #ccc;
}
.footer-links{
    padding: 0 10px 10px 10px;;
}
    