@font-face {
    font-family: 'PixelFont';
    src: url('assets/font/JF-Dot-Izumi16B.ttf') format('truetype');
}

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

body {
    background-color: #000;
    color: #fff;
    font-family: 'PixelFont', sans-serif;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

#game-container {
    width: 1066px;
    height: 600px;
    position: relative;
    padding: 20px;
}

.title {
    text-align: center;
    font-size: 32px;
    margin-bottom: 40px;
    margin-top: 20px;
    letter-spacing: 2px;
}

.main-menu-layout {
    display: flex;
    width: 100%;
    height: 100%;
    gap: 10px;
}

.main-menu-left {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 20px;
    position: relative;
    background-color: #000;
    border: 4px solid #fff;
    border-radius: 8px;
    box-shadow: inset 0 0 0 2px #000, 0 0 0 2px #fff;
}

.main-menu-center {
    flex: 2.5;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding-top: 30px;
    background-color: #000;
    border: 4px solid #fff;
    border-radius: 8px;
    box-shadow: inset 0 0 0 2px #000, 0 0 0 2px #fff;
}

.menu-grid-container {
    position: relative;
    width: 100%;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

#cursor {
    position: absolute;
    left: -40px;
    top: 0px;
    transition: top 0.1s;
    width: 32px;
    height: 32px;
}

#cursor img {
    width: 100%;
    height: auto;
    image-rendering: pixelated;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: min-content;
    gap: 20px 40px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-item {
    margin-bottom: 0;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-item.active {
    opacity: 1;
}

.menu-item img {
    height: 64px;
    width: auto;
    image-rendering: pixelated;
}

.character-container {
    position: absolute;
    bottom: 5px;
    right: 5px;
    display: flex;
    align-items: flex-end;
}

#occhan {
    width: 150px;
    height: auto;
    image-rendering: pixelated;
    margin-left: 20px;
}

.speech-bubble {
    position: relative;
    background: #fff;
    color: #000;
    padding: 15px 20px;
    border-radius: 10px;
    width: 280px;
    height: 85px;
    font-size: 18px;
    line-height: 1.5;
    border: 3px solid #000;
    box-shadow: 0 0 0 3px #fff;
    margin-bottom: 80px;
    margin-right: -40px;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -15px;
    right: 30px;
    border-width: 15px 15px 0;
    border-style: solid;
    border-color: #fff transparent transparent;
    display: block;
    width: 0;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -20px;
    right: 28px;
    border-width: 18px 18px 0;
    border-style: solid;
    border-color: #000 transparent transparent;
    display: block;
    width: 0;
    z-index: -1;
}

/* Status Panel (DQ Style) */
.status-panel {
    position: relative;
    width: 100%;
    padding: 20px;
    color: #fff;
}

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

.status-name {
    font-size: 24px;
    margin-bottom: 15px;
    text-align: center;
    border-bottom: 2px dashed #fff;
    padding-bottom: 10px;
}

.status-icon-placeholder {
    width: 64px;
    height: 64px;
    background-color: #333;
    border: 2px solid #fff;
    margin: 0 auto 15px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.status-row {
    font-size: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
}

.status-label {
    opacity: 0.8;
}

.status-value {
    font-weight: bold;
}

/* Screen Management */
.screen {
    display: none;
    width: 100%;
    height: 100%;
}

.screen.active {
    display: block;
}

/* Nested App Screen Management */
.app-screen {
    display: none;
    width: 100%;
    height: calc(100% - 50px);
    overflow-y: auto;
    position: absolute;
    top: 50px;
    left: 0;
    padding: 20px;
    box-sizing: border-box;
}

.app-screen.active {
    display: block;
}

#character-maker-screen.app-screen {
    overflow-y: hidden;
}

#menu-icons-view.app-screen {
    padding: 0;
    top: 50px;
}

/* Title Screen */
#title-screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.title-logo-container {
    margin-top: 60px;
    margin-bottom: 60px;
}

.title-logo {
    max-width: 600px;
    height: auto;
    image-rendering: pixelated;
}

.title-menu-container {
    position: relative;
    border: 4px solid #fff;
    padding: 30px 40px;
    background-color: #000;
    width: 300px;
}

#title-cursor {
    position: absolute;
    left: 10px;
    top: 25px;
    width: 32px;
    height: 32px;
    transition: top 0.1s;
}

#title-cursor img {
    width: 100%;
    height: auto;
    image-rendering: pixelated;
}

#title-menu-list {
    list-style: none;
    margin-left: 20px;
}

.title-menu-item {
    font-size: 24px;
    margin-bottom: 25px;
    cursor: pointer;
    opacity: 0.6;
}

.title-menu-item:last-child {
    margin-bottom: 0;
}

.title-menu-item.active {
    opacity: 1;
}

.screen-title {
    text-align: center;
    font-size: 24px;
    margin-bottom: 20px;
    border-bottom: 2px solid #fff;
    padding-bottom: 10px;
}

/* Children Registry Screen */
.registry-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.btn {
    background-color: #000;
    color: #fff;
    border: 2px solid #fff;
    padding: 10px 20px;
    font-family: 'PixelFont', sans-serif;
    font-size: 16px;
    cursor: pointer;
}

.btn:hover {
    background-color: #333;
}

.image-btn {
    padding: 0;
    background: transparent;
    border: none;
}

.image-btn:hover {
    background: transparent;
    opacity: 0.8;
}

.image-btn img {
    height: 40px;
    width: auto;
    image-rendering: pixelated;
    display: block;
}

.small-btn {
    padding: 5px 10px;
    font-size: 14px;
}

.registry-layout {
    display: flex;
    gap: 10px;
}

.age-tabs {
    display: flex;
    flex-direction: column;
    width: 60px;
    gap: 8px;
    padding-top: 10px;
}

.tab-btn {
    border: 2px solid #fff;
    border-right: none;
    border-radius: 8px 0 0 8px;
    padding: 15px 5px;
    color: #fff;
    font-family: 'PixelFont', sans-serif;
    font-size: 14px;
    cursor: pointer;
    writing-mode: vertical-lr;
    text-orientation: upright;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.staff-tab-btn {
    height: 40px;
    padding: 2px;
    font-size: 11px;
    writing-mode: horizontal-tb;
}

.tab-btn:hover {
    opacity: 0.8;
}

.tab-btn.active {
    opacity: 1;
    transform: translateX(2px);
    font-weight: bold;
    border-right: 2px solid transparent;
    z-index: 10;
}

.tab-btn.focused {
    box-shadow: 0 0 10px 2px #fff inset;
    border-color: #ffeb3b;
}

.registry-main-content {
    flex: 1;
    position: relative;
    z-index: 1;
}

.card-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    height: 340px; /* Reduced from 380px to prevent overflow */
    overflow-y: auto;
    padding: 10px;
    border: 2px solid #555;
    background-color: #111;
    align-content: flex-start;
}

.child-card {
    border: 2px solid #fff;
    padding: 10px;
    width: 120px;
    text-align: center;
    background-color: #222;
    cursor: pointer;
    transition: transform 0.1s;
}

.child-card:hover {
    transform: scale(1.05);
}

.child-card.focused {
    border: 4px solid #ffeb3b;
    transform: scale(1.05);
    box-shadow: 0 0 10px #ffeb3b;
    z-index: 10;
    position: relative;
}

.child-card img {
    width: 64px;
    height: 64px;
    image-rendering: pixelated;
    margin-bottom: 10px;
}

.child-name {
    font-size: 14px;
}

/* Information (Status) Screen */
#info-screen {
    width: 100%;
    height: 100%;
    padding: 10px;
}

.info-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.info-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
    border-bottom: 2px dashed #555;
    padding-bottom: 15px;
}

#info-icon, .staff-info-avatar-container {
    width: 100px;
    height: 100px;
    image-rendering: pixelated;
    background-color: #222;
    border: 2px solid #fff;
    padding: 5px;
    position: relative;
    box-sizing: border-box;
}

.edit-btn {
    background-color: #388e3c;
    border-color: #fff;
    font-size: 16px;
    padding: 8px 16px;
}
.edit-btn:hover {
    background-color: #2e7d32;
}

.info-details {
    display: flex;
    flex-direction: column;
    gap: 25px;
    flex: 1;
    justify-content: flex-start;
    padding-left: 20px;
    padding-right: 15px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.info-row {
    display: flex;
    align-items: center;
    font-size: 26px;
}

.info-label {
    color: #4fc3f7;
    width: 160px;
}

.info-value {
    flex: 1;
    letter-spacing: 1px;
}

/* Registration Screen */
.registration-layout {
    display: flex;
    gap: 20px;
    height: 450px;
}

.registration-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-size: 14px;
}

.name-input-container {
    display: flex;
    gap: 10px;
}

.pixel-input {
    background-color: #000;
    color: #fff;
    border: 2px solid #fff;
    padding: 8px;
    font-family: 'PixelFont', sans-serif;
    font-size: 16px;
    width: 100%;
}

.radio-group {
    display: flex;
    gap: 15px;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
}

/* Small Character variations */
.small-char {
    bottom: 20px;
    right: 20px;
}
.small-occhan {
    width: 100px !important;
}
.small-bubble {
    font-size: 14px;
    padding: 10px;
    max-width: 200px;
    margin-bottom: 60px;
}

/* RSS Screen */
.rss-layout {
    display: flex;
    flex-direction: column;
    background-color: transparent;
    border: none;
    padding: 0;
}

.rss-main-content {
    overflow-y: auto;
    border: 2px solid #fff;
    padding: 10px;
    background-color: #000;
    height: 340px;
    box-sizing: border-box;
}

.pixel-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.rss-item {
    padding: 10px;
    border-bottom: 2px dashed #333;
    font-size: 16px;
    cursor: pointer;
    color: #fff;
}

.rss-item:hover {
    background-color: #333;
    color: #ffeb3b;
}

.rss-item:last-child {
    border-bottom: none;
}

.rss-site-name {
    display: inline-block;
    color: #4fc3f7;
    margin-right: 10px;
    font-size: 14px;
}

/* RSS Manage Layout */
.rss-manage-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 2px dashed #333;
    font-size: 16px;
    color: #fff;
}

.rss-manage-item:last-child {
    border-bottom: none;
}

.rss-manage-actions {
    display: flex;
    gap: 10px;
}

/* RPG Task Screen Layout */
.rpg-layout {
    display: flex;
    gap: 20px;
    height: 450px;
    width: 100%;
}

.rpg-left-pane, .rpg-right-pane {
    flex: 1;
    background-color: #111;
    border: 2px solid #555;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.rpg-center-pane {
    flex: 1.5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #000;
    border: 4px solid #fff;
    padding: 20px;
    position: relative;
    box-shadow: inset 0 0 10px rgba(255,255,255,0.2);
}

.boss-image-container {
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.boss-image-container img {
    max-height: 100%;
    max-width: 100%;
    image-rendering: pixelated;
    transition: transform 0.1s;
}

.boss-image-container img.damage-shake {
    animation: shake 0.5s;
}

@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-5px, -5px) rotate(-2deg); }
    20% { transform: translate(-6px, 0px) rotate(2deg); }
    30% { transform: translate(6px, 4px) rotate(0deg); }
    40% { transform: translate(2px, -2px) rotate(2deg); }
    50% { transform: translate(-2px, 4px) rotate(-2deg); }
    60% { transform: translate(-6px, 2px) rotate(0deg); }
    70% { transform: translate(6px, 2px) rotate(-2deg); }
    80% { transform: translate(-2px, -2px) rotate(2deg); }
    90% { transform: translate(2px, 4px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.hp-bar-container {
    width: 80%;
    height: 25px;
    border: 3px solid #fff;
    background-color: #333;
    position: relative;
}

.hp-bar-fill {
    height: 100%;
    background-color: #4caf50;
    width: 100%;
    transition: width 0.3s ease-out, background-color 0.3s;
}

.rpg-task-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px dashed #444;
}

.rpg-task-item input[type="checkbox"] {
    transform: scale(1.5);
    margin-right: 10px;
    cursor: pointer;
}

.rpg-ranking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px dashed #444;
}

.damage-value {
    color: #ff5722;
    font-weight: bold;
    font-size: 20px;
}

/* RPG Task Hover Modal */
.attack-hover-container .rpg-tasks-modal {
    display: none;
    position: absolute;
    bottom: 0;
    left: 100%;
    transform: none;
    margin-bottom: 0;
    margin-left: 15px;
    width: 350px;
    background-color: #000;
    border: 3px solid #fff;
    border-radius: 8px;
    padding: 15px;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0,0,0,1);
}

.attack-hover-container:hover .rpg-tasks-modal {
    display: block;
}

.attack-hover-container .rpg-tasks-modal::after {
    content: '';
    position: absolute;
    top: 0;
    right: 100%;
    width: 25px;
    height: 100%;
    background: transparent;
}

/* Quest Board Rows */
.rpg-quest-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid #444;
    background-color: #2a2a2a;
    width: 100%;
    box-sizing: border-box;
}

.rpg-quest-row:last-child {
    border-bottom: none;
}

/* Mincal Calendar Styles */
.mincal-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    background-color: #000;
    border: 4px solid #fff;
    padding: 10px;
}

.mincal-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 2px solid #fff;
    margin-bottom: 5px;
}

.mincal-day {
    text-align: center;
    font-size: 20px;
    padding: 10px 0;
    font-weight: bold;
}

.mincal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: 90px;
    gap: 2px;
    background-color: #555; /* Grid line color */
    border: 2px solid #555;
}

.mincal-cell {
    background-color: #111;
    color: #fff;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mincal-cell:hover {
    background-color: #333;
}

.mincal-cell.empty {
    background-color: #050505;
    cursor: default;
}

.mincal-cell.empty:hover {
    background-color: #050505;
}

.mincal-date-number {
    font-size: 20px;
    position: absolute;
    top: 5px;
    left: 8px;
    z-index: 2;
}

.mincal-stamp-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.mincal-stamp {
    width: 60px;
    height: 60px;
    object-fit: contain;
    image-rendering: auto; /* Allow smooth rendering for stamps if needed, or keep pixelated */
    opacity: 0.9;
    transition: transform 0.1s;
}

.mincal-cell:hover .mincal-stamp {
    transform: scale(1.1);
}

/*=========================================
 * シフト表関連スタイル
 *========================================*/
.shift-color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.shift-color-option {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.shift-color-option.selected {
    border-color: #f00 !important;
    transform: scale(1.1);
}
.shift-color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}
.shift-code-table th, .shift-code-table td {
    padding: 10px;
    border-bottom: 1px solid #555;
}
.shift-code-table tr:hover {
    background-color: #222;
    cursor: pointer;
}

.shift-template-row:focus {
    outline: 2px solid #ffeb3b;
    outline-offset: -2px;
    background-color: #3d3d3d !important;
}

/* 勤務表エディタのグリッド用スタイル */
#shift-editor-grid th, #shift-editor-grid td { border: 1px solid #666; padding: 4px; box-sizing: border-box; }
#shift-editor-grid th { background-color: #333; }

/* 氏名列を左側に固定 */
#shift-editor-grid td.shift-staff-name, #shift-editor-grid th.shift-grid-corner { 
    position: sticky; left: 0; z-index: 3; background-color: #2a2a2a; font-weight: bold; min-width: 100px; box-shadow: 2px 0 5px rgba(0,0,0,0.5); 
}
#shift-editor-grid th.shift-grid-corner { z-index: 4; background-color: #444; }

/* セルのホバー・選択状態 */
#shift-editor-grid td.shift-cell { cursor: pointer; min-width: 30px; height: 35px; vertical-align: middle; }
#shift-editor-grid td.shift-cell:hover { background-color: #555 !important; filter: brightness(1.2); }
#shift-editor-grid td.shift-cell.selected { border: 2px solid #ffeb3b; background-color: #666 !important; }

/* パレット内のボタン */
.shift-palette-btn { padding: 8px; border-radius: 4px; border: 2px solid transparent; color: white; cursor: pointer; font-weight: bold; min-width: 60px; text-align: center; }
.shift-palette-btn:hover { filter: brightness(1.2); border-color: #fff; }

/* 作成済みの一覧カード */
.shift-month-card { background-color: #333; border: 2px solid #555; border-radius: 8px; padding: 15px 20px; font-size: 18px; color: white; cursor: pointer; display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.shift-month-card:hover { border-color: #4caf50; background-color: #3a3a3a; }
