@import url('https://fonts.googleapis.com/css2?family=Dela+Gothic+One&family=Hachi+Maru+Pop&family=Kaisei+Decol:wght@400;700&family=Kiwi+Maru:wght@400;500&family=Noto+Sans+JP:wght@400;700&family=Noto+Serif+JP:wght@400;700&family=Yuji+Boku&family=Yuji+Mai&family=Yuji+Syuku&display=swap');

.jp-wrap {
  --color-border: #e2e8f0;
  --color-bg-panel: #ffffff;
  --color-bg-card: #f8fafc;
  --color-text-dim: #64748b;
  --color-text-main: #0f172a;
  --font-sans: 'Google Sans Flex', sans-serif;
  
  max-width: 650px;
  margin: 0 auto;
  padding: 0 0 24px;
  font-family: var(--font-sans);
  color: var(--color-text-main);
}

.jp-wrap * {
  box-sizing: border-box;
}

.jp-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-dim);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
  margin-top: 16px;
  display: block;
}

.jp-textarea-wrap textarea {
  width: 100%;
  font-size: 15px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg-panel);
  color: var(--color-text-main);
  resize: vertical;
  line-height: 1.5;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
  min-height: 80px;
}

.jp-textarea-wrap textarea:focus {
  border-color: #0f172a;
}

/* Style Grid */
.jp-style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.jp-style-card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  background: var(--color-bg-card);
  transition: all .12s;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  text-align: center;
}

.jp-style-card:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
}

.jp-style-card.active {
  border-color: #0f172a;
  background: #f8fafc;
  box-shadow: 0 0 0 2px #0f172a;
}

.jp-style-preview {
  font-size: 18px;
  margin-bottom: 4px;
  color: var(--color-text-main);
  font-weight: 500;
}

.jp-style-name {
  font-size: 10px;
  color: var(--color-text-dim);
}

/* Controls */
.jp-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}

.jp-control-group {
  flex: 1;
  min-width: 130px;
}

.jp-control-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-dim);
  margin-bottom: 6px;
}

.jp-range-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.jp-range-wrap input[type="range"] {
  flex: 1;
  accent-color: #0f172a;
  cursor: pointer;
}

.jp-range-val {
  font-size: 11px;
  font-family: monospace;
  min-width: 32px;
  color: var(--color-text-main);
}

.jp-select {
  width: 100%;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
  outline: none;
  font-size: 12px;
}

/* Color & Screen theme selectors */
.jp-palette-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.jp-color-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
}

.jp-color-btn:hover {
  transform: scale(1.1);
}

.jp-color-btn.active {
  border-color: #0f172a;
  transform: scale(1.15);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.2);
}

/* Washi Paper Preview Box */
.jp-preview-box {
  position: relative;
  width: 100%;
  min-height: 200px;
  background: #fcfaf2;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.jp-preview-text {
  text-align: center;
  transition: color 0.2s, font-size 0.1s, font-family 0.1s;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-all;
  max-width: 100%;
  line-height: 1.4;
}

/* Washi texture overlay */
.jp-preview-box::before {
  content: " ";
  display: block;
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background-image: radial-gradient(rgba(0,0,0,0.02) 1px, transparent 0), radial-gradient(rgba(0,0,0,0.01) 2px, transparent 0);
  background-size: 8px 8px, 16px 16px;
  z-index: 1;
  pointer-events: none;
}

.jp-preview-text {
  position: relative;
  z-index: 2;
}

/* Actions */
.jp-actions {
  display: flex;
  gap: 12px;
}

.jp-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  color: var(--color-text-main);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.jp-btn:hover {
  background: #cbd5e1;
  border-color: #94a3b8;
}

.jp-btn-primary {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

.jp-btn-primary:hover {
  background: #1e293b;
  border-color: #1e293b;
}

.jp-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #22c55e;
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s, opacity 0.2s;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.jp-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
