@charset "UTF-8";

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@500;700;900&family=Poppins:wght@700;900&display=swap');

:root {
  --color-bg: #fff4b3;          
  --color-grid: #ffebb8;
  --color-text: #222;           
  --color-border: #333;         
  --color-yellow: #f8c800;      
  --color-blue: #5bc0eb;
  --color-pink: #fa7921;
  --color-white: #ffffff;
  --border-style: 2px solid var(--color-border);
  --font-en: 'Poppins', sans-serif;
  --font-ja: 'Noto Sans JP', sans-serif;
}

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

body {
  font-family: var(--font-ja);
  color: var(--color-text);
  background-color: var(--color-bg);
  background-image: 
    linear-gradient(var(--color-grid) 2px, transparent 2px), 
    linear-gradient(90deg, var(--color-grid) 2px, transparent 2px);
  background-size: 30px 30px;
  height: 100vh;
  overflow: hidden;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* --- Typography --- */
h1, h2, h3 {
  font-family: var(--font-ja);
  font-weight: 900;
  color: var(--color-text);
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--color-white);
  border-bottom: var(--border-style);
  z-index: 20;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 28px;
  height: 28px;
  background: var(--color-yellow);
  border: var(--border-style);
  border-radius: 6px;
  box-shadow: 3px 3px 0 var(--color-border);
}

.app-header h1 {
  font-family: var(--font-en);
  font-size: 1.6rem;
  letter-spacing: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.divider {
  width: 2px;
  height: 24px;
  background: var(--color-border);
  margin: 0 5px;
}

/* --- Buttons (Neo Brutalism Style) --- */
button {
  cursor: pointer;
  font-family: var(--font-ja);
  font-weight: 700;
  transition: transform 0.1s ease-out, box-shadow 0.1s ease-out;
  border: var(--border-style);
  border-radius: 8px;
  background: var(--color-white);
  color: var(--color-text);
}

button:active {
  transform: translate(4px, 4px) !important;
  box-shadow: 0px 0px 0 var(--color-border) !important;
}

.icon-btn {
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  background: var(--color-white);
  box-shadow: 3px 3px 0 var(--color-border);
}
.icon-btn:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--color-border); }

.glass-btn {
  padding: 0.6rem 1.2rem;
  background: var(--color-white);
  box-shadow: 3px 3px 0 var(--color-border);
}
.glass-btn:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--color-border); }

.primary-btn {
  background: var(--color-yellow);
  padding: 0.6rem 1.2rem;
  box-shadow: 4px 4px 0 var(--color-border);
}
.primary-btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--color-border); }

.danger-btn {
  background: var(--color-pink);
  color: #fff;
  padding: 0.6rem 1.2rem;
  box-shadow: 3px 3px 0 var(--color-border);
}
.danger-btn:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--color-border); }

.action-btn {
  width: 100%;
  padding: 1rem;
  background: var(--color-blue);
  color: #fff;
  font-size: 1.05rem;
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--color-border);
  margin-top: 1rem;
}
.action-btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--color-border); }

/* --- Layout --- */
.app-main {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

.sidebar {
  width: 340px;
  background: var(--color-white);
  border-right: var(--border-style);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.tab-container {
  display: flex;
  border-bottom: var(--border-style);
  background: #f0f0f0;
}

.tab {
  flex: 1;
  background: transparent;
  border: none;
  border-right: var(--border-style);
  border-radius: 0;
  color: #777;
  padding: 1rem 0;
  font-weight: 900;
  box-shadow: none !important;
  transition: none;
}
.tab:active { transform: none !important; }
.tab:last-child { border-right: none; }

.tab.active {
  background: var(--color-white);
  color: var(--color-text);
  border-bottom: 2px solid var(--color-white);
  margin-bottom: -2px;
  z-index: 2;
}

.tools-section {
  padding: 1.8rem;
  overflow-y: auto;
}

.tools-section h2 {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  position: relative;
  display: inline-block;
}

.tools-section h2::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 6px;
  background: var(--color-yellow);
  z-index: -1;
}

/* --- Modals --- */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background-color: rgba(0,0,0,0.7);
  display: flex; justify-content: center; align-items: center;
  z-index: 9999;
}
.modal-overlay.hidden { display: none; }
.modal-content {
  background-color: var(--color-white);
  padding: 20px; border-radius: 12px;
  border: 4px solid var(--color-text);
  box-shadow: 8px 8px 0 var(--color-text);
  width: 90%; max-width: 600px;
}
.cropper-container {
  border: 2px dashed #999; border-radius: 8px; overflow: hidden;
  background-color: #eee;
}
.cropper-view-box, .cropper-face {
  border-radius: 50%;
}

/* --- Helpers --- */
.form-group { margin-bottom: 1.5rem; }
.form-row { display: flex; gap: 15px; }
.form-group.half { flex: 1; }

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

input[type="text"], select {
  width: 100%;
  padding: 0.8rem;
  background: #fff;
  border: var(--border-style);
  border-radius: 8px;
  color: var(--color-text);
  font-size: 1rem;
  font-family: var(--font-ja);
  font-weight: 700;
  box-shadow: inset 2px 2px 0px rgba(0,0,0,0.05);
}

input[type="text"]:focus, select:focus {
  outline: none;
  background: #fffdf5;
  box-shadow: 0 0 0 4px var(--color-yellow);
}

.file-input-wrapper {
  position: relative;
  overflow: hidden;
}

.file-btn {
  width: 100%;
  padding: 0.8rem;
  background: #f0f0f0;
  border: 2px dashed var(--color-border);
  border-radius: 8px;
  font-weight: 700;
  box-shadow: none;
}
.file-btn:hover { background: #e0e0e0; transform: none; box-shadow: none; }

.file-input-wrapper input[type="file"] {
  position: absolute;
  left: 0; top: 0; opacity: 0; cursor: pointer;
  height: 100%; width: 100%;
}

input[type="color"] {
  width: 100%;
  height: 48px;
  background: #fff;
  border: var(--border-style);
  border-radius: 8px;
  cursor: pointer;
  padding: 2px;
}

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

.color-input-wrapper input[type="color"] {
  width: 60px;
  flex-shrink: 0;
}

.color-input-wrapper input[type="text"] {
  flex: 1;
  text-transform: uppercase;
}

.help-text {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.6;
  background: var(--color-white);
  border: var(--border-style);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  box-shadow: 3px 3px 0 var(--color-border);
}

.help-text-small {
  font-size: 0.8rem;
  font-weight: 700;
  color: #555;
  margin-bottom: 1rem;
}

.highlight-panel {
  background: #fffdf5;
  border: var(--border-style);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--color-border);
  padding: 1.5rem;
  margin-top: 2rem;
}

.btn-group { display: flex; gap: 10px; }
.btn-group button { flex: 1; }

/* --- Canvas Area --- */
.canvas-container-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  /* Light Yellow Grid Background */
  background-color: var(--color-bg); 
  background-image: 
    linear-gradient(var(--color-grid) 2px, transparent 2px), 
    linear-gradient(90deg, var(--color-grid) 2px, transparent 2px);
  background-size: 30px 30px;
}

#canvas-wrapper {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}

/* --- Screenshot Mode --- */
#screenshot-overlay {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  padding: 2rem 3rem;
  background: var(--color-white);
  border: var(--border-style);
  border-radius: 16px;
  box-shadow: 8px 8px 0 var(--color-border);
  z-index: 100;
}

#screenshot-overlay p {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

#screenshot-overlay span {
  display: block;
  font-weight: 700;
  color: #555;
  margin-bottom: 1.5rem;
}

.mt-2 { margin-top: 1rem; }
.hidden { display: none !important; }

/* --- Period Tabs --- */
.period-tabs-container {
  display: flex;
  background: var(--color-white);
  border-bottom: var(--border-style);
  padding: 10px 20px 0;
  gap: 8px;
  overflow-x: auto;
  z-index: 15;
}

.period-tab {
  padding: 8px 16px;
  background: #f0f0f0;
  border: var(--border-style);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  font-family: var(--font-ja);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 2px 0 0 var(--color-border);
  margin-bottom: -2px;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.period-tab.active {
  background: var(--color-yellow);
  z-index: 2;
  box-shadow: 2px -2px 0 var(--color-border);
}

.period-tab:hover:not(.active) {
  background: #e0e0e0;
}

.add-period-btn {
  background: var(--color-blue);
  color: white;
  border-radius: 8px 8px 0 0;
  padding: 8px 16px;
  border: var(--border-style);
  border-bottom: none;
  font-family: var(--font-ja);
  font-weight: 700;
  cursor: pointer;
  margin-bottom: -2px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Custom Dialog */
.custom-dialog-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background-color: rgba(0,0,0,0.7);
  display: flex; justify-content: center; align-items: center;
  z-index: 10000;
}
.custom-dialog-content {
  background-color: var(--color-white);
  padding: 24px; border-radius: 12px;
  border: 4px solid var(--color-text);
  box-shadow: 8px 8px 0 var(--color-text);
  width: 90%; max-width: 400px;
  text-align: center;
}
.custom-dialog-content h3 { margin-bottom: 16px; }
.custom-dialog-actions {
  display: flex; flex-direction: column; gap: 12px; margin-top: 24px;
}

/* Drawer Handle (Hidden on PC) */
.drawer-handle {
  display: none;
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
  .app-main {
    flex-direction: column;
  }
  .canvas-container-wrapper {
    height: 100%;
    width: 100%;
  }
  .sidebar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60vh;
    border-right: none;
    border-top: var(--border-style);
    overflow-y: auto;
    background: var(--color-bg);
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(calc(100% - 48px)); /* 48px for handle */
    box-shadow: 0 -4px 10px rgba(0,0,0,0.1);
  }
  .sidebar.drawer-open {
    transform: translateY(0);
  }
  .drawer-handle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 48px;
    background: var(--color-yellow);
    border-bottom: var(--border-style);
    cursor: pointer;
    position: sticky;
    top: 0;
    z-index: 10;
  }
  .drawer-handle-bar {
    width: 40px;
    height: 6px;
    background: var(--color-text);
    border-radius: 3px;
    margin-bottom: 4px;
  }
  .drawer-handle span {
    font-size: 0.8rem;
    font-weight: 900;
    color: var(--color-text);
  }
  .app-header {
    padding: 10px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .header-actions {
    gap: 6px;
    flex-wrap: wrap;
  }
  .glass-btn, .primary-btn, .danger-btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
  }
}

/* Floating Pan Mode Button */
.pan-toggle-btn {
  position: absolute;
  bottom: 60px;
  right: 20px;
  background: var(--color-white);
  border: var(--border-style);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 4px 4px 0 var(--color-border);
  z-index: 50;
  transition: transform 0.1s, box-shadow 0.1s;
}
.pan-toggle-btn.active {
  background: var(--color-yellow);
  box-shadow: 2px 2px 0 var(--color-border);
  transform: translate(2px, 2px);
}

