body {
  margin: 0;
  font-family: "Poppins", sans-serif;
  background: linear-gradient(to right, #1f1c2c, #928dab);
  color: #f8f9fa;
}

h1.title {
  font-size: 40px;
  text-align: center;
  margin-bottom: 30px;
  color: #ffe082;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
}

.instruction-manual {
  background: #2e2e48;
  padding: 24px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.6;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  font-family: "JetBrains Mono", monospace;
  margin-bottom: 40px;
  color: #f8f9fa;
}

.instruction-manual h2 {
  cursor: pointer;
  user-select: none;
  position: relative;
  color: #ffca28;
  margin-top: 0;
  transition: color 0.3s ease;
}

.instruction-manual h2::after {
  content: "▸";
  font-size: 14px;
  transform-origin: center;
  position: absolute;
  right: 10px;
  transition: transform 0.3s ease;
}

.instruction-manual h2.open::after {
  transform: rotate(90deg);
}

.instruction-manual .instruction-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.4s ease;
}

.instruction-manual h2.open + .instruction-content {
  max-height: 1000px;
  opacity: 1;
}

.instruction-manual p:hover {
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 10px;
  border-left: 3px solid #00bcd4;
  transition: all 0.3s ease;
}

h1,
label {
  font-weight: 600;
}

.main-container {
  max-width: 960px;
  margin: auto;
  padding: 40px 20px;
}

.card {
  background: #1f1f2e;
  color: #e0e0e0;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  margin-bottom: 40px;
}

label {
  color: #c7d4ff;
  display: block;
  margin-top: 20px;
  font-size: 14px;
}

input[type="file"] {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}

input[type="file"],
input[type="range"],
select {
  background-color: #3c3c4e;
  color: #fff;
  border: 1px solid #555;
  font-family: "JetBrains Mono", monospace;
}

input[type="range"]::-webkit-slider-thumb {
  background: #00bcd4;
}

.layout-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 20px;
}

.layout-controls label {
  font-weight: 600;
  margin-top: 10px;
}

.layout-controls input[type="range"],
.layout-controls select {
  width: 100%;
}

.buttons {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  background-color: #00bcd4;
  border: none;
  color: white;
  font-weight: bold;
  font-family: "JetBrains Mono", monospace;
  transition: background 0.3s;
  padding: 12px 20px;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
}

button:hover {
  background-color: #0097a7;
}

.output-section {
  background: #12121c;
  border-radius: 10px;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 20px;
  box-sizing: border-box;
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(-50vw + 50%);
  gap: 0;
}

.page {
  position: relative;
  width: var(--bg-width, 595px);
  height: var(--bg-height, 842px);
  background-size: cover;
  background-position: top left;
  margin-bottom: 20px;
  border: 1px solid #ccc;
  overflow: hidden;
  flex: 0 0 auto;
  max-width: unset;
}

:root {
  --bg-width: 595px;
  --bg-height: 842px;
}

.greeting {
  color: #000;
  white-space: pre-line;
  font-size: 24px;
  line-height: 1.4;
  font-family: "Poppins", sans-serif;
  position: absolute;
  z-index: 1;
}

.text-block {
  position: absolute;
  top: 230px;
  left: 137px;
  width: calc(100% - 120px);
  white-space: pre-line;
  font-size: 24px;
  line-height: 1.4;
  color: #000;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.text-block span {
  display: inline-block;
  height: 1em;
}

.scaled-container {
  display: inline-block;
  padding-right: 4px;
}

.preview-wrapper {
  transform: scale(1);
  transform-origin: top left;
  display: inline-block;
  margin: 0;
  padding: 0;
}

.letter-summary {
  font-size: 18px;
  font-weight: bold;
  color: #ffffff;
  background: #1b1b2f;
  padding: 10px;
  margin-top: 20px;
  margin-bottom: 10px;
  border-left: 4px solid #00bcd4;
}

#summaryBox {
  background: #1f1f2e;
  border-radius: 10px;
  margin-top: 20px;
  overflow: hidden;
}

.letter-summary {
  margin: 0;
}

.form-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  padding: 24px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.left-panel,
.right-panel {
  flex: 1 1 300px;
}

.right-panel h3 {
  margin-top: 0;
  color: #ffd54f;
  font-weight: bold;
  margin-bottom: 10px;
}

.left-panel label,
.right-panel label {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
}

.left-panel input[type="file"] {
  margin-top: 4px;
}

.right-panel input[type="range"],
.right-panel select {
  margin-top: 4px;
}

.buttons {
  margin-top: 0;
}

button:nth-child(4) {
  background-color: #f5f5f5;
  color: #333;
  border: 1px solid #ccc;
}

select,
input[type="range"] {
  margin-top: 8px;
}

@media (max-width: 700px) {
  .form-wrapper {
    flex-direction: column;
  }
}
