body {
  background: #ffffff; 
  background-image:
    linear-gradient(to right, #d0e1f9 1px, transparent 1px),
    linear-gradient(to bottom, #d0e1f9 1px, transparent 1px);
  background-size: 20px 20px;
  font-family: 'Pixel', sans-serif; 
  font-weight: normal;
  font-size: 10px;
  color: #5D536B; 
  margin: 0;
  padding: 15px;
  box-sizing: border-box;
  user-select: none;
}

a:link, a:visited, a:active { 
  color: #ff80c6;
  text-decoration: underline;
}
a:hover { 
  color: #999;
}
b { 
  font-weight: normal;
  color: #A3CBFF;
}
i { 
  font-weight: normal;
  color: #C096FF; 
  font-style: normal;
}
s { 
  font-weight: normal;
  color: #FFB8DD; 
  font-style: normal; 
  text-decoration: none;
}
::-webkit-scrollbar {
width: 5px;
height: 5px; 
background: transparent;
}
::-webkit-scrollbar-track {
background: #ffd4e5, transparent;
}
::-webkit-scrollbar-thumb {
background: linear-gradient(#FFD1E6, #FFE3E3, #FFF1C5, #FFFCE6, #E8FAD6, #D4EDDA, #D1F2FF, #CCE5FF, #E2D9F3, #F2E6FF);
}
.paint-container {
  max-width: 95%;
  height: 90vh;
  margin: 0 auto;
  background: #F2E6FF; 
  border: 2px solid #FFF;
  box-shadow: 
    inset -1px -1px 1px #AFA3C0,
    1px 1px 1px #AFA3C0,
    2px 2px 4px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
}

.paint-titlebar {
  background: linear-gradient(to right, #FFD1E6, #FFE3E3, #FFF1C5, #FFFCE6, #E8FAD6, #D4EDDA, #D1F2FF, #CCE5FF, #E2D9F3, #F2E6FF);
  padding: 4px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #AFA3C0;
}

.title-text {
  color: #5D536B;
  display: flex;
  align-items: center;
  gap: 6px;
}

.title-text img {
  width: 14px;
  height: 14px;
  display: block;
  image-rendering: pixelated;
}

.win-buttons {
  display: flex;
  gap: 3px;
}

.win-btn {
  background: #F2E6FF;
  border: 1px solid #FFF;
  box-shadow: 1px 1px 1px #AFA3C0;
  font-size: 9px;
  font-weight: bold;
  width: 14px;
  height: 14px;
  line-height: 12px;
  text-align: center;
  color: #5D536B;
}

.win-btn:active {
  box-shadow: inset 1px 1px 1px #AFA3C0;
  padding-top: 1px;
}
    
.paint-menu {
  background: #F2E6FF;
  display: flex;
  gap: 15px;
  padding: 3px 10px;
  border-bottom: 1px solid #AFA3C0;
  box-shadow: inset 0 1px 0 #FFF;
}

.paint-menu a {
  color: #5D536B;
  text-decoration: none;
  padding: 2px 4px;
}

.paint-menu a:hover {
  background: #CCE5FF; 
  outline: 1px solid #A3C9FF;
}

.paint-workspace {
  display: flex;
  flex: 1;
  background: #F2E6FF; 
  padding: 4px;
  gap: 4px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.paint-toolbox {
  width: 42px; 
  height: 100%;
  background: #F2E6FF;
  border: 1px solid #FFF;
  box-shadow: -1px -1px 1px #AFA3C0 inset, 1px 1px 1px #AFA3C0;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-sizing: border-box;
}

.paint-toolbox .tool-icon img {
  width: 100%;
  height: 100%;
  max-width: 32px;
  max-height: 32px;
  display: block;
}

.paint-toolbox .tool-icon:hover {
  background: #FFFCE6;
}

.paint-toolbox .tool-icon:active {
  background: #FFFFFF;
  box-shadow: inset 1px 1px 1px #AFA3C0;
  border: 1px solid #AFA3C0;
}

.chat-toolbox-btn {
  cursor: pointer;  
  flex: 0 0 auto;
}

.chat-toolbox-btn img {
  width: 28px;
  height: 28px;
  max-width: 28px;
  max-height: 28px;
  display: block;
}

.tool-options-box {
  width: 32px;
  height: 50px;
  margin-top: 5px;
  background: #FFF;
  border: 1px solid #AFA3C0;
  box-shadow: inset 1px 1px 1px #E6E6E6;
}

.paint-canvas-container {
  flex: 1;
  height: 100%;
  background: #AFA3C0; 
  padding: 3px;
  box-shadow: inset 1px 1px 2px rgba(0,0,0,0.2);
  box-sizing: border-box;
}

.paint-canvas-frame {
  background: #FFFFFF;
  width: 100%;
  height: 100%; 
  border: none;
  display: block;
}

.center-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  box-shadow: inset 1px 1px 1px #DDD;
}

.paint-palette-bar {
  background: #F2E6FF;
  border-top: 1px solid #AFA3C0;
  padding: 6px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.current-colors {
  width: 28px;
  height: 28px;
  background: #FFD1E6; 
  border: 1px solid #AFA3C0;
  box-shadow: inset 1px 1px 0 #FFF;
}

.color-swatches {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  grid-gap: 2px;
}

.swatch {
  width: 13px;
  height: 13px;
  border: 1px solid #AFA3C0;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,0.4);
}

.box-window {
  background: #FFF;
  border-top: 1px dotted #C6D9EC;
  border-left: 1px dotted #C6D9EC;
  border-right: 1px dotted #C6D9EC;
  border-bottom: 1px dotted #C6D9EC;
  padding: 2px;
  margin-bottom: 2px;
  box-sizing: border-box;
}


.flex-box-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px;
  justify-content: center;
  align-items: flex-start;
}

.flex-break {
  flex-basis: 100%;
  height: 0;
}

.layout {
  display: flex;
  gap: 20px;
}

.layout-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  align-items: flex-start;
}

.left-col {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.right-col {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 15px;
}

.right-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, auto));
  gap: 15px;
  align-items: start;
}

.iframe-body {
  background: #ffffff !important;
  background-image: none !important;
  user-select: auto !important;
  padding: 10px;
}

.frame-box {
  background-repeat: repeat;
  background-position: center;
  padding: 12px 20px;
  box-sizing: border-box;
  border-radius: 4px;
}

.frame-inner {
  font-size: 11px;
  color: #5D536B;
  line-height: 14px;
  min-height: auto;
  background: #fcf1fc;
  border: 1px dashed #FFD1E6;
  padding: 5px;
  border-radius: 4px;
  overflow-y: auto;
  flex: 1;
}

.frame-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
}

#pagedoll {
  position: fixed;
  bottom: 30px;
  right: 10px;
}

.toolbox-chat-window {
  display: none;
  position: fixed;
  bottom: 60px;
  left: 60px;
  width: 280px;
  height: 380px;
  background: #F2E6FF;
  border: 2px solid #FFF;
  box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.15), inset -1px -1px 1px #AFA3C0;
  flex-direction: column;
  z-index: 10000;
  font-family: 'Pixel', sans-serif;
  font-size: 10px;
}

.chat-frame-container {
  flex: 1;
  background: #FFF;
  margin: 4px;
  border: 1px solid #AFA3C0;
}

.chat-frame-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.toolbox-chat-window.is-dragging iframe {
  pointer-events: none !important;
}

body:has(#toggle-paint-chat:checked) .toolbox-chat-window {
  display: flex;
}

body:has(#toggle-paint-chat:checked) .chat-toolbox-btn {
  background: #FFF;
  box-shadow: inset 1px 1px 1px #AFA3C0;
  border: 1px solid #AFA3C0;
}
.paint-canvas-container.error-page-layout {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

html:has(body.error-page-layout),
body.error-page-layout {
  height: 100% !important;
  min-height: 100vh !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

.error-box {
  display: inline-block;
  background: #F2E6FF;
  border: 2px solid #FFF;
  box-shadow: 
    inset -1px -1px 1px #AFA3C0,
    1px 1px 1px #AFA3C0,
    2px 2px 4px rgba(0, 0, 0, 0.05);
  width: 70%;
  max-width: 80%;
  text-align: left;
  box-sizing: border-box;
}
.error-titlebar {
  background: linear-gradient(to right, #FFD1E6, #FFE3E3, #FFF1C5, #FFFCE6, #E8FAD6, #D4EDDA, #D1F2FF, #CCE5FF, #E2D9F3, #F2E6FF );
   padding: 4px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #AFA3C0;
 }
.error-body {
  padding: 15px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.error-icon {
  font-size: 24px;
  line-height: 1;
}
.error-message {
  flex: 1;
  line-height: 14px;
}
.error-message h1 { 
  margin: 0 0 6px 0; 
  font-size: 12px; 
  color: #C5779C; 
  font-weight: bold;
}
.error-message p {
  margin: 0;
}
.error-footer {
  padding: 0 15px 15px 15px;
  text-align: center;
}
.error-btn {
  display: inline-block;
  background: #F2E6FF;
  border: 1px solid #FFF;
  box-shadow: 1px 1px 1px #AFA3C0;
  color: #5D536B;
  text-decoration: none;
  font-weight: bold;
  font-size: 10px;
  padding: 4px 20px;
  min-width: 50px;
}
.error-btn:active {
  background: #F2E6FF;
  box-shadow: inset 1px 1px 1px #AFA3C0;
  border: 1px solid #AFA3C0;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal:target {
  display: flex;
}

.window {
  background: #F2E6FF;
  border: 2px solid #FFF;
  box-shadow:
    inset -1px -1px 1px #AFA3C0,
    1px 1px 1px #AFA3C0,
    2px 2px 4px rgba(0,0,0,0.05);
  width: 300px;
  max-width: 90%;
  border-radius: 4px;
}

.window-title {
  background: linear-gradient(to right,
    #FFD1E6, #FFE3E3, #FFF1C5, #FFFCE6,
    #E8FAD6, #D4EDDA, #D1F2FF, #CCE5FF,
    #E2D9F3, #F2E6FF);
  padding: 4px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #666;
}

.window-btn {
  background: #F2E6FF;
  border: 1px solid #FFF;
  box-shadow: 1px 1px 1px #AFA3C0;
  font-size: 10px;
  font-weight: bold;
  width: 16px;
  height: 16px;
  text-align: center;
  line-height: 14px;
  color: #5D536B;
  text-decoration: none;
}

.window-body {
  padding: 10px;
  text-align: center;
  font-size: 11px;
  color: #5D536B;
}

.window-body img {
  max-width: 100%;
  border-radius: 4px;
  margin-bottom: 8px;
}
.close-area {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.window {
  position: relative;
  z-index: 2;
}

.art-page {
  padding: 12px;
}

.art-page .museum-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 18px;
  max-width: 900px;
  margin: 0 auto;
}

.art-page .museum-preview {
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.art-page .museum-sidebar {
  height: 420px;
  overflow-y: auto;
  padding: 10px;
  background: #fff;
  border: 1px solid #c6d9ec;
  box-sizing: border-box;
}

.art-page .museum-image {
  display: block;
  max-width: 100%;
  height: min(80vh, 720px);
  margin: 0 auto;
  object-fit: contain;
}
.art-page .museum-sidebar > div:last-child {
  display: flex !important;
  flex-direction: column;
  gap: 12px !important;
}

.art-page .art-thumb {
  width: 100%;
  height: 120px;
  flex: 0 0 120px;
  padding: 4px;
  box-sizing: border-box;
  overflow: hidden;
  background: #fff;
  border: 1px solid #c6d9ec;
  cursor: pointer;
}

.art-page .art-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.switch-btn {
  background:#F9F5FF;
  border:1px solid #C6D9EC;
  padding:6px 10px;
  border-radius:6px;
  font-family:'pixel';
  cursor:pointer;
  color:#7A6FA6;
}

.switch-btn:hover {
  background:#EDE4FF;
}
button {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
}

@media (max-width: 600px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    padding: 8px;
  }

  img,
  iframe,
  video {
    max-width: 100%;
    height: auto;
  }

  .layout,
  .frame-grid {
    flex-direction: column;
    gap: 12px;
  }

  .left-col,
  .right-col {
    width: 100%;
    min-width: 0;
  }

  .museum-shell {
    width: 100%;
    max-width: 900px;
    margin: 10px auto;
  }

  .museum-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px;
  }

  .museum-sidebar {
    order: 1;
    width: 100%;
    height: auto;
    overflow: visible;
  }

  .museum-preview {
    order: 2;
    width: 100%;
    min-width: 0;
    min-height: 0;
    padding: 14px;
  }

  .museum-image {
    display: block;
    width: 100%;
    height: min(65vh, 560px);
    object-fit: contain;
  }

  .art-thumb {
    min-width: 0;
  }

  .art-thumb img {
    width: 100%;
    height: auto;
  }

  .frame-box,
  .box-window,
  .window {
    max-width: 100% !important;
    box-sizing: border-box;
  }

  .art-page .museum-layout {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .art-page .museum-sidebar {
    order: 2;
    width: 100%;
    height: 180px;
    overflow-y: auto;
  }

  .art-page .museum-preview {
    order: 1;
  }
  
  #thumb-container {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    gap: 12px;
    padding-bottom: 10px;
    white-space: nowrap;
  }

  #thumb-container .art-thumb {
    flex: 0 0 auto;
    width: 90px; 
  }
  .art-page .museum-image {
    height: min(55vh, 420px);
  }

  .art-page .art-thumb {
    height: 90px;
    flex: none;
  }

  #pagedoll {
    width: 55px !important;
    height: auto !important;
    right: 5px;
    bottom: 20px;
  }

  #pagedoll img {
    width: 100% !important;
    height: auto !important;
  }
    .fan-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}