:root {
  color-scheme: light;
  --bg: #f3f4f7;
  --card: #ffffff;
  --text: #1d2230;
  --muted: #6b7385;
  --border: #dcdfe8;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }

body {
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  height: 100dvh;
  width: min(100%, 480px);
  margin: 0 auto;
  padding: 10px 12px 12px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
}

.header h1 { margin: 0; font-size: 1.2rem; }
.header p { margin: 2px 0 0; color: var(--muted); font-size: 0.82rem; }

.canvas-zone,
.controls {
  background: var(--card);
  border: 1px solid var(--border);
}

.canvas-zone {
  padding: 10px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.icon-preview {
  width: min(84vw, 340px, 43dvh);
  aspect-ratio: 1/1;
  position: relative;
  display: grid;
  place-items: center;
  background: #ffffff;
  overflow: hidden;
}

.icon-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  background: radial-gradient(circle at center, transparent 49.9%, rgba(0, 0, 0, 0.35) 50%);
}

.icon-preview[data-preview-mode="circle"]::after { opacity: 1; }

.emoji-layer {
  width: 100%;
  height: 100%;
  padding: 0 6%;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: clamp(56px, 16.8vw, 108px);
  line-height: 1.12;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
  outline: none;
  border: 1px dashed transparent;
}

.emoji-layer:focus { border-color: rgba(35, 42, 59, 0.5); }

.controls { padding: 10px; display: grid; gap: 8px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field { display: grid; gap: 4px; font-size: 0.8rem; }

.field-color input[type="color"] {
  width: 38px;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--border);
  background: #fff;
}

input, select, button { font: inherit; }

select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border);
  padding: 0 10px;
  background: #fff;
}

.mode-block { display: grid; gap: 4px; }
.mode-label { font-size: 0.8rem; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); }

.mode-btn {
  height: 38px;
  border: none;
  border-right: 1px solid var(--border);
  background: #fff;
}

.mode-btn:last-child { border-right: none; }
.mode-btn.is-active { background: #232a3b; color: #fff; }

.btn {
  height: 40px;
  border: 1px solid #232a3b;
  background: #232a3b;
  color: #fff;
  font-weight: 600;
}

@media (max-height: 680px) {
  .header p { display: none; }
  .icon-preview { width: min(72vw, 300px, 37dvh); }
}
