:root {
  --bg: #f3f3f3;
  --surface: #ffffff;
  --text: #2c2c2c;
  --muted: #5d5d5d;
  --danger: #dd5a0f;
  --panel-shadow: rgba(44, 44, 44, 0.2);
  --font-base: "Inter", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Meiryo", sans-serif;
}

html {
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-base);
  font-size: 14px;
  font-weight: 400;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

button, input, textarea {
  font: inherit;
  border: 0;
  background: none;
  outline: none;
}

body {
  display: flex;
  justify-content: center;
}

.app {
  width: 100%;
  max-width: 640px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.screen {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.screen::-webkit-scrollbar {
  display: none;
}

.preview-wrapper {
  padding: 24px 24px 0;
  display: flex;
  justify-content: center;
}

.preview-container {
  width: 100%;
  aspect-ratio: 4 / 5;
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transform-origin: top center;
  will-change: transform;
}

.preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.preview-placeholder {
  color: var(--muted);
  font-size: 14px;
}

.editor-group {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* デザイン切り替え ＆ ぼかしボタンのラッパー */
.design-toggle-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.design-toggle {
  position: relative;
  display: inline-flex;
  background: #ffffff;
  border-radius: 24px;
  height: 48px;
}

.design-toggle::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: #2c2c2c;
  border-radius: 24px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
}

.design-toggle[data-active="2"]::before {
  transform: translateX(100%);
}

.toggle-btn {
  position: relative;
  z-index: 1;
  flex: 1;
  height: 48px;
  padding: 0 16px;
  border-radius: 24px;
  color: #2c2c2c;
  background: transparent;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: color 0.3s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toggle-btn.active {
  color: #ffffff;
}

.input-row {
  display: flex;
  gap: 16px;
}

.input-row.multi {
  gap: 12px;
}

.input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--surface);
  border-radius: 24px;
  min-height: 48px;
  padding: 0 16px;
  gap: 12px;
}

.input-wrapper.align-start {
  align-items: flex-start;
}

.mt-14 {
  margin-top: 14px;
}

.input-wrapper.small {
  padding: 0 16px;
  gap: 6px;
}

.input-icon {
  color: var(--text);
  flex-shrink: 0;
}

.input-prefix {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.input-field {
  flex: 1;
  width: 100%;
  font-size: 14px;
  color: var(--text);
  padding: 0;
  margin: 0;
}

.input-field::placeholder {
  color: #a0a0a0;
}

.input-field.right-align {
  text-align: right;
}

input.input-field {
  height: 48px;
}

.textarea-field {
  resize: none;
  padding: 14px 0;
  line-height: 20px;
  min-height: 48px;
  overflow: hidden;
  box-sizing: border-box;
  display: block;
}

.control-panel {
  flex: 0 0 auto;
  background: var(--surface);
  border-radius: 32px 32px 0 0;
  box-shadow: 0 0 24px var(--panel-shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 30;
}

.actions {
  display: flex;
  align-items: center;
}

.action-button {
  flex: 1 1 0;
  min-width: 0;
  height: 48px;
  border-radius: 24px;
  background: var(--bg);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  white-space: nowrap;
}

#downloadButton {
  margin-left: 12px;
}

#downloadButton.hide {
  flex: 0 0 0;
  padding: 0;
  margin-left: 0;
  opacity: 0;
  pointer-events: none;
}

.action-icon-button {
  width: 48px;
  height: 48px;
  border-radius: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  flex: 0 0 48px;
  margin-left: 12px;
}

.action-icon-button.danger {
  background: var(--bg);
  color: var(--text);
}

.action-icon-button.bg-white {
  background: var(--surface);
  color: var(--text);
  transition: all 0.3s ease;
  margin-left: 0; 
}

.action-icon-button.bg-white.active {
  background: var(--text);
  color: var(--surface);
}

.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 20px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 16px;
  transition: color 0.3s ease;
}

.status.error {
  color: var(--danger);
}

.status svg {
  flex: 0 0 16px;
}

@keyframes fadeUpText {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-text {
  animation: fadeUpText 0.3s ease-out forwards;
}