:root {
    --bg-color: #f0f2f5;
    --container-bg: #ffffff; 
    --text-color: #333333;
    --accent-color: #007bff;
    --accent-hover: #0056b3;
    --option-text: #555555;
    --shadow-color: rgba(0,0,0,0.1);
}
body.dark {
    --bg-color: #121212;
    --container-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --accent-color: #4dabf7;
    --accent-hover: #339af0;
    --option-text: #b0b0b0;
    --shadow-color: rgba(255,255,255,0.1);
}
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    transition: background-color 0.3s, color 0.3s;
    display: flex;
    flex-direction: column;
}
.container {
    background: var(--container-bg);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px var(--shadow-color);
    text-align: center;
    max-width: 700px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: background-color 0.3s, box-shadow 0.3s;
    border: 1px solid var(--shadow-color);
    margin: 0 auto;
}
.text-container {
    background: var(--container-bg);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px var(--shadow-color);
    text-align: left;
    max-width: 95%;
    width: 100%;
    border: 1px solid var(--shadow-color);
    margin: 2rem auto 0 auto;
}
.text-container h2 { color: var(--accent-color); margin-top: 0; }
.text-container h3 { color: var(--text-color); margin-top: 1.5rem; }
.text-container p, .text-container li { line-height: 1.7; color: var(--option-text); margin-bottom: 0.5rem; }
.text-container ul, .text-container ol { margin-left: 20px; padding-left: 0; }
h1 {
    color: var(--accent-color);
    margin-top: 0;
    margin-bottom: 0;
    font-size: 1.5rem;
}
#result {
    font-size: 1.75rem;
    font-weight: bold;
    color: var(--accent-color);
    margin-bottom: 0;
    min-height: 2.5rem;
    /* word-break: break-all; removed to prevent breaking icons row */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.6;
}
button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}
button:hover {
    background-color: var(--accent-hover);
}
.button-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    width: 100%;
}
.button-group button {
    margin: 0;
    flex: 1 1 auto;
}
.options {
    margin-bottom: 0;
    color: var(--option-text);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    text-align: left;
}
select {
    padding: 5px;
    border-radius: 4px;
}
#copyBtn {
    background-color: #6610f2;
    display: none;
}
#copyBtn:hover {
    background-color: #5a6268;
}
#saveBtn {
    background-color: #28a745;
    display: none;
}
#exportBtn {
    background-color: #17a2b8;
    display: none;
}
.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 95%;
    padding: 12px 20px;
    box-sizing: border-box;
    margin: 0 auto 10px auto;
    background-color: var(--bg-color);
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color);
    font-size: 1.1rem;
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
    flex-wrap: wrap;
    gap: 1rem;
    border: 1px solid transparent;
    transition: transform 0.2s, border-color 0.2s;
}
.result-item:hover {
    transform: translateY(-2px);
    border-color: var(--accent-color);
}
.result-name {
    font-weight: bold;
    color: var(--text-color);
    flex: 1;
    text-align: left;
    min-width: 150px;
}
.action-container {
    display: flex;
    align-items: center;
    gap: 8px;
}
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: rgba(0,0,0,0.05);
    color: var(--option-text);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-wrap: wrap;
    text-decoration: none;
}
.icon-btn:hover {
    background: var(--accent-color);
    color: white;
    transform: scale(1.1);
}
.icon-btn.copy-individual {
    margin-right: 8px;
    background: rgba(0,123,255,0.1);
    color: var(--accent-color);
}
.icon-btn.copy-individual:hover {
    color: var(--accent-color);
    background: rgba(0,123,255,0.2);
}
@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
    from { opacity: 0; transform: translateY(20px); }
}
.custom-inputs {
    display: none;
    flex-direction: column;
    gap: 10px;
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 10px;
}
.custom-inputs textarea {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    box-sizing: border-box;
    font-family: inherit;
    resize: vertical;
}
.favorites-section {
    margin-top: 1rem;
    text-align: left;
    width: 100%;
    border-top: 1px solid var(--shadow-color);
    padding-top: 1rem;
}
.favorites-section h3 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
    color: var(--text-color);
}
#favoritesList {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 150px;
    overflow-y: auto;
}
#favoritesList li {
    background: var(--bg-color);
    margin-bottom: 5px;
    padding: 8px;
    border-radius: 4px;
    color: var(--text-color);
    border: 1px solid var(--shadow-color);
}
.history-section {
    margin-top: 1rem;
    text-align: left;
    width: 100%;
    border-top: 1px solid var(--shadow-color);
    padding-top: 1rem;
    display: none;
}
.history-batch {
    margin-bottom: 10px;
    padding: 10px;
    background: rgba(0,0,0,0.02);
    border-radius: 8px;
}
.lock-word-option {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.lock-word-option > div {
    display: flex;
    gap: 10px;
}
.lock-word-option input[type="text"] {
    flex-grow: 1;
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-width: 100px;
}
@media (max-width: 480px) {
    .container {
        padding: 1.5rem;
    }
}
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    width: 100%;
    box-sizing: border-box;
}