self.gamewindow.setStyleSheet("")

# Because it depends on the positions and sizes of other widgets, the main
# window size is defined at the end of the file

# IC viewport
_scale = 2
self.viewport.move(0, 0)
self.viewport.resize(256 * _scale, 192 * _scale)

# Textbox
self.name.move(8 * _scale, -15 + 7 * _scale)
self.name.resize(248, 32)
self.name.setStyleSheet('color: white')
self.text.setGeometry(8 * _scale, 16 * _scale, self.viewport.width() - 32, 56 * _scale)
self.text.setStyleSheet("background-color: rgba(0, 0, 0, 0); color: white;")
self.nameFontPointSize = 6 * _scale
self.textFontPointSize = 12 * _scale

# IC input and demo slider
viewportRight = max(self.viewport.x() + self.viewport.width(), 512)
viewportBottom = self.viewport.y() + self.viewport.height()
self.ICChatInput.setGeometry(self.viewport.x(), viewportBottom, self.viewport.width(), 23)
self.sliDemoSeekbar.setGeometry(self.ICChatInput.x(), self.ICChatInput.y(), self.viewport.width(), 23)
viewportBottom += self.ICChatInput.height() # 407

# IC options
self.boxEmotes.setGeometry(164 - 28, viewportBottom + 7, 72, 20)
self.boxColors.setGeometry(self.boxEmotes.x(), viewportBottom + 33, 72, 20)
self.boxPositions.setGeometry(self.boxEmotes.x() + self.boxEmotes.size().width() + 4, self.boxEmotes.y(), 72, 20)
self.cbFlip.move(self.boxPositions.x() + self.boxPositions.width() + 4, self.boxColors.y() - 5)
self.cbPreanim.move(self.cbFlip.x(), self.cbFlip.y() + 14)
self.cbNoInterrupt.move(self.cbFlip.x() + 140, self.cbFlip.y())
self.cbAdditive.move(self.cbNoInterrupt.x(), self.cbPreanim.y())
self.cbBench.move(self.cbFlip.x() + 70, self.cbFlip.y())
self.cbSlide.move(self.cbBench.x(), self.cbPreanim.y())
self.boxEffects.setGeometry(self.boxPositions.x(), self.boxColors.y(), 72, 20)
self.btnCallMod.setGeometry(10, viewportBottom + 31, 60, 23)
self.btnSettings.setGeometry(self.btnCallMod.x()+self.btnCallMod.size().width(), viewportBottom + 31, self.btnCallMod.width(), 23)
self.btnChangeChar.setGeometry(10, viewportBottom + 7, self.btnCallMod.size().width() + self.btnSettings.size().width(), 23)
self.shownameEdit.move(self.boxPositions.x() + self.boxPositions.width() + 4, self.boxPositions.y())
self.shownameEdit.resize(viewportRight - self.shownameEdit.x(), 20)

self.gameTabs.move(8, viewportBottom + 61)
self.gameTabs.resize(viewportRight - 102, 256)

leftSideHeight = self.gameTabs.y() + self.gameTabs.height() + 6

self.ICLog.setGeometry(8, 8, self.gameTabs.width() - 22, 212)

self.boxEvidence.setGeometry(8, 8, 192, 20)
self.boxPrivateEvidence.setGeometry(8, 8, 192, 20)
self.evidenceDescription.setGeometry(8, 108, self.gameTabs.width() - 22, 112)
self.evidenceImage.setGeometry(self.evidenceDescription.x() + self.evidenceDescription.width() - 70, 8, 70, 70)

self.btnEvidenceAdd.move(8, 32)
self.btnEvidenceAdd.resize(30, 26)
evidenceadd_size = self.btnEvidenceAdd.size()
self.btnEvidenceEdit.resize(evidenceadd_size)
self.btnEvidenceDelete.resize(evidenceadd_size)
self.btnEvidenceLoad.resize(evidenceadd_size)
self.btnEvidenceSave.resize(evidenceadd_size)
self.btnEvidenceMoveToPrivate.resize(evidenceadd_size)
self.btnEvidenceMoveAllToPrivate.resize(evidenceadd_size)
self.btnEvidenceMoveToGlobal.resize(evidenceadd_size)
self.btnEvidenceMoveAllToGlobal.resize(evidenceadd_size)
self.btnEvidenceSwitchToPrivate.resize(evidenceadd_size)
self.btnEvidenceSwitchToGlobal.resize(evidenceadd_size)
self.btnEvidenceEdit.move(3 + self.btnEvidenceAdd.x() + self.btnEvidenceAdd.size().width(), self.btnEvidenceAdd.y())
self.btnEvidenceDelete.move(3 + self.btnEvidenceEdit.x() + self.btnEvidenceEdit.size().width(), self.btnEvidenceAdd.y())
self.btnEvidenceMoveToPrivate.move(3 + self.btnEvidenceDelete.x() + self.btnEvidenceDelete.size().width(), self.btnEvidenceAdd.y())
self.btnEvidenceMoveAllToPrivate.move(3 + self.btnEvidenceMoveToPrivate.x() + self.btnEvidenceMoveToPrivate.size().width(), self.btnEvidenceAdd.y())
self.btnEvidenceMoveToGlobal.move(3 + self.btnEvidenceDelete.x() + self.btnEvidenceDelete.size().width(), self.btnEvidenceAdd.y())
self.btnEvidenceMoveAllToGlobal.move(3 + self.btnEvidenceMoveToPrivate.x() + self.btnEvidenceMoveToPrivate.size().width(), self.btnEvidenceAdd.y())
self.btnEvidenceSwitchToPrivate.move(3 + self.btnEvidenceMoveAllToPrivate.x() + self.btnEvidenceMoveAllToPrivate.size().width(), self.btnEvidenceAdd.y())
self.btnEvidenceSwitchToGlobal.move(3 + self.btnEvidenceMoveAllToPrivate.x() + self.btnEvidenceMoveAllToPrivate.size().width(), self.btnEvidenceAdd.y())

self.btnEvidenceLoad.move(3 + self.btnEvidenceSwitchToPrivate.x() + self.btnEvidenceSwitchToPrivate.size().width(), self.btnEvidenceAdd.y())
self.btnEvidenceSave.move(3 + self.btnEvidenceLoad.x() + self.btnEvidenceLoad.size().width(), self.btnEvidenceAdd.y())

self.btnEvidencePresent.move(self.evidenceDescription.x() + self.evidenceDescription.width() / 2 - self.btnEvidencePresent.button_off.size().width() / 2, self.evidenceDescription.y() - self.btnEvidencePresent.button_off.size().height())

self.queueItems.setGeometry(8, 8, self.gameTabs.width() - 22, 180)
self.btnQueueRemove.resize(self.btnQueueRemove.sizeHint())
self.btnQueueRemove.move(8, self.queueItems.size().height() + 16)
self.btnQueueClear.move(self.btnQueueRemove.x() + self.btnQueueRemove.size().width(), self.btnQueueRemove.y())

self.lblNotMuted.move(8, 8)
self.unmutedList.setGeometry(8, 24, 160, 192)
self.mutedList.setGeometry(238, 24, 160, 192)
self.lblMuted.move(238 + self.mutedList.size().width() - self.mutedList.size().width() - 8, 8)
self.btnMute.setGeometry((714 - 304) / 2 - 26, 64, 48, 32)
self.btnUnmute.setGeometry((714 - 304) / 2 - 26, 128, 48, 32)

self.iniSwapList.setGeometry(8, 8, 192, self.iniSwapList.sizeHint().height())
self.btnIniSwapConfirm.resize(self.btnIniSwapConfirm.sizeHint())
self.btnIniSwapConfirm.move(714 - 304 - 22 - self.btnIniSwapConfirm.size().width(), 8)
self.btnIniSwapReset.resize(self.btnIniSwapConfirm.size())
self.btnIniSwapReset.move(714 - 304 - 22 - self.btnIniSwapConfirm.size().width(), 16 + self.btnIniSwapConfirm.size().height())
self.lblIniSwapInfo.setGeometry(8, 32, 192, 24)
self.btnIniSwapRefresh.move(8, 64)
self.btnIniSwapRefresh.resize(self.btnIniSwapRefresh.sizeHint())

self.cbPair.setGeometry(16, 16, 128, 24)
self.boxPair.setGeometry(112, 20, 192, 18)
self.sliPairOffset.setGeometry(114, 48, 192, 24)
self.lblPairOffset.move(self.sliPairOffset.x() - 88, self.sliPairOffset.y()+4)
self.sliPairOffsetY.setGeometry(114, 72, 24, 112)
self.lblPairOffsetY.move(self.lblPairOffset.x(), self.lblPairOffset.y()+64)
self.btnPairOffsetReset.move(self.sliPairOffset.x() + self.sliPairOffset.size().width() + 8, self.lblPairOffsetY.y())
self.lblPairOrder.move(self.lblPairOffset.x(), self.lblPairOffset.y()+144)
self.boxPairOrder.setGeometry(self.sliPairOffset.x(), self.lblPairOrder.y()-4, 80, self.btnPairOffsetReset.sizeHint().height())

self.cbSpacing.move(self.cbMockText.x(), self.cbMockText.y()+24)
self.cbAutoCaps.move(self.cbSpacing.x(), self.cbSpacing.y()+24)

# Judge options
self.btnDefenseBar.moveBar(self.gameTabs.x()  + self.gameTabs.width() + 11, viewportBottom + 61)
self.btnProsecutionBar.moveBar(self.btnDefenseBar.x(), viewportBottom + 75)
self.btnRealization.move(self.btnDefenseBar.x(), viewportBottom + 89)
self.btnShake.move(self.btnRealization.x() + self.btnRealization.width(), self.btnRealization.y())

self.btnWitnessTestimony.move(self.btnDefenseBar.x(), viewportBottom + 137)
self.btnCrossExamination.move(self.btnWitnessTestimony.x(), self.btnWitnessTestimony.y() + self.btnWitnessTestimony.size().height())
self.btnNotGuilty.move(self.btnWitnessTestimony.x(), self.btnCrossExamination.y() + self.btnCrossExamination.size().height())
self.btnGuilty.move(self.btnWitnessTestimony.x(), self.btnNotGuilty.y() + self.btnNotGuilty.size().height())

## Sidebar

# OOC chat
self.OOCLog.setGeometry(viewportRight + 14, 0, 288, max(730, leftSideHeight) - 482)
self.OOCNameInput.resize(self.OOCNameInput.sizeHint().width() - 32, self.OOCNameInput.sizeHint().height())
self.OOCNameInput.move(viewportRight + 14, self.OOCLog.y() + self.OOCLog.height())
self.OOCInput.resize(self.OOCLog.width() - self.OOCNameInput.width(), self.OOCInput.sizeHint().height())
self.OOCInput.move(viewportRight + 14 + self.OOCNameInput.size().width(), self.OOCNameInput.y())

oocBottom = self.OOCNameInput.y() + self.OOCNameInput.height() # 268

# Volume sliders and mod login
self.sliMusicVolume.setGeometry(self.OOCNameInput.x(), oocBottom + 8, 192, 16)
self.sliSoundVolume.setGeometry(self.OOCNameInput.x(), oocBottom + 32, 192, 16)
self.sliBlipsVolume.setGeometry(self.OOCNameInput.x(), oocBottom + 56, 192, 16)
self.lblMusicVolume.move(self.sliMusicVolume.x() + self.sliMusicVolume.size().width()+8, self.sliMusicVolume.y())
self.lblSoundVolume.move(self.sliSoundVolume.x() + self.sliSoundVolume.size().width()+8, self.sliSoundVolume.y())
self.lblBlipsVolume.move(self.sliBlipsVolume.x() + self.sliBlipsVolume.size().width()+8, self.sliBlipsVolume.y())

self.lblPing.setGeometry(self.lblBlipsVolume.x() + 32, self.lblBlipsVolume.y(), 96, 14)
self.OOCLogin.resize(48, 20)
self.OOCLogin.move(viewportRight + 14 + self.OOCLog.size().width() - (self.OOCLogin.size().width()), oocBottom + 6)

# Objection and emote buttons
self.btnHoldIt.move(viewportRight + 14, oocBottom + 84)
self.btnObjection.move(self.btnHoldIt.x() + 70, self.btnHoldIt.y())
self.btnTakeThat.move(self.btnObjection.x() + 70, self.btnHoldIt.y())
self.btnCustomObjection.move(self.btnTakeThat.x() + 70, self.btnHoldIt.y())

self.emotePageGeometry = (viewportRight + 14, oocBottom + 116, 288, 98)
self.btnPrevEmotePage.move(viewportRight + 8, oocBottom + 147)
self.btnNextEmotePage.move(viewportRight + 286, self.btnPrevEmotePage.y())

# Server tabs
self.serverTabs.setGeometry(viewportRight + 14, oocBottom + 200, 288, 258)

self.musicItems.setGeometry(8, 8, 268, 184)
self.btnMusicOptions.setGeometry(self.musicItems.x() + self.musicItems.width() - self.btnMusicOptions.sizeHint().width(), self.musicItems.size().height() + 16, self.btnMusicOptions.sizeHint().width(), self.musicSearch.sizeHint().height())
self.musicSearch.setGeometry(8, self.btnMusicOptions.y(), self.musicItems.width() - self.btnMusicOptions.width() - 4, self.musicSearch.sizeHint().height())
self.foundSongItemColor = "#80ff80"

self.backgroundItems.setGeometry(8, 8, 268, 184)
self.backgroundSearch.setGeometry(8, self.musicItems.size().height() + 16, 268 - self.btnBackgroundsRefresh.sizeHint().width() - 20, self.backgroundSearch.sizeHint().height())
self.btnBackgroundsRefresh.resize(self.btnBackgroundsRefresh.sizeHint().width(), self.backgroundSearch.height())
self.btnBackgroundsRefresh.move(self.backgroundItems.width() - self.btnBackgroundsRefresh.width(), self.backgroundItems.size().height() + 16)

self.playerItems.setGeometry(8, 8, 268, 180)
self.btnPlayerPair.resize(self.btnPlayerPair.sizeHint())
self.btnPlayerKick.resize(self.btnPlayerKick.sizeHint())
self.btnPlayerBan.resize(self.btnPlayerBan.sizeHint())
self.btnPlayerPair.move(8, self.playerItems.size().height() + 16)
self.btnPlayerKick.move(8 + self.btnPlayerPair.x() + self.btnPlayerPair.size().width(), self.playerItems.size().height() + 16)
self.btnPlayerBan.move(8 + self.btnPlayerKick.x() + self.btnPlayerKick.size().width(), self.playerItems.size().height() + 16)

# Main window
self.width = self.OOCLog.x() + self.OOCLog.width() + 4
self.height = max(730, leftSideHeight)