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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f5f6f8;
  color: #333;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
.header {
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  height: 50px;
  flex-shrink: 0;
}
.header-inner {
  max-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}
.logo {
  font-size: 16px;
  font-weight: 700;
  color: #1a73e8;
  text-decoration: none;
}
.logo span {
  color: #555;
  font-weight: 400;
}
.header-links {
  display: flex;
  gap: 16px;
}
.header-link {
  color: #666;
  text-decoration: none;
  font-size: 13px;
  transition: color .2s;
}
.header-link:hover {
  color: #1a73e8;
}

/* ===== Main Container ===== */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ===== Panels ===== */
.panel {
  background: #fff;
  border-right: 1px solid #e8e8e8;
  overflow-y: auto;
  flex-shrink: 0;
  padding: 12px;
}
.panel-left {
  width: 220px;
}
.panel-right {
  width: 240px;
  border-right: none;
  border-left: 1px solid #e8e8e8;
}
.panel-section {
  margin-bottom: 16px;
}
.panel-title {
  font-size: 13px;
  font-weight: 600;
  color: #444;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #eee;
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  color: #333;
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
  text-align: center;
  white-space: nowrap;
}
.btn:hover {
  background: #f0f0f0;
}
.btn-primary {
  background: #1a73e8;
  color: #fff;
  border-color: #1a73e8;
}
.btn-primary:hover {
  background: #1557b0;
}
.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
}
.btn-full {
  width: 100%;
  margin-top: 4px;
}
.btn-group {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.btn-group .btn {
  flex: 1;
}

/* ===== Canvas ===== */
.canvas-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #e8eaed;
  overflow: hidden;
  position: relative;
}
.canvas-container {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}
.canvas-placeholder {
  color: #aaa;
  font-size: 14px;
  text-align: center;
}
#mainCanvas {
  display: none;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  cursor: crosshair;
}

/* ===== Magnifier ===== */
.magnifier {
  position: fixed;
  pointer-events: none;
  z-index: 100;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  width: 120px;
  height: 120px;
}
.magnifier canvas {
  display: block;
}
.mag-info {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 11px;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  padding: 2px 8px;
  border-radius: 3px;
  white-space: nowrap;
}

/* ===== Image List ===== */
.image-list {
  max-height: 300px;
  overflow-y: auto;
}
.image-list-empty {
  color: #aaa;
  font-size: 12px;
  text-align: center;
  padding: 16px 0;
}
.image-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid #eee;
  border-radius: 4px;
  margin-bottom: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all .15s;
}
.image-item:hover {
  background: #f8f9fa;
}
.image-item.active {
  background: #e8f0fe;
  border-color: #1a73e8;
}
.image-item .thumb {
  width: 36px;
  height: 36px;
  border-radius: 3px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #eee;
}
.image-item .info {
  flex: 1;
  min-width: 0;
}
.image-item .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #333;
}
.image-item .size {
  font-size: 10px;
  color: #999;
  margin-top: 2px;
}
.image-item .btn-delete-img {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border: none;
  background: none;
  color: #ccc;
  font-size: 14px;
  cursor: pointer;
  border-radius: 3px;
  transition: all .15s;
}
.image-item .btn-delete-img:hover {
  color: #d93025;
  background: #fce8e6;
}

/* ===== Color List ===== */
.color-list {
  max-height: 400px;
  overflow-y: auto;
}
.color-list-empty {
  color: #aaa;
  font-size: 12px;
  text-align: center;
  padding: 16px 0;
}
.color-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid #eee;
  border-radius: 4px;
  margin-bottom: 4px;
  font-size: 12px;
  transition: all .15s;
}
.color-item:hover {
  background: #f8f9fa;
  border-color: #ccc;
}
.color-swatch {
  width: 34px;
  height: 34px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.1);
}
.color-codes {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.color-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.color-code-val {
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 12px;
  color: #333;
}
.color-code-val.rgb {
  font-size: 10px;
  color: #999;
}
.color-icon-copy {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: #bbb;
  cursor: pointer;
  border-radius: 3px;
  transition: all .15s;
}
.color-icon-copy:hover {
  color: #1a73e8;
  background: #e8f0fe;
}
.color-icon-copy.copied {
  color: #50B86C;
  background: #e6f7ed;
}
.color-del {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border: none;
  background: none;
  color: #ccc;
  font-size: 14px;
  cursor: pointer;
  border-radius: 3px;
  transition: all .15s;
}
.color-del:hover {
  color: #d93025;
  background: #fce8e6;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 8px;
  font-size: 12px;
  color: #999;
  background: #fff;
  border-top: 1px solid #e8e8e8;
  flex-shrink: 0;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 8px 20px;
  border-radius: 4px;
  font-size: 13px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.toast.show {
  opacity: 1;
}
