@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: #fff;
  color: #111;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
  background: #fff;
  z-index: 10;
}

#title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

#controls {
  display: flex;
  gap: 8px;
}

button {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 13px;
  padding: 7px 14px;
  border: 1.5px solid #111;
  background: #fff;
  cursor: pointer;
  border-radius: 6px;
  font-weight: 700;
  transition: background 0.15s, color 0.15s;
}

#submitBtn {
  background: #111;
  color: #fff;
  border-color: #111;
}

#canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #f8f8f8;
}

canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#referenceCanvas {
  z-index: 1;
  opacity: 0;
  transition: opacity 0.4s;
}

#referenceCanvas.visible {
  opacity: 0.18;
}

#referenceCanvas.result-visible {
  opacity: 0.35;
}

#drawCanvas {
  z-index: 2;
  touch-action: none;
}

#hint-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-top: 1px solid #e0e0e0;
  flex-shrink: 0;
  background: #fff;
  z-index: 10;
}

#hint-text {
  font-size: 12px;
  color: #555;
}

#hintBtn {
  font-size: 12px;
  padding: 5px 10px;
  border-color: #aaa;
  color: #555;
  font-weight: 400;
}

/* Score overlay */
#score-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease;
}

#score-overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

#score-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px 36px;
  text-align: center;
  max-width: 300px;
  width: 85vw;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

#score-title {
  font-size: 14px;
  font-weight: 700;
  color: #555;
  margin-bottom: 12px;
  letter-spacing: 0.1em;
}

#score-value {
  font-size: 64px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
}

#score-comment {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

#score-detail {
  font-size: 12px;
  color: #777;
  margin-bottom: 24px;
  line-height: 1.6;
}

.tool-btn {
  font-size: 12px;
  padding: 6px 10px;
  border-color: #ccc;
  color: #555;
  font-weight: 400;
}

.tool-btn.active {
  background: #111;
  color: #fff;
  border-color: #111;
}

#answerBtn {
  font-size: 13px;
  padding: 7px 12px;
  border-color: #aaa;
  color: #555;
  font-weight: 400;
}

#answer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

#answer-overlay.hidden {
  display: none;
}

#answer-modal {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  width: 88vw;
  max-width: 360px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

#answer-title {
  font-size: 14px;
  font-weight: 700;
  color: #333;
  letter-spacing: 0.05em;
}

#answerCanvas {
  position: static;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #f4f6fb;
  border: 1px solid #e0e0e0;
}

#closeAnswerBtn {
  width: 100%;
  padding: 11px;
  background: #111;
  color: #fff;
  border-color: #111;
  font-size: 14px;
  border-radius: 8px;
  font-weight: 700;
}

#retryBtn {
  width: 100%;
  padding: 12px;
  background: #111;
  color: #fff;
  border-color: #111;
  font-size: 15px;
  border-radius: 8px;
}