@import url("https://fonts.googleapis.com/css?family=Kanit&display=swap");

@font-face {
  font-family: 'TracingFont';
  src: url('./font/font.otf') format('opentype');
}

@font-face {
  font-family: 'TracingFont2';
  src: url('./font/font2.otf') format('opentype');
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  font-family: "Kanit", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  padding: 20px;
}

* {
  box-sizing: border-box;
}

#container {
  width: 100%;
  max-width: 1000px;
  padding: 40px 30px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

h1 {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 32px;
  font-weight: 700;
  margin-top: -15px;
  margin-bottom: 30px;
  text-align: center;
  letter-spacing: 1px;
}

#textInput {
  display: block;
  width: 100%;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  color: #475569;
  border: 2px solid #e2e8f0;
  border-radius: 15px;
  resize: none;
  margin-bottom: 25px;
  height: 120px;
  padding: 20px;
  font-size: 18px;
  font-family: inherit;
  transition: all 0.3s ease;
  line-height: 1.6;
}

#textInput:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
  transform: translateY(-1px);
}

#textInput::placeholder {
  color: #94a3b8;
}

.button-container {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

#generateBtn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 18px;
  font-weight: 600;
  height: 55px;
  border: none;
  border-radius: 15px;
  width: 200px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

#generateBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

#clearBtn {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  color: #6b46c1;
  font-size: 18px;
  font-weight: 600;
  height: 55px;
  border: none;
  border-radius: 15px;
  width: 150px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(168, 237, 234, 0.3);
}

#clearBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(168, 237, 234, 0.4);
}

.font-selector {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.font-selector label {
  color: #6b46c1;
  font-weight: 600;
}

.font-selector select {
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #d1c7ff;
  border-radius: 8px;
  padding: 8px 12px;
  color: #553c9a;
  font-size: 16px;
  cursor: pointer;
}

.font-selector select:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.font-selector input[type="range"] {
  width: 150px;
}

.font-selector span {
  color: #553c9a;
  font-weight: 600;
  min-width: 30px;
}

#canvasContainer {
  position: relative;
  width: 100%;
  background: white;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  padding: 20px;
  display: none;
}

.canvas-wrapper {
  position: relative;
  width: 794px;
  height: 1123px;
  margin: 0 auto;
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#textCanvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  pointer-events: none;
}

#tracingCanvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  cursor: crosshair;
  touch-action: none;
}

.controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 15px;
}

.controls button {
  background: linear-gradient(135deg, #ffeef8 0%, #f0e6ff 100%);
  color: #6b46c1;
  border: 2px solid #e8d5ff;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.controls button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.controls button.active {
  background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
  color: white;
  border-color: #8b5cf6;
}

.pen-controls {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 15px;
  align-items: center;
}

.pen-controls label {
  color: #6b46c1;
  font-weight: 600;
}

.pen-controls input[type="range"] {
  width: 150px;
}

.pen-controls input[type="color"] {
  width: 50px;
  height: 35px;
  border: 2px solid #d1c7ff;
  border-radius: 8px;
  cursor: pointer;
}

.snap-controls {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-bottom: 20px;
  align-items: center;
}

.snap-controls label {
  color: #6b46c1;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.snap-controls input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.snap-controls input[type="range"] {
  width: 150px;
}

@media (max-width: 850px) {
  .canvas-wrapper {
    width: 100%;
    height: auto;
    aspect-ratio: 210 / 297;
  }
  
  #container {
    padding: 30px 20px;
  }
  
  h1 {
    font-size: 28px;
  }
  
  .button-container {
    flex-direction: column;
    align-items: center;
  }
  
  #generateBtn, #clearBtn {
    width: 100%;
    max-width: 300px;
  }
}