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

/* hidden属性をCSSのdisplayより優先させる */
[hidden] { display: none !important; }

body {
  font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
}

.container {
  width: 100%;
  max-width: 860px;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

header p {
  color: #777;
  font-size: 0.95rem;
}

/* Upload area */
.upload-area {
  background: white;
  border: 2px dashed #ccc;
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: #4a90d9;
  background: #f0f7ff;
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.upload-area p {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.upload-area .hint {
  font-size: 0.8rem;
  color: #aaa;
}

/* 辞書読み込みプログレスバー */
.dict-progress-wrap {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid #eee;
  transition: opacity 0.5s ease;
}

.dict-progress-wrap.done {
  opacity: 0;
  pointer-events: none;
}

.dict-progress-label {
  font-size: 0.82rem;
  color: #999;
  margin-bottom: 0.5rem;
}

.progress-track {
  height: 6px;
  background: #e8e8e8;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: #4a90d9;
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Status */
.status-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem;
  background: white;
  border-radius: 12px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e0e0e0;
  border-top-color: #4a90d9;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#statusText {
  color: #555;
  font-size: 0.95rem;
}

/* Result */
.result-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.canvas-wrapper {
  width: 100%;
  background: white;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: auto;
}

#canvas {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.actions {
  display: flex;
  gap: 1rem;
}

.btn {
  padding: 0.75rem 2rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn:hover {
  opacity: 0.85;
}

.btn-primary {
  background: #4a90d9;
  color: white;
  font-weight: 600;
}

.btn-secondary {
  background: #e8e8e8;
  color: #555;
}
