@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.control-panel {
    margin: 50px 0 25px;
    gap: 10px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 2rem;
}

.control-panel button {
    margin: 1px 0;
    background: #0b76ff;
    color: #f3f4f7;
    border: 0;
    min-width: 80px;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgb(0 0 0 / 15%), inset 0 -2px 4px rgb(201 201 201 / 60%);
}

.control-panel button:disabled {
    cursor: default;
    color: #b0b0b0;
    font-variant: JIS78;
    width: 80px;
    background: #d9d9d9;
}

#show-input-btn {
    border-right: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

#show-output-btn {
    border-left: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -5px;
}

.control-panel button.process-btn {
    background: #0b76ff;
    border-color: #0b76ff;
    color: #fff;
    margin-left: 20px;
}

.options-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

fieldset {
    border: 1px solid #555;
    padding: 15px;
    border-radius: 8px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #f3ffdf;
}

fieldset:hover {
    border-color: #0b76ff;
}

legend {
    font-weight: bold;
    color: #0b76ff;
    padding: 0 10px;
    font-size: 1.1em;
}

.options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    justify-content: center;
    padding-top: 10px;
}

.label-inline {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hidden {
    display: none;
}

input[type="text"],
select {
    background: #fff;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    transition: all 0.3s ease;
    max-width: 100%;
    box-sizing: border-box;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: #0b76ff;
    box-shadow: 0 0 0 2px rgba(11, 118, 255, 0.2);
}

input:disabled,
select:disabled {
    background: #eee;
    cursor: not-allowed;
}

.position-options {
    display: flex;
    gap: 10px;
}

.code-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    animation: fadeIn 0.5s ease-out;
}

.code-grid.hidden {
    display: none;
}

.code-group {
    min-width: 0;
}

.code-group textarea {
    text-align: left;
}

.code-group label {
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

#output-container {
    word-break: break-word;
    font-size: 12px;
}

#output-container b {
    color: #5b68ff;
}

#output-container i {
    background: #5b68ff;
    color: #ffffff;
    padding: 2px 4px 1px;
    border-radius: 4px;
    font-weight: bold;
}

.copy-btn {
    background: #555;
    color: #fff;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: copy;
    transition: background-color 0.2s ease;
    display: none;
}

.copy-btn:hover {
    background: #0654c0;
}

textarea {
    width: 100%;
    min-height: 180px;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #555;
    resize: vertical;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

textarea:focus {
    outline: none;
    border-color: #0b76ff;
    box-shadow: 0 0 0 3px rgba(11, 118, 255, 0.25);
}

button#fillBtn {
    float: right;
    background: #ffffff;
    color: #00ab5c;
    font-size: 12px;
}

.report-container {
    margin-bottom: -30px;
    margin-top: 30px;
    padding: 0 10px;
    background-color: #fffbe6;
    border: 1px solid #ffe58f;
    border-radius: 8px;
    color: #8a6d3b;
    font-family: 'Courier New', Courier, monospace;
    white-space: pre-wrap;
    animation: fadeIn 0.5s ease-out;
}

.report-container h3 {
    margin-top: 0;
    color: #8a6d3b;
    border-bottom: 1px solid #ffe58f;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.report-container code {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 2px 5px;
    border-radius: 4px;
}

.CodeMirror {
    border: 1px solid #ccc;
    border-radius: 8px;
    height: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    width: 100%;
    box-sizing: border-box;
}

.CodeMirror-scroll {
    height: 250px;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.control-panel .process-btn {
    margin-left: 25px;
    padding-left: 10px;
    padding-right: 20px;
    background: #00504d;
}

.control-panel .process-btn:hover {
    background: #006c68;
}

#manual_prefix_input::placeholder,
#length_select {
    color: #4e4e4e;
}

#manual_prefix_input:disabled::placeholder,
#length_select:disabled {
    color: #aaa;
}

textarea,
input[type="text"],
input[type="number"],
select {
    width: 100%;
    text-align: center;
    min-width: 80px;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 1rem;
    font-family: 'Fira Code', monospace;
}

button,
input[type="submit"] {
    background-color: #0b76ff;
    border: none;
    color: #fff;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover,
input[type="submit"]:hover {
    background-color: #0b5ed7;
}

@media (min-width: 900px) {
    .code-grid {
        grid-template-columns: 1fr 1fr;
    }
}
/* ---------- QUICK FIX: unify widths and prevent overflow ---------- */
:root{
  --site-max: 1200px;
  --gutter: 1rem;
}

/* make a single "site width" rule and apply to header, main, footer, tool container */
.site-inner,
.site-header .inner,
.content-area,
footer > p,
.container,
.container, /* in case you keep using .container */
.main-content {
  max-width: var(--site-max);
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  width: 100%;
  box-sizing: border-box;
}

/* If .container is used as a white panel, keep background but keep same width/padding */
.container {
  /* keep visual card if needed */
  background: #fff;
  padding: 1rem;      /* reduce from 30px to match site gutter */
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

/* Reduce minimum column width on options to avoid pushing layout on small screens */
.options-container {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

/* Ensure control-panel doesn't push horizontally */
.control-panel {
  display: block;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 1rem 0;
  padding: 0.75rem;
}

/* Remove wide fixed margins that cause overflow */
.control-panel .process-btn { margin-left: 0; }

/* Make inputs left-aligned on small screens (better UX & no centered overflow) */
@media (max-width: 600px) {
  .options-container { grid-template-columns: 1fr; }
  .container { padding: 0.75rem; }
  .site-header .inner { padding-left: 0.75rem; padding-right: 0.75rem; }
  .content-area { padding-left: 0.75rem; padding-right: 0.75rem; }
  footer > p { padding-left: 0.75rem; padding-right: 0.75rem; }
  textarea, input[type="text"], select { text-align: left; }
}

/* Keep CodeMirror responsive */
.CodeMirror { width: 100% !important; box-sizing: border-box; }
