* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-image: url('fon.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: scroll;
    background-color: #1e1710;
    font-family: 'Georgia', 'Times New Roman', serif;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    background: transparent;
}

.narrative-box {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    font-size: 16px;
    line-height: 1.4;
    color: #fef1df;
    text-shadow: 0 0 2px black;
    background: transparent;
    backdrop-filter: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.narrative-box p {
    margin: 0;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,200,0.1);
}

.input-area {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border-top: 1px solid rgba(255,255,200,0.3);
    padding: 10px 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-type-switch {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}

.action-type-btn {
    background: rgba(0, 0, 0, 0.6);
    color: #fef1df;
    border: 1px solid #8742D6;
    padding: 6px 12px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
    transition: 0.1s;
}

.action-type-btn.active {
    background: #4a6a3c;
    border-color: #8742D6;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}

.input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

textarea {
    flex: 1;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #8742D6;
    border-radius: 40px;
    padding: 14px;
    font-family: inherit;
    font-size: 1rem;
    color: #fef1df;
    resize: none;
    backdrop-filter: none;
}

textarea::placeholder {
    color: #ccc;
}

#doAction {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #8742D6;
    border-radius: 40px;
    width: 50px;
    height: 50px;
    font-size: 30px;
    cursor: pointer;
    color: #fef1df;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.1s;
}

#doAction:active {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(0.96);
}

#settingsGear {
    position: fixed;
    bottom: 64px;
    right: 6px;
    width: 42px;
    height: 42px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 23.52px;
    cursor: pointer;
    z-index: 100;
    border: 1px solid #8742D6;
    backdrop-filter: blur(4px);
    transition: transform 0.2s;
    color: #fef1df;
}

#settingsGear:active {
    transform: scale(0.95);
    background: rgba(0, 0, 0, 0.9);
}

.control-panel {
    position: fixed;
    bottom: 118px;
    right: 6px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 99;
    border: 1px solid #8742D6;
    transition: transform 0.2s ease;
}

.control-panel.hidden {
    transform: translateX(120%);
    pointer-events: none;
}

.ctrl-btn {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #8742D6;
    padding: 4px 8px;
    border-radius: 40px;
    color: #fef1df;
    font-weight: bold;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    font-size: 10px;
    transition: 0.1s;
}

.ctrl-btn:active {
    background: rgba(0, 0, 0, 0.9);
}

.admin-panel {
    position: fixed;
    bottom: 140px;
    left: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    padding: 15px;
    z-index: 98;
    border: 1px solid #8742D6;
    max-height: 70vh;
    overflow-y: auto;
    color: #f3e5c9;
    font-size: 0.8rem;
}

.admin-panel.hidden {
    display: none;
}

.admin-panel pre {
    background: #1e1710;
    padding: 8px;
    border-radius: 12px;
    overflow-x: auto;
    margin-top: 8px;
}

.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal:not(.hidden) {
    display: flex;
}

.modal-content {
    background: #2a1f15;
    padding: 20px;
    border-radius: 32px;
    max-width: 90%;
    max-height: 80%;
    overflow: auto;
    position: relative;
    color: #fef1df;
    border: 1px solid #8742D6;
}

.creator-content {
    max-width: 600px;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    cursor: pointer;
    color: #fef1df;
}

.hidden {
    display: none;
}

.relations-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    background: rgba(0,0,0,0.5);
    padding: 5px 10px;
    border-radius: 30px;
}

.relations-detail-name {
    width: 140px;
    font-weight: bold;
}

.relations-detail-value {
    width: 50px;
    text-align: center;
}

.slots-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.slot-btn {
    background: rgba(0,0,0,0.6);
    border: 1px solid #8742D6;
    padding: 8px;
    border-radius: 40px;
    color: #fef1df;
    cursor: pointer;
    font-weight: bold;
    transition: 0.1s;
}

.slot-btn:active {
    background: rgba(0,0,0,0.9);
}

select {
    background: rgba(0,0,0,0.7);
    color: #fef1df;
    padding: 8px;
    border-radius: 20px;
    border: 1px solid #8742D6;
}

/* Убираем белые рамки у fieldset */
fieldset {
    border: none;
    margin: 15px 0;
    padding: 0;
}
legend {
    font-weight: bold;
    margin-bottom: 8px;
}

/* Стили для формы */
#creatorForm label, #creatorForm fieldset {
    display: block;
    margin-top: 15px;
}
#creatorForm input, #creatorForm select, #creatorForm textarea {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    background: rgba(0,0,0,0.6);
    border: 1px solid #8742D6;
    border-radius: 20px;
    color: #fef1df;
}
.family-member {
    background: rgba(0,0,0,0.4);
    padding: 10px;
    border-radius: 20px;
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.family-member input, .family-member select {
    flex: 1;
    min-width: 100px;
}
.family-character {
    flex: 2;
}
.remove-family-btn {
    background: #8b3a3a;
    border: none;
    color: white;
    border-radius: 20px;
    padding: 5px 10px;
    cursor: pointer;
}
#addFamilyBtn {
    margin-top: 10px;
}
#nameWarning {
    margin-top: 5px;
}