@import "canvas.css";
@import "mobile.css";

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: Segoe UI, Arial, sans-serif;
    min-height: 100vh;
    padding: 20px
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 30px
}

h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 30px;
    font-size: 2.2em
}

.main-content {
    display: flex;
    gap: 30px;
    flex-wrap: wrap
}

.control-panel {
    width: 360px;
    display: flex;
    flex-direction: column;
    gap: 4px
}

.panel-section {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1)
}

.panel-section h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1em
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px
}

button {
    padding: 7px 14px;
    border: none;
    border-radius: 8px;
    background: #667eea;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    position: relative
}

button.active {
    background: #764ba2;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.15)
}

.color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px
}

.color-btn {
    width: 35px;
    height: 35px;
    border-radius: 8px;
    border: 3px solid transparent;
    cursor: pointer
}

.color-btn.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 2px white, 0 0 0 4px #667eea
}

textarea {
    width: 100%;
    min-height: 50px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: monospace
}

.size-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 10px
}

input[type="number"] {
    width: 80px;
    padding: 8px;
    border-radius: 8px;
    border: 2px solid #ddd
}

.small-note {
    font-size: 12px;
    color: #666;
    margin-top: 8px
}

/* 选区样式：橙色半透明斜线 */
.sel-pixel {
    position: absolute;
    pointer-events: none;
    background-image: repeating-linear-gradient(135deg, rgba(255, 165, 0, 0.25) 0 6px, transparent 6px 12px);
    mix-blend-mode: normal;
    z-index: 50;
}

.sel-border {
    position: absolute;
    pointer-events: none;
    border: 1px dashed rgba(255, 140, 0, 0.95);
    box-sizing: border-box;
    z-index: 55;
}

.sel-preview {
    position: absolute;
    pointer-events: none;
    background-image: repeating-linear-gradient(135deg, rgba(255, 165, 0, 0.18) 0 6px, transparent 6px 12px);
    z-index: 49;
    box-sizing: border-box;
}

/* hover tooltip (simple) */
button[title]:hover::after {
    content: attr(title);
    position: absolute;
    left: 50%;
    transform: translate(-50%, -140%);
    background: rgba(0, 0, 0, 0.78);
    color: #fff;
    padding: 6px 8px;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 12px;
    z-index: 80;
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    text-align: center;
    border-radius: 5px;
    padding: 10px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.toast.show {
    opacity: 1;
}

.help-section {
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: 8px;
    background: #f9fafc;
    border: 1px solid #d0d4e4;
    max-width: 800px;
    line-height: 1.6;
    display: none;
}

/* 头像容器（右下角固定） */
#toyAvatar {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: linear-gradient(180deg,#ffecec,#ffd9d9);
  box-shadow: 0 8px 22px rgba(0,0,0,0.25);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  z-index:9999;
  transform-origin: center;
  transition: transform 120ms ease, box-shadow 120ms ease;
  user-select:none;
}

#toyAvatar .face {
  width:64%; height:64%;
  display:block;
}
@keyframes squeeze {
  0% { transform: scale(1,1); }
  20% { transform: scale(1.14, 0.78); }
  55% { transform: scale(0.95, 1.05); }
  100% { transform: scale(1,1); }
}
#toyAvatar.squeeze {
  animation: squeeze 360ms cubic-bezier(.2,.9,.3,1);
}
#toyAvatar:active { box-shadow: 0 4px 10px rgba(0,0,0,0.28); }
#toyAvatar .hint {
  position:absolute;
  right:25%;
  bottom:150%;
  margin-bottom:6px;
  background:rgba(0,0,0,0.75);
  color:#fff;
  padding:6px 8px;
  border-radius:6px;
  font-size:12px;
  white-space:nowrap;
  opacity:0;
  transform: translateY(6px);
  transition:opacity .12s, transform .12s;
  pointer-events:none;
}
#toyAvatar:hover .hint { opacity:1; transform: translateY(0); }

.toggle-help {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    padding: 10px 20px;
    font-size: 14px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.toggle-help:hover {
    background: #764ba2;
}

.theme-toggle {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 100;
    padding: 10px 20px;
    font-size: 14px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.theme-toggle:hover {
    background: #764ba2;
}

/*深色模式*/
body.dark-theme {
    background: linear-gradient(135deg, #282c34 0%, #1a1d23 100%);
    color: #cfd5d6;
}

body.dark-theme .container {
    background: rgba(30, 30, 30, 0.95);
}

body.dark-theme h1 {
    color: #cfd5d6;
}

body.dark-theme .panel-section {
    background: #2f3136;
}

body.dark-theme .panel-section h3 {
    color: #cfd5d6;
}

body.dark-theme button {
    background: #4a4a4a;
    color: #cfd5d6;
}

body.dark-theme button.active {
    background: #666;
}

body.dark-theme .color-btn.selected {
    border-color: #707070;
    box-shadow: 0 0 0 2px #2f3136, 0 0 0 4px #707070;
}

body.dark-theme textarea {
    border: 2px solid #4a4a4a;
    color: #cfd5d6;
    background: #2f3136;
}

body.dark-theme input[type="number"] {
    border: 2px solid #4a4a4a;
    background: #2f3136;
    color: #cfd5d6;
}

body.dark-theme .small-note {
    color: #cfd5d6;
}

body.dark-theme .help-section {
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: 8px;
    background: #2f3136;
    border: 1px solid #000000;
    max-width: 800px;
    line-height: 1.6;
    display: none;
}