body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: rgba(0, 0, 0, 0); /* Transparent for OBS */
    color: white;
    margin: 0;
    padding: 10px; /* Reduced padding */
    overflow: hidden;
}

.container {
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px; /* Reduced padding from 15px */
    border-radius: 12px;
    width: 320px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

.header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 5px; /* Reduced margin from 10px */
    position: static; /* Allow children to position relative to container */
}

.title-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    width: 100%; /* Ensure full width for centering */
}

.controls-wrapper {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    align-items: center;
}

.settings-icon, .reset-icon, .toggle-icon {
    cursor: pointer;
    font-size: 1.2em; /* Reduced size */
    opacity: 0.5;
    transition: opacity 0.3s;
    z-index: 10; /* Ensure clickable */
    padding: 5px; /* Increase click area */
    margin-left: 5px;
}

.settings-icon:hover, .reset-icon:hover, .toggle-icon:hover {
    opacity: 1;
}

h1 {
    text-align: center;
    margin: 0;
    font-size: 2em; /* Slightly reduced from 2.2em */
    line-height: 1.1; /* Tighter line height */
    font-weight: 900;
    letter-spacing: 2px;
    background: linear-gradient(180deg, #ffcc00 0%, #ff4d4d 50%, #cc0000 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(2px 2px 0px #000);
    position: relative;
    z-index: 1;
}

/* Notification Area */
.notification {
    background-color: #ffcc00;
    color: #000;
    padding: 10px; /* Reduced padding */
    margin-bottom: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    font-size: 1em; /* Reduced font size */
    animation: slideDown 0.5s ease-out;
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.6);
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Timer Display */
.timer {
    text-align: center;
    font-size: 1.5em; /* Reduced font size */
    font-weight: bold;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 10px; /* Reduced padding */
    border-radius: 8px;
    margin-bottom: 15px;
    border: 2px solid #ff4d4d;
    box-shadow: 0 0 10px rgba(255, 77, 77, 0.3);
}

.timer.ended {
    background: #ff4d4d;
    color: white;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Target Word Display */
.target-words-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px; /* Reduced gap */
    margin-bottom: 15px;
    justify-content: center;
}

.target-word-item {
    background: linear-gradient(90deg, #ff4d4d, #ff8c00);
    padding: 6px 10px; /* Reduced padding */
    border-radius: 6px;
    display: flex;
    align-items: center;
    font-size: 1em; /* Reduced font size */
    box-shadow: 0 4px 10px rgba(255, 77, 77, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    min-width: 120px; /* Reduced width */
}

.target-word-item .label {
    font-size: 0.7em;
    opacity: 0.8;
    margin-right: 8px;
}

.target-word-item .text {
    font-weight: bold;
    text-transform: uppercase;
    flex-grow: 1;
    text-align: left;
    margin-right: 8px;
}

.target-word-item .count {
    background: white;
    color: #ff4d4d;
    padding: 1px 8px;
    border-radius: 12px;
    font-weight: bold;
    min-width: 15px;
    text-align: center;
}

/* Layout Variants */
/* Vertical Right */
body.layout-vertical-right {
    display: flex;
    justify-content: flex-end;
}

/* Horizontal Top */
body.layout-horizontal-top,
body.layout-horizontal-bottom {
    padding: 0;
}

/* Horizontal Bottom Specifics */
body.layout-horizontal-bottom {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100vh;
    box-sizing: border-box;
}

body.layout-horizontal-top .container {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

body.layout-horizontal-bottom .container {
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.8);
}

body.layout-horizontal-top .container,
body.layout-horizontal-bottom .container {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 5px 15px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 0;
    gap: 15px;
}

body.layout-horizontal-top .header,
body.layout-horizontal-bottom .header {
    margin-bottom: 0;
    margin-right: 10px;
    position: static; /* Allow absolute children to reference container */
}

body.layout-horizontal-top .title-wrapper,
body.layout-horizontal-bottom .title-wrapper {
    margin-right: 0;
    align-items: flex-start;
}

body.layout-horizontal-top h1,
body.layout-horizontal-bottom h1 {
    font-size: 1.2em;
    white-space: nowrap;
}

body.layout-horizontal-top .channel-display,
body.layout-horizontal-bottom .channel-display {
    display: none !important;
}

body.layout-horizontal-top .controls-wrapper,
body.layout-horizontal-bottom .controls-wrapper {
    position: absolute; /* Stick to right of container */
    right: 40px; /* Moved inward from 15px */
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0;
    order: unset;
}

body.layout-horizontal-top #word-list,
body.layout-horizontal-bottom #word-list {
    display: flex;
    flex-direction: row;
    gap: 10px;
    position: absolute; /* Absolute center */
    left: 50%;
    transform: translateX(-50%);
    justify-content: center;
    width: auto;
    white-space: nowrap;
}

body.layout-horizontal-top #word-list.hidden,
body.layout-horizontal-bottom #word-list.hidden {
    display: none !important;
}

body.layout-horizontal-top .word-item,
body.layout-horizontal-bottom .word-item {
    margin-bottom: 0;
    padding: 4px 8px;
    font-size: 0.9em;
    white-space: nowrap;
}

body.layout-horizontal-top .word-count,
body.layout-horizontal-bottom .word-count {
    margin-left: 5px;
}

body.layout-horizontal-top .timer,
body.layout-horizontal-bottom .timer {
    margin-bottom: 0;
    padding: 2px 6px;
    font-size: 1em;
    margin-right: 10px;
    white-space: nowrap;
}

body.layout-horizontal-top .target-words-container,
body.layout-horizontal-bottom .target-words-container {
    margin-bottom: 0;
    flex-wrap: nowrap;
    margin-right: 10px;
}

body.layout-horizontal-top .target-word-item,
body.layout-horizontal-bottom .target-word-item {
    padding: 2px 6px;
    font-size: 0.8em;
    min-width: auto;
}

/* Hide notification in horizontal mode or adjust it? */
body.layout-horizontal-top .notification {
    position: absolute;
    top: 60px; /* Below the bar */
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

body.layout-horizontal-bottom .notification {
    position: absolute;
    bottom: 60px; /* Above the bar */
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

/* Modal Styles */
.modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    justify-content: center;
    align-items: center;
}

.hidden {
    display: none;
}

.modal-content {
    background-color: #2a2a2a;
    padding: 0; /* Remove global padding */
    border-radius: 10px;
    width: 450px; /* Increased width */
    max-height: 85vh;
    position: relative;
    box-shadow: 0 0 20px rgba(255, 77, 77, 0.3);
    text-align: left;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 15px;
    background-color: #2a2a2a;
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    border-radius: 10px 10px 0 0;
}

.modal-body {
    padding: 20px;
    flex-grow: 1;
    overflow-y: auto;
}

.modal-content h2 {
    text-align: center;
    color: #ff4d4d;
    margin: 0;
}

.close {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    z-index: 30;
}

.settings-section {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 3px solid #ff4d4d;
}

.settings-section h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1em;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 5px;
}

.close:hover,
.close:focus {
    color: white;
    text-decoration: none;
    cursor: pointer;
}

.input-group {
    margin-bottom: 12px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: bold;
    color: #ddd;
    font-size: 0.9em;
}

.input-group input {
    width: 100%;
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #555;
    background-color: #333;
    color: white;
    box-sizing: border-box;
}

select {
    width: 100%;
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #555;
    background-color: #333;
    color: white;
    box-sizing: border-box;
}

button {
    background-color: #ff4d4d;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 15px;
    width: 100%;
    font-weight: bold;
    transition: background-color 0.3s;
    margin-top: 8px;
}

button:hover {
    background-color: #cc0000;
}

.word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    margin-bottom: 6px; /* Reduced margin */
    padding: 6px 10px; /* Reduced padding */
    border-radius: 6px;
    font-size: 1.1em; /* Reduced font size */
    animation: popIn 0.3s ease-out;
}

.word-text {
    font-weight: bold;
    text-transform: uppercase;
}

.word-count {
    background: #ff4d4d;
    padding: 2px 8px;
    border-radius: 15px;
    font-size: 0.8em;
    min-width: 25px;
    text-align: center;
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Confirmation Modal Specifics */
.confirmation-content {
    width: 300px;
    text-align: center;
}

.confirmation-buttons {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
}

.confirm-btn {
    width: 40%;
    margin-top: 0;
}

.confirm-btn.yes {
    background-color: #ff4d4d;
}

.confirm-btn.yes:hover {
    background-color: #cc0000;
}

.confirm-btn.no {
    background-color: #555;
}

.confirm-btn.no:hover {
    background-color: #777;
}

/* Fire Animation */
.fire-icon {
    display: inline-block;
    animation: fire-flicker 1.5s infinite ease-in-out;
}

@keyframes fire-flicker {
    0% { transform: scale(1); filter: brightness(100%); }
    50% { transform: scale(1.2); filter: brightness(130%); }
    100% { transform: scale(1); filter: brightness(100%); }
}